Class PartAction

All Implemented Interfaces:
IAction
Direct Known Subclasses:
CollapseAllAction, CreateVSFieldAction, ExpandAllAction

public class PartAction extends Action
A part action is an action that is registered globally for the part in the action bars, but is retargeted for a group of controls. When a control inside a parent gets focus, that action is enabled.

This also serves as a replacement for Action if no parent composites are registered.

Author:
Christopher Mindus
  • Field Details

    • part

      protected final IDisposedPart part
      The workbench part.
    • isDisposed

      protected boolean isDisposed
      Flag for disposed.
  • Constructor Details

  • Method Details

    • with

      public PartAction with(Runnable r)
      Assigns a run method to execute instead of overriding the "run" method.
      Parameters:
      r - This actions new run() implementation, null to remove it.
      Returns:
      "this" instance for method concatenation.
    • setMenuItemTooltips

      public void setMenuItemTooltips(boolean on)
      Sets the flag indicating tooltip should be used for menu items as well. This call must be made prior to the action contributor creating the menu item.
      Parameters:
      on - The flag.
    • useMenuItemTooltips

      public boolean useMenuItemTooltips()
      Returns the flag indicating tooltip should be used for menu items as well.
      Returns:
      Default false, unless changed using {#setMenuItemTooltips(boolean)}.
    • add

      public void add(Composite parent, IAction action)
      Adds a new parent composite and its children
    • remove

      public void remove(Composite parent)
      Removes a parent composite from the action list.
    • dispose

      public void dispose()
      Disposes of the instance.
    • runWithEvent

      public final void runWithEvent(Event event)
      This method cannot be overridden, use the run() method instead.
      Specified by:
      runWithEvent in interface IAction
      Overrides:
      runWithEvent in class Action
      Parameters:
      event - The SWT event which triggered this action being run.
    • run

      public void run()
      The default implementation of this IAction method does nothing. Subclasses should override this method if they do not need information from the triggering event, or override runWithEvent(Event) if they do.
      Specified by:
      run in interface IAction
      Overrides:
      run in class Action