Class CommonActionProvider
- All Implemented Interfaces:
IMementoAware
- Direct Known Subclasses:
GoIntoActionProvider
,SynchronizationActionProvider
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.
CommonActionProvider
s 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
filterAction
(IAction action) Filters the specified action through theWorkbenchActivityHelper
.protected final ICommonActionExtensionSite
void
init
(ICommonActionExtensionSite aSite) Initialize the current ICommonActionProvider with the supplied information.void
restoreState
(IMemento aMemento) Restore the previous state of any actions using the flags in aMemento.void
Save flags in aMemento to remember the state of any actions that persist from session to session.Methods inherited from class org.eclipse.ui.actions.ActionGroup
dispose, fillActionBars, fillContextMenu, getContext, setContext, updateActionBars
-
Constructor Details
-
CommonActionProvider
public CommonActionProvider()
-
-
Method Details
-
filterAction
Filters the specified action through theWorkbenchActivityHelper
. This is used to determine if theIAction
should be included based on the currently enabled activities.- Returns:
- true, if the action is to be filtered (suppressed)
- Since:
- 3.4
-
restoreState
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 interfaceIMementoAware
- Parameters:
aMemento
- A memento that was given to the view part to restore its state.
-
saveState
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 interfaceIMementoAware
- Parameters:
aMemento
- A memento that was given to the view part to save its state.
-
getActionSite
- Returns:
- The cached reference to the action site. Will only be non-null if the subclass calls super.init() first.