uk.ac.kcl.cch.jb.pliny.actions
Class CommandStackUndoAction

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended byuk.ac.kcl.cch.jb.pliny.actions.CommandStackUndoAction
All Implemented Interfaces:
org.eclipse.gef.commands.CommandStackListener, org.eclipse.jface.action.IAction

public class CommandStackUndoAction
extends org.eclipse.jface.action.Action
implements org.eclipse.gef.commands.CommandStackListener

This class provides some basic actions that can be used by Pliny Workbench parts that use the CommandStack to handle Undo operations.

Author:
John Bradley

Field Summary
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
CommandStackUndoAction(org.eclipse.gef.commands.CommandStack commandStack)
          takes the given CommandStack as the one against which the Undo is to be done.
 
Method Summary
 void commandStackChanged(EventObject event)
          called when commandstack changes.
 void dispose()
          disposes this item.
 void run()
          performs the CommandStack undo.
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

CommandStackUndoAction

public CommandStackUndoAction(org.eclipse.gef.commands.CommandStack commandStack)
takes the given CommandStack as the one against which the Undo is to be done. This object must be disposed when you are finished with it since it is a CommandStackListener.

Parameters:
commandStack - the CommandStack to use.
Method Detail

dispose

public void dispose()
disposes this item. Releases the commandStackListener connection.


run

public void run()
performs the CommandStack undo.

Specified by:
run in interface org.eclipse.jface.action.IAction

commandStackChanged

public void commandStackChanged(EventObject event)
called when commandstack changes. This is the listener interface method. Here it enables the action as an undo is there are any commands in the stack that can be undone.

Specified by:
commandStackChanged in interface org.eclipse.gef.commands.CommandStackListener
Parameters:
event - the commandStack changing event