| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.command.AbstractCommand
An abstract implementation of a basic command.
Each derived class
It is very convenient to use prepare, as it is guaranteed to be called only once just before canExecute is to be tested. It can be implemented to create any additional commands that need to be executed, and the result it yields becomes the permanent cached return value for canExecute.
Nested Class Summary | |
static interface | AbstractCommand.NonDirtying
A marker interface implemented by commands that don't dirty the model. |
Field Summary | |
protected String | description
Holds a short textual description of the command as returned by getDescription() and set by setDescription(java.lang.String). |
protected boolean | isExecutable
Keeps track of whether the command is executable. |
protected boolean | isPrepared
Keeps track of whether prepare needs to be called. |
protected String | label
Holds the label of the command as returned by getLabel() and set by setLabel(java.lang.String). |
Constructor Summary | |
protected | AbstractCommand()
Creates an empty instance. |
protected | AbstractCommand(String label)
Creates an instance with the given label. |
protected | AbstractCommand(String label,
String description)
Creates and instance with the given label and description. |
Method Summary | |
boolean | canExecute()
Calls prepare(), caches the result in isExecutable, and sets isPrepared to true; from then on, it will yield the value of isExecutable. |
boolean | canUndo()
Returns true because most command should be undoable. |
Command | chain(Command command)
Creates a new compound command, containing this command and the given command, that delegates chain to CompoundCommand.append(org.eclipse.emf.common.command.Command). |
void | dispose()
Called to indicate that the command will never be used again. |
Collection | getAffectedObjects()
Returns an empty list. |
String | getDescription()
Returns a string suitable to help describe the effect of this command. |
String | getLabel()
Returns a string suitable to represent the label that identifies this command. |
Collection | getResult()
Returns an empty list. |
protected boolean | prepare()
Called at most once in canExecute() to give the command an opportunity to ready itself for execution. |
void | setDescription(String description)
Sets the description after construction. |
void | setLabel(String label)
Sets the label after construction. |
String | toString()
Returns an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of field:value pairs. |
void | undo()
Throws a runtime exception. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.emf.common.command.Command |
execute, redo |
Field Detail |
protected boolean isPrepared
protected boolean isExecutable
protected String description
protected String label
Constructor Detail |
protected AbstractCommand()
protected AbstractCommand(String label)
protected AbstractCommand(String label, String description)
Method Detail |
protected boolean prepare()
public boolean canExecute()
public boolean canUndo()
public void undo()
public Collection getResult()
public Collection getAffectedObjects()
public String getLabel()
public void setLabel(String label)
public String getDescription()
public void setDescription(String description)
public Command chain(Command command)
public void dispose()
public String toString()
|
Copyright 2001-2004 IBM Corporation and others. All Rights Reserved. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |