Package org.eclipse.gef.commands
Class Command
java.lang.Object
org.eclipse.gef.commands.Command
- Direct Known Subclasses:
- CompoundCommand,- SetPropertyValueCommand,- UnexecutableCommand
An Abstract implementation of 
Command.- Since:
- 2.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleancanRedo()booleancanUndo()Returns a Command that represents the chaining of a specified Command to this Command.voiddispose()This is called to indicate that theCommandwill not be used again.voidexecute()Executes the Command.getLabel()voidredo()Re-executes the Command.voidsetDebugLabel(String label) Sets the debug label for this commandvoidSets the label used to describe this command to the User.voidundo()Undoes the changes performed duringexecute().
- 
Constructor Details- 
Commandpublic Command()Constructs a Command with no label.
- 
CommandConstructs a Command with the specified label.- Parameters:
- label- the Command's label
 
 
- 
- 
Method Details- 
canRedopublic boolean canRedo()- Returns:
- trueif the command can be redone. This method should only be called after- undo()has been called.
- Since:
- 3.10
 
- 
canExecutepublic boolean canExecute()- Returns:
- trueif the command can be executed
 
- 
canUndopublic boolean canUndo()- Returns:
- trueif the command can be undone. This method should only be called after- execute()or- redo()has been called.
 
- 
chainReturns a Command that represents the chaining of a specified Command to this Command. The Command being chained willexecute()after this command has executed, and it willundo()before this Command is undone.- Parameters:
- command-- nullor the Command being chained
- Returns:
- a Command representing the union
 
- 
disposepublic void dispose()This is called to indicate that theCommandwill not be used again. The Command may be in any state (executed, undone or redone) when dispose is called. The Command should not be referenced in any way after it has been disposed.
- 
executepublic void execute()Executes the Command. This method should not be called if the Command is not executable.
- 
getDebugLabel- Returns:
- an untranslated String used for debug purposes only
 
- 
getLabel- Returns:
- a String used to describe this command to the User
 
- 
redopublic void redo()Re-executes the Command. This method should only be called afterundo()has been called.
- 
setDebugLabelSets the debug label for this command- Parameters:
- label- a description used for debugging only
 
- 
setLabelSets the label used to describe this command to the User.- Parameters:
- label- the label
 
- 
undopublic void undo()Undoes the changes performed duringexecute(). This method should only be called afterexecutehas been called, and only whencanUndo()returnstrue.- See Also:
 
 
-