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.
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.
Constructor and Description |
---|
CommonActionProvider() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
filterAction(IAction action)
Filters the specified action through the
WorkbenchActivityHelper . |
protected ICommonActionExtensionSite |
getActionSite() |
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 |
saveState(IMemento aMemento)
Save flags in aMemento to remember the state of any actions that persist
from session to session.
|
dispose, fillActionBars, fillContextMenu, getContext, setContext, updateActionBars
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.
aSite
- The configuration information for the instantiated Common
Action Provider.protected boolean filterAction(IAction action)
WorkbenchActivityHelper
.
This is used to determine if the IAction
should be included based
on the currently enabled activities.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.
restoreState
in interface IMementoAware
aMemento
- A memento that was given to the view part to restore its
state.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.
saveState
in interface IMementoAware
aMemento
- A memento that was given to the view part to save its state.protected final ICommonActionExtensionSite getActionSite()
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.