|
GEF v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.eclipse.gef.commands.DefaultCommandStack
A default implementation for the CommandStack interface.
| Field Summary | |
protected List |
listeners
|
protected Command |
mostRecentCommand
|
protected int |
saveIndex
|
| Fields inherited from interface org.eclipse.gef.commands.CommandStack |
copyright |
| Constructor Summary | |
DefaultCommandStack()
Default constructor. |
|
| Method Summary | |
void |
addCommandStackListener(CommandStackListener listener)
Adds a listener to this CommandStack. |
boolean |
canRedo()
Returns true if there is a Command to redo. |
boolean |
canRedoCommand(Command command)
Returns true if given Command can be redone. |
boolean |
canUndo()
Returns true if the last Command executed can be undone. |
boolean |
canUndoCommand(Command command)
Returns true if given Command can be undone. |
void |
execute(Command command)
Executes the given Command if it can execute. |
void |
flush()
Clears both the undo and redo stacks, then sends a notification to any object listening to the CommandStack. |
protected void |
flushRedo()
Clears the redo stack. |
protected void |
flushUndo()
Clears the undo stack. |
Object[] |
getCommands()
Returns an array containing the commands in both stacks. |
Command |
getMostRecentCommand()
Returns the most recently executed command. |
Command |
getRedoCommand()
Returns the command at the top of the redo stack. |
Command |
getUndoCommand()
Returns the next command to be undone. |
boolean |
isSaveNeeded()
Returns true if the model needs to be saved. |
protected void |
notifyListeners()
Sends a notification to any object listening to this CommandStack. |
void |
redo()
Executes the last undone Command. |
void |
removeCommandStackListener(CommandStackListener listener)
Removes the given CommandStackListener. |
void |
saveIsDone()
Flushes the undo and redo stacks. |
void |
undo()
Undoes the last executed Command. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Command mostRecentCommand
protected List listeners
protected int saveIndex
| Constructor Detail |
public DefaultCommandStack()
| Method Detail |
public void addCommandStackListener(CommandStackListener listener)
addCommandStackListener in interface CommandStacklistener - The Object listening to this CommandStack.public boolean canRedo()
true if there is a Command to redo.canRedo in interface CommandStacktrue if there is a Command to redo.public boolean canRedoCommand(Command command)
true if given Command can be redone.true if given Command can be redone.public boolean canUndo()
true if the last Command executed can be undone.canUndo in interface CommandStacktrue if the last Command executed can be undone.public boolean canUndoCommand(Command command)
true if given Command can be undone.true if given Command can be undone.public void execute(Command command)
execute in interface CommandStackcommand - The Command to execute.public void flush()
flush in interface CommandStackprotected void flushRedo()
protected void flushUndo()
public Object[] getCommands()
public Command getMostRecentCommand()
getMostRecentCommand in interface CommandStackpublic Command getRedoCommand()
getRedoCommand in interface CommandStackpublic Command getUndoCommand()
getUndoCommand in interface CommandStackpublic boolean isSaveNeeded()
true if the model needs to be saved.true if the model needs to be saved.protected void notifyListeners()
public void redo()
redo in interface CommandStackpublic void removeCommandStackListener(CommandStackListener listener)
removeCommandStackListener in interface CommandStacklistener - The object to be removed from the list of listeners.public void saveIsDone()
public void undo()
undo in interface CommandStack
|
GEF v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||