edu.wpi.ebob.actions
Class RemoveInstanceAction

java.lang.Object
  extended by org.eclipse.jface.action.Action
      extended by edu.wpi.ebob.actions.RemoveInstanceAction
All Implemented Interfaces:
org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelectionChangedListener

public class RemoveInstanceAction
extends org.eclipse.jface.action.Action
implements org.eclipse.jface.viewers.ISelectionChangedListener

Removes the instance currently selected in the Object Bench.

Author:
Liam Morley

Field Summary
private  org.eclipse.jface.resource.ImageDescriptor disabledImg
           
private  org.eclipse.jface.resource.ImageDescriptor enabledImg
           
private  Instance instance
           
private  org.eclipse.jface.viewers.ISelectionProvider provider
           
 
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
RemoveInstanceAction()
          Constructs new RemoveInstanceAction using the ObjBenchView's selection provider.
RemoveInstanceAction(Instance instance)
          Creates a new RemoveInstanceAction for the purpose of removing the specified instance.
RemoveInstanceAction(org.eclipse.jface.viewers.ISelectionProvider provider)
          Creates a new RemoveInstanceAction using the given selection provider.
 
Method Summary
 void dispose()
          Disposes this action by removing it as a listener from the selection provider.
private  void init()
          initializes this action.
 void run()
          Removes the selected instance from the bench.
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
           
 
Methods inherited from class org.eclipse.jface.action.Action
addPropertyChangeListener, convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, firePropertyChange, firePropertyChange, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabledImg

private final org.eclipse.jface.resource.ImageDescriptor enabledImg

disabledImg

private final org.eclipse.jface.resource.ImageDescriptor disabledImg

instance

private Instance instance

provider

private org.eclipse.jface.viewers.ISelectionProvider provider
Constructor Detail

RemoveInstanceAction

public RemoveInstanceAction()
Constructs new RemoveInstanceAction using the ObjBenchView's selection provider. The ObjBenchView MUST be on the workbench, or it won't be able to be retrieved; in this case, an IllegalStateException is thrown.

Throws:
java.lang.IllegalStateException - if ObjBenchViewcan't be retrieved

RemoveInstanceAction

public RemoveInstanceAction(org.eclipse.jface.viewers.ISelectionProvider provider)
Creates a new RemoveInstanceAction using the given selection provider.

Parameters:
provider - The selection provider that this instance will be registered with.

RemoveInstanceAction

public RemoveInstanceAction(Instance instance)
Creates a new RemoveInstanceAction for the purpose of removing the specified instance.

Parameters:
instance -
Method Detail

init

private void init()
initializes this action.


dispose

public void dispose()
Disposes this action by removing it as a listener from the selection provider. This must be called by the creator of the action when the action is no longer needed.


run

public void run()
Removes the selected instance from the bench.

Specified by:
run in interface org.eclipse.jface.action.IAction
Overrides:
run in class org.eclipse.jface.action.Action
See Also:
IAction.run()

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener
See Also:
ISelectionChangedListener.selectionChanged(SelectionChangedEvent)