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 Link icon

    • part Link icon

      protected final IDisposedPart part
      The workbench part.
    • isDisposed Link icon

      protected boolean isDisposed
      Flag for disposed.
  • Constructor Details Link icon

  • Method Details Link icon

    • with Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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

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

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

      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 Link icon

      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