Class PartAction

  • All Implemented Interfaces:
    org.eclipse.jface.action.IAction
    Direct Known Subclasses:
    CollapseAllAction, CreateVSFieldAction, ExpandAllAction

    public class PartAction
    extends org.eclipse.jface.action.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 Summary

      • 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

      Constructors 
      ConstructorDescription
      PartAction​(java.lang.String text)
      Creates the part action.
      PartAction​(java.lang.String text, int style)
      Creates the part action.
      PartAction​(java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image)
      Creates the part action.
      PartAction​(java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image, int style)
      Creates the part action.
      PartAction​(java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image, org.eclipse.jface.resource.ImageDescriptor disabledImage)
      Creates the part action.
      PartAction​(java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image, org.eclipse.jface.resource.ImageDescriptor disabledImage, int style)
      Creates the part action.
      PartAction​(java.lang.String text, org.eclipse.jface.resource.ImageDescriptor image)
      Creates the part action.
      PartAction​(java.lang.String text, org.eclipse.jface.resource.ImageDescriptor image, int style)
      Creates the part action.
      PartAction​(org.eclipse.ui.IWorkbenchPart part, java.lang.String id)
      Creates the part action.
      PartAction​(org.eclipse.ui.IWorkbenchPart extension, java.lang.String id, java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image)
      Creates the part action.
      PartAction​(org.eclipse.ui.IWorkbenchPart part, java.lang.String id, java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image, org.eclipse.jface.resource.ImageDescriptor disabledImage)
      Creates the part action.
      PartAction​(org.eclipse.ui.IWorkbenchPart part, java.lang.String id, java.lang.String text, java.lang.String tooltip, org.eclipse.jface.resource.ImageDescriptor image, org.eclipse.jface.resource.ImageDescriptor disabledImage, int style)
      Creates the part action.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidadd​(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.action.IAction action)
      Adds a new parent composite and its children
      voiddispose()
      Disposes of the instance.
      voidrefreshChildren​(org.eclipse.swt.widgets.Composite parent)
      Refreshes the children for a parent.
      voidremove​(org.eclipse.swt.widgets.Composite parent)
      Removes a parent composite from the action list.
      voidrun()
      The default implementation of this IAction method does nothing.
      voidrunWithEvent​(org.eclipse.swt.widgets.Event event)
      This method cannot be overridden, use the run() method instead.
      voidsetMenuItemTooltips​(boolean on)
      Sets the flag indicating tooltip should be used for menu items as well.
      booleanuseMenuItemTooltips()
      Returns the flag indicating tooltip should be used for menu items as well.
      • Methods inherited from class org.eclipse.jface.action.Action

        convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
      • Methods inherited from class org.eclipse.jface.action.AbstractAction

        addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
      • Methods inherited from class org.eclipse.core.commands.common.EventManager

        addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PartAction

        public PartAction​(org.eclipse.ui.IWorkbenchPart part,
                          java.lang.String id)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          org.eclipse.jface.resource.ImageDescriptor image)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          int style)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          int style)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          int style)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          org.eclipse.jface.resource.ImageDescriptor disabledImage)
        Creates the part action.
      • PartAction

        public PartAction​(java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          org.eclipse.jface.resource.ImageDescriptor disabledImage,
                          int style)
        Creates the part action.
      • PartAction

        public PartAction​(org.eclipse.ui.IWorkbenchPart extension,
                          java.lang.String id,
                          java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image)
        Creates the part action.
      • PartAction

        public PartAction​(org.eclipse.ui.IWorkbenchPart part,
                          java.lang.String id,
                          java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          org.eclipse.jface.resource.ImageDescriptor disabledImage)
        Creates the part action.
      • PartAction

        public PartAction​(org.eclipse.ui.IWorkbenchPart part,
                          java.lang.String id,
                          java.lang.String text,
                          java.lang.String tooltip,
                          org.eclipse.jface.resource.ImageDescriptor image,
                          org.eclipse.jface.resource.ImageDescriptor disabledImage,
                          int style)
        Creates the part action.
    • Method Detail

      • 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​(org.eclipse.swt.widgets.Composite parent,
                        org.eclipse.jface.action.IAction action)
        Adds a new parent composite and its children
      • refreshChildren

        public void refreshChildren​(org.eclipse.swt.widgets.Composite parent)
        Refreshes the children for a parent.
      • remove

        public void remove​(org.eclipse.swt.widgets.Composite parent)
        Removes a parent composite from the action list.
      • dispose

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

        public final void runWithEvent​(org.eclipse.swt.widgets.Event event)
        This method cannot be overridden, use the run() method instead.
        Specified by:
        runWithEvent in interface org.eclipse.jface.action.IAction
        Overrides:
        runWithEvent in class org.eclipse.jface.action.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 org.eclipse.jface.action.IAction
        Overrides:
        run in class org.eclipse.jface.action.Action