001 package com.oxygenxml.validate.nvdl;
002
003 import org.xml.sax.ContentHandler;
004
005 /**
006 * Unwrap result action.
007 * This action an element but allows its content.
008 */
009 class UnwrapAction extends ResultAction {
010 /**
011 * Creates an unwrap action with a given mode usage.
012 * @param modeUsage The action mode usage.
013 */
014 UnwrapAction(ModeUsage modeUsage) {
015 super(modeUsage);
016 }
017
018 /**
019 * Perform this action.
020 *
021 * @param handler ???
022 * @param state the section state.
023 */
024 void perform(ContentHandler handler, SectionState state) {
025 state.addChildMode(getModeUsage(), handler);
026 }
027
028 /**
029 * Get a new unwrap action with a mode usage with the current mode changed.
030 * This is useful when we have modes extending other modes as we need to get
031 * the actions from the base mode as actions on the new mode.
032 */
033 ResultAction changeCurrentMode(Mode mode) {
034 return new UnwrapAction(getModeUsage().changeCurrentMode(mode));
035 }
036 }