|
org.eclipse.emf.transaction.util
Class TriggerCommand
java.lang.Object
org.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.common.command.CompoundCommand
org.eclipse.emf.transaction.util.ConditionalRedoCommand.Compound
org.eclipse.emf.transaction.util.TriggerCommand
-
All Implemented Interfaces:
-
Command,
ConditionalRedoCommand
-
public class TriggerCommand
- extends
ConditionalRedoCommand.Compound
A specialized compound command that combines a "triggering" command with commands
contributed by
ResourceSetListener s as triggers. It takes care of
the distinction between the triggering command and the others when executing,
undoing, and redoing.
Constructor Summary
|
TriggerCommand
(
Command triggeringCommand,
List<? extends
Command> triggers)
Initializes me with a list of commands triggered by the execution of
some command on the command stack. |
TriggerCommand
(
List<? extends
Command> triggers)
Initializes me with a list of commands triggered not by the execution of
a command but by direct manipulation of the model during a read/write
transaction. |
Method Summary
|
void
|
dispose
()
Extends the inherited implementation by disposing my triggering command,
also (if any). |
void
|
execute
()
Executes all of my trigger commands, then prepends the original triggering
command (if any) so that it will be undone/redone with the others. |
Command
|
getTriggeringCommand
()
Retrieves the command that triggered the trigger commands. |
List<
Command>
|
getTriggers
()
Retrieves my trigger commands (not including the triggering command,
if any). |
protected boolean
|
prepare
()
|
Methods inherited from class org.eclipse.emf.common.command.
CompoundCommand
|
append,
appendAndExecute,
appendIfCanExecute,
canUndo,
getAffectedObjects,
getCommandList,
getDescription,
getLabel,
getMergedAffectedObjectsCollection,
getMergedResultCollection,
getResult,
getResultIndex,
isEmpty,
redo,
toString,
undo,
unwrap
|
TriggerCommand
public TriggerCommand(
List<? extends
Command> triggers)
- Initializes me with a list of commands triggered not by the execution of
a command but by direct manipulation of the model during a read/write
transaction. It is assumed, then, that the trigger command will not
actually be used with a command stack where its label and description
would matter for undo/redo menus.
-
Parameters:
-
triggers - the trigger commands that I encapsulate
TriggerCommand
public TriggerCommand(
Command triggeringCommand,
List<? extends
Command> triggers)
- Initializes me with a list of commands triggered by the execution of
some command on the command stack. My label and description are the same
as the triggering command's
-
Parameters:
-
triggeringCommand - the command that triggered further commands -
triggers - the trigger commands that I encapsulate
getTriggeringCommand
public final
Command getTriggeringCommand()
- Retrieves the command that triggered the trigger commands.
-
-
Returns:
- the triggering command, or
null if the triggers
were not instigated by the execution of a command
getTriggers
public final
List<
Command> getTriggers()
- Retrieves my trigger commands (not including the triggering command,
if any).
-
-
Returns:
- my triggers, as a list of
Command s. Will not be empty
prepare
protected boolean prepare()
-
-
Overrides:
-
prepare
in class
CompoundCommand
-
execute
public void execute()
- Executes all of my trigger commands, then prepends the original triggering
command (if any) so that it will be undone/redone with the others.
-
-
Specified by:
-
execute
in interface
Command
-
Overrides:
-
execute
in class
CompoundCommand
-
dispose
public void dispose()
- Extends the inherited implementation by disposing my triggering command,
also (if any).
-
-
Specified by:
-
dispose
in interface
Command
-
Overrides:
-
dispose
in class
CompoundCommand
-
|
|