Class CommonActions

java.lang.Object
com.iizigo.handler.CommonActions
All Implemented Interfaces:
Runnable, ISelectionChangedListener

public class CommonActions extends Object implements ISelectionChangedListener, Runnable
The Common Actions are Undo, Redo, Cut, Copy, Paste, Delete, Select All, Rename. This class is instantiated for parts requiring these actions in form of "global action bars" implementation.
Author:
Christopher Mindus
  • Field Details

  • Constructor Details

    • CommonActions

      public CommonActions(IWorkbenchPart part, Composite composite, IPropUndoRedo undoRedo, IUndoContext undoContext, ISelectionProvider selectionProvider, SelectionEnabler selectionEnabler, Runnable updateStatesRunnable, int flags)
      Constructor for a part. The part must be either a IViewPart or an IEditorPart, and it must implement a working selection provider.
      Parameters:
      part - The workbench part, can be null if no part is used.
      composite - The composite.
      undoRedo - The undo/redo instance.
      undoContext - The undo context.
      selectionProvider - The selection provider.
      selectionEnabler - A created SelectionEnabler, if null one will be created.
      updateStatesRunnable - Callback to update states, null for none.
      flags - Creation flags.
  • Method Details

    • dispose

      public void dispose()
      Disposes of the actions.
    • getSelectionEnabler

      public SelectionEnabler getSelectionEnabler()
      Gets the selection enabler instance.
    • selectionChanged

      public void selectionChanged(SelectionChangedEvent event)
      Notifies that the selection has changed.
      Specified by:
      selectionChanged in interface ISelectionChangedListener
      Parameters:
      event - Event object describing the change.
    • updateStates

      public void updateStates()
      Updates the states, call only at initialize of part, once everything is set-up. It is not required afterwards, the state is checked by itself using listeners.
    • get

      public IAction get(int index)
      Gets the action of index.
      Returns:
      null If not created.
    • run

      public void run()
      Callback from undo/redo.
      Specified by:
      run in interface Runnable