| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.command.BasicCommandStack
A basic and obvious implementation of an undoable stack of commands. See Command for more details about the command methods that this implementation uses.
Field Summary | |
protected List | commandList
The list of commands. |
protected Collection | listeners
The CommandStackListeners. |
protected Command | mostRecentCommand
The command most recently executed, undone, or redone. |
protected int | saveIndex
The value of top when saveIsDone() is called. |
protected int | top
The current position within the list from which the next execute, undo, or redo, will be performed. |
Constructor Summary | |
BasicCommandStack()
Creates a new empty instance. |
Method Summary | |
void | addCommandStackListener(CommandStackListener listener)
Adds a listener to the command stack, which will be notified whenever a command has been processed on the stack. |
boolean | canRedo()
Returns whether there are commands past the top of the stack that can be redone. |
boolean | canUndo()
Returns whether the top command on the stack can be undone. |
void | execute(Command command)
Clears any redoable commands not yet redone, adds the command, and then executes the command. |
void | flush()
Disposes all the commands in the stack. |
Command | getMostRecentCommand()
Returns the command most recently executed, undone, or redone. |
Command | getRedoCommand()
Returns the command that will be redone if redo() is called. |
Command | getUndoCommand()
Returns the command that will be undone if undo() is called. |
boolean | isSaveNeeded()
Returns whether the model has changes since saveIsDone() was call the last. |
protected void | notifyListeners()
This is called to ensure that CommandStackListener.commandStackChanged(java.util.EventObject) is called for each listener. |
void | redo()
Moves the top of the stack up, redoing the new top command. |
void | removeCommandStackListener(CommandStackListener listener)
Removes a listener from the command stack. |
void | saveIsDone()
Called after a save has been successfully performed. |
void | undo()
Moves the top of the stack down, undoing what was formerly the top command. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected List commandList
protected int top
protected Command mostRecentCommand
protected Collection listeners
protected int saveIndex
Constructor Detail |
public BasicCommandStack()
Method Detail |
public void execute(Command command)
public boolean canUndo()
public void undo()
public boolean canRedo()
public void redo()
public void flush()
public Command getUndoCommand()
public Command getRedoCommand()
public Command getMostRecentCommand()
public void addCommandStackListener(CommandStackListener listener)
public void removeCommandStackListener(CommandStackListener listener)
protected void notifyListeners()
public void saveIsDone()
public boolean isSaveNeeded()
|
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 |