Class WWinPluginAction

All Implemented Interfaces:
EventListener, IAction, ISelectionChangedListener, IActionSetContributionItem, INullSelectionListener, IPluginContribution, ISelectionListener
Direct Known Subclasses:
WWinPluginPulldown

public class WWinPluginAction extends PluginAction implements IActionSetContributionItem
This class extends regular plugin action with the additional requirement that the delegate has to implement interface IWorkbenchWindowActionDelegate. This interface has one additional method (init) whose purpose is to initialize the delegate with the window in which the action is intended to run.
  • Constructor Details

    • WWinPluginAction

      public WWinPluginAction(IConfigurationElement actionElement, IWorkbenchWindow window, String id, int style)
      Constructs a new WWinPluginAction object.
      Parameters:
      actionElement - the configuration element
      window - the window to contribute to
      id - the identifier
      style - the style
  • Method Details

    • refreshActionList

      public static void refreshActionList()
      Creates any actions which belong to an activated plugin.
    • validateDelegate

      protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException
      Description copied from class: PluginAction
      Validates the object is a delegate of the expected type. Subclasses can override to check for specific delegate types.

      Note: Calls to the object are not allowed during this method.

      Overrides:
      validateDelegate in class PluginAction
      Parameters:
      obj - a possible action delegate implementation
      Returns:
      the IActionDelegate implementation for the object
      Throws:
      WorkbenchException - if not of the expected delegate type
    • initDelegate

      protected void initDelegate()
      Description copied from class: PluginAction
      Initialize the action delegate by calling its lifecycle method. Subclasses may override but must call this implementation first.
      Overrides:
      initDelegate in class PluginAction
    • dispose

      public void dispose()
      Disposes of the action and any resources held.
      Overrides:
      dispose in class PluginAction
    • getActionSetId

      public String getActionSetId()
      Returns the action set id.
      Specified by:
      getActionSetId in interface IActionSetContributionItem
    • isOkToCreateDelegate

      public boolean isOkToCreateDelegate()
      Returns true if the window has been set. The window may be null after the constructor is called and before the window is stored. We cannot create the delegate at that time.
      Overrides:
      isOkToCreateDelegate in class PluginAction
    • runWithEvent

      public void runWithEvent(Event event)
      Description copied from class: Action
      The default implementation of this IAction method ignores the event argument, and simply calls run(). Subclasses should override this method if they need information from the triggering event, or override run() if not.
      Specified by:
      runWithEvent in interface IAction
      Overrides:
      runWithEvent in class PluginAction
      Parameters:
      event - the SWT event which triggered this action being run
      See Also:
    • setActionSetId

      public void setActionSetId(String newActionSetId)
      Sets the action set id.
      Specified by:
      setActionSetId in interface IActionSetContributionItem
    • setHelpListener

      public void setHelpListener(HelpListener listener)
      The WWinPluginAction implementation of this method declared on IAction stores the help listener in a local field. The supplied listener is only used if there is no retarget action.
      Specified by:
      setHelpListener in interface IAction
      Overrides:
      setHelpListener in class Action
      Parameters:
      listener - a help listener for this action
    • setChecked

      public void setChecked(boolean checked)
      Description copied from interface: IAction
      Sets the checked status of this action. Applicable for the styles AS_CHECK_BOX or AS_RADIO_BUTTON.

      Fires a property change event for the CHECKED property if the checked status actually changes as a consequence.

      Specified by:
      setChecked in interface IAction
      Overrides:
      setChecked in class Action
      Parameters:
      checked - the new checked status
      See Also:
    • refreshSelection

      protected void refreshSelection()
      Refresh the selection for the action.
    • toString

      public String toString()
      Overrides:
      toString in class Object