public interface OverrideableCommand extends Command
EditingDomain.createOverrideCommand
in its constructor to set up the override command.
All its Command
methods should then be guarded as follows:
public void execute() { if (getOverride() != null) { getOverride().execute(); } else { doExecute(); } }The contract with the overriding command is that the overrideable command will implement all its methods in corresponding doXxx methods, e.g., execute() is implemented in doExecute(), so that the overriding command can call back to the overrideable command's doXxx methods if it wants to extend rather than replace the original implementation.
AbstractOverrideableCommand
provides a convenient base implementation for overrideable commands.Modifier and Type | Method and Description |
---|---|
boolean |
doCanExecute()
This is overrideable command's implementation of canExecute.
|
boolean |
doCanUndo()
This is overrideable command's implementation of canUndo.
|
void |
doDispose()
This is overrideable command's implementation of dispose.
|
void |
doExecute()
This is overrideable command's implementation of execute.
|
java.util.Collection<?> |
doGetAffectedObjects()
This is overrideable command's implementation of getAffectedObjects.
|
java.lang.String |
doGetDescription()
This is overrideable command's implementation of getDescription.
|
java.lang.String |
doGetLabel()
This is overrideable command's implementation of getLabel.
|
java.util.Collection<?> |
doGetResult()
This is overrideable command's implementation of getResult.
|
void |
doRedo()
This is overrideable command's implementation of redo.
|
void |
doUndo()
This is overrideable command's implementation of undo.
|
Command |
getOverride()
This returns the command that overrides this command.
|
void |
setOverride(Command overrideCommand)
This sets the command that overrides this command.
|
canExecute, canUndo, chain, dispose, execute, getAffectedObjects, getDescription, getLabel, getResult, redo, undo
Command getOverride()
void setOverride(Command overrideCommand)
boolean doCanExecute()
void doExecute()
boolean doCanUndo()
void doUndo()
void doRedo()
java.util.Collection<?> doGetResult()
java.util.Collection<?> doGetAffectedObjects()
java.lang.String doGetLabel()
java.lang.String doGetDescription()
void doDispose()