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.
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 theIActionBars
each time thatActionGroup.fillActionBars(IActionBars)
is called (which is once per selection changes).ActionGroup.updateActionBars()
will never be called from theNavigatorActionService
. 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
Constructors Constructor Description CommonActionProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
filterAction(IAction action)
Filters the specified action through theWorkbenchActivityHelper
.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.-
Methods inherited from class org.eclipse.ui.actions.ActionGroup
dispose, fillActionBars, fillContextMenu, getContext, setContext, updateActionBars
-
-
-
-
Method Detail
-
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 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
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 interfaceIMementoAware
- 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 interfaceIMementoAware
- 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.
-
-