Class CommonActionProvider

java.lang.Object
org.eclipse.ui.actions.ActionGroup
org.eclipse.ui.navigator.CommonActionProvider
All Implemented Interfaces:
IMementoAware
Direct Known Subclasses:
GoIntoActionProvider, SynchronizationActionProvider

public abstract class CommonActionProvider extends ActionGroup implements IMementoAware

Provides actions from extensions for menu and IActionBars contributions.

This abstract class should be extended by clients of the org.eclipse.ui.navigator.navigatorContent extension point for top-level and nested actionProvider elements.

CommonActionProviders may be declared as top-level elements in the extension point (e.g. an actionProvider element at the root of the extension point). Alternatively, actionProvider elements may be nested under a navigatorContent element, in which case they are considered to be "associated" with that content extension. For more information, see the org.eclipse.ui.navigator.navigatorContent extension point.

Each action provider will have the opportunity to contribute to the context menu when a user right clicks and also contribute to the IActionBars each time the selection changes. Clients should re-configure the IActionBars each time that ActionGroup.fillActionBars(IActionBars) is called (which is once per selection changes). ActionGroup.updateActionBars() will never be called from the NavigatorActionService. This behavior is required since each selection could determine a different set of retargetable actions. For instance, the "Delete" operation for a custom model element is likely to be different than for a resource.

Therefore, each extension will have an opportunity to contribute to the IActionBars based on the possibleChildren expression of the enclosing navigatorContent extension or the enablement expression of the actionProvider (for both top-level actionProviders and nested actionProviders which only support a subset of the enclosing content extensions possibleChildren expression).

Clients may extend this class.

Since:
3.2
  • Constructor Details

    • CommonActionProvider

      public CommonActionProvider()
  • Method Details

    • init

      public void init(ICommonActionExtensionSite aSite)

      Initialize the current ICommonActionProvider with the supplied information.

      init() is guaranteed to be called before any other method of the ActionGroup super class.

      Parameters:
      aSite - The configuration information for the instantiated Common Action Provider.
    • filterAction

      protected boolean filterAction(IAction action)
      Filters the specified action through the WorkbenchActivityHelper. This is used to determine if the IAction should be included based on the currently enabled activities.
      Returns:
      true, if the action is to be filtered (suppressed)
      Since:
      3.4
    • restoreState

      public void restoreState(IMemento aMemento)

      Restore the previous state of any actions using the flags in aMemento. This method allows the state of any actions that persist from session to session to be restored.

      The default behavior is to do nothing.

      Specified by:
      restoreState in interface IMementoAware
      Parameters:
      aMemento - A memento that was given to the view part to restore its state.
    • saveState

      public void saveState(IMemento aMemento)

      Save flags in aMemento to remember the state of any actions that persist from session to session.

      Extensions should qualify any keys stored in the memento with their plugin id

      The default behavior is to do nothing.

      Specified by:
      saveState in interface IMementoAware
      Parameters:
      aMemento - A memento that was given to the view part to save its state.
    • getActionSite

      protected final ICommonActionExtensionSite getActionSite()
      Returns:
      The cached reference to the action site. Will only be non-null if the subclass calls super.init() first.