Class CommonHandler

All Implemented Interfaces:
IHandler, IHandler2
Direct Known Subclasses:
Copy, Cut, Delete, Link, Move, Open, Paste, PasteAfter, PasteBefore, PasteLink, Rename

public abstract class CommonHandler extends AbstractHandler
The common handler check for valid handled state and enabled state for the common action handlers.
Author:
Christopher Mindus
  • Field Details

    • selectionEnabler

      protected SelectionEnabler selectionEnabler
      The current selection enabler.
  • Constructor Details

    • CommonHandler

      public CommonHandler()
  • Method Details

    • setEnabled

      public final void setEnabled(Object evaluationContext)
      Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time.
      Specified by:
      setEnabled in interface IHandler2
      Overrides:
      setEnabled in class AbstractHandler
      Parameters:
      evaluationContext - The application context. May be null.
    • isHandled

      public boolean isHandled()
      Whether this handler is capable of handling delegated responsibilities at this time. Subclasses may override this method.
      Specified by:
      isHandled in interface IHandler
      Overrides:
      isHandled in class AbstractHandler
      Returns:
      true
    • getCurrentSelection

      protected IStructuredSelection getCurrentSelection()
      Gets the current selection.
    • setEnabled

      protected abstract void setEnabled(SelectionEnabler se)
      Sets the enabled state for the selection.
    • execute

      public final Object execute(ExecutionEvent event)
      Performs the operation.
    • doExecute

      protected abstract void doExecute()
      Performs the operation.
    • getUndoRedo

      protected IPropUndoRedo getUndoRedo()
      Gets the IPropUndoRedo for an event.
    • getShell

      protected Shell getShell()
      Gets the shell.
    • getUndoContext

      public static IUndoContext getUndoContext(IWorkbenchPart part)
      Gets the undo context out of a part.
    • getUpdateStatesRunnable

      protected Runnable getUpdateStatesRunnable()
      Gets the asynchronous update states runnable.