|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.commands.Command
org.eclipse.gef.commands.CompoundCommand
public class CompoundCommand
An aggregation of multiple Commands
. A
CompoundCommand
is executable if all of its contained Commands
are executable, and it has at least one contained Command. The same is true
for undo. When undo is called, the contained Commands are undone in the
reverse order in which they were executed.
An empty CompoundCommand is not executable.
A CompoundCommand can be unwrapped
. Unwrapping returns the
simplest equivalent form of the CompoundCommand. So, if a CompoundCommand
contains just one Command, that Command is returned.
Constructor Summary | |
---|---|
CompoundCommand()
Constructs an empty CompoundCommand |
|
CompoundCommand(String label)
Constructs an empty CompoundCommand with the specified label. |
Method Summary | |
---|---|
void |
add(Command command)
Adds the specified command if it is not null . |
boolean |
canExecute()
|
boolean |
canUndo()
|
void |
dispose()
Disposes all contained Commands. |
void |
execute()
Execute the command.For a compound command this means executing all of the commands that it contains. |
Object[] |
getChildren()
This is useful when implementing ITreeContentProvider.getChildren(Object)
to display the Command's nested structure. |
List |
getCommands()
|
String |
getLabel()
|
boolean |
isEmpty()
|
void |
redo()
Re-executes the Command. |
int |
size()
|
void |
undo()
Undoes the changes performed during execute() . |
Command |
unwrap()
Returns the simplest form of this Command that is equivalent. |
Methods inherited from class org.eclipse.gef.commands.Command |
---|
chain, getDebugLabel, setDebugLabel, setLabel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompoundCommand()
public CompoundCommand(String label)
label
- the label for the CommandMethod Detail |
---|
public void add(Command command)
null
.
command
- null
or a Commandpublic boolean canExecute()
canExecute
in class Command
true
if the command can be executedCommand.canExecute()
public boolean canUndo()
canUndo
in class Command
true
if the command can be undone. This method
should only be called after execute()
or
redo()
has been called.Command.canUndo()
public void dispose()
dispose
in class Command
Command.dispose()
public void execute()
execute
in class Command
public Object[] getChildren()
ITreeContentProvider.getChildren(Object)
to display the Command's nested structure.
public List getCommands()
public String getLabel()
getLabel
in class Command
Command.getLabel()
public boolean isEmpty()
true
if the CompoundCommand is emptypublic void redo()
Command
undo()
has been called.
redo
in class Command
Command.redo()
public int size()
public void undo()
Command
execute()
. This method
should only be called after execute
has been called, and
only when canUndo()
returns true
.
undo
in class Command
Command.undo()
public Command unwrap()
|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |