GEF v2.0

org.eclipse.gef.commands
Interface CommandStack

All Known Implementing Classes:
DefaultCommandStack

public interface CommandStack

This is a simple and obvious interface for an undoable stack of commands with a listener. See Command for more details about the command methods that this implementation uses and CommandStackListener for details about the listener.


Field Summary
static String copyright
           
 
Method Summary
 void addCommandStackListener(CommandStackListener listener)
          This adds a listener to the command stack, which will be notified whenever a command has been processed on the stack.
 boolean canRedo()
          This returns whether there are commands past the top of the stack that can be redone.
 boolean canUndo()
          This returns whether the top command on the stack can be undone.
 void execute(Command command)
          This will clear any redoable commands not yet redone, add the command, and then execute the command.
 void flush()
          This will dispose all the commands in the stack.
 Command getMostRecentCommand()
          This returns the command most recently executed, undone, or redone.
 Command getRedoCommand()
          This returns the command that will be redone if redo() is called.
 Command getUndoCommand()
          This returns the command that will be undone if undo() is called.
 void redo()
          This moves the top of the stack up, redoing the new top command.
 void removeCommandStackListener(CommandStackListener listener)
          This removes a previously added listener.
 void undo()
          This moves the top of the stack down, undoing what was formerly the top command.
 

Field Detail

copyright

public static final String copyright
Method Detail

execute

public void execute(Command command)
This will clear any redoable commands not yet redone, add the command, and then execute the command.

canUndo

public boolean canUndo()
This returns whether the top command on the stack can be undone.

undo

public void undo()
This moves the top of the stack down, undoing what was formerly the top command.

canRedo

public boolean canRedo()
This returns whether there are commands past the top of the stack that can be redone.

getUndoCommand

public Command getUndoCommand()
This returns the command that will be undone if undo() is called.

getRedoCommand

public Command getRedoCommand()
This returns the command that will be redone if redo() is called.

getMostRecentCommand

public Command getMostRecentCommand()
This returns the command most recently executed, undone, or redone.

redo

public void redo()
This moves the top of the stack up, redoing the new top command.

flush

public void flush()
This will dispose all the commands in the stack.

addCommandStackListener

public void addCommandStackListener(CommandStackListener listener)
This adds a listener to the command stack, which will be notified whenever a command has been processed on the stack.

removeCommandStackListener

public void removeCommandStackListener(CommandStackListener listener)
This removes a previously added listener.

GEF v2.0