public final class NavigatorActionService extends ActionGroup implements IMementoAware
Provides context menu items and
IActionBars contributions for a particular abstract
viewer. The interface matches that of
ActionGroup and may be used in the same manner.
Clients must call
prepareMenuForPlatformContributions(MenuManager, ISelectionProvider, boolean)
when using this class to allow object or viewer contributions. The
org.eclipse.ui.navigator.viewer/viewer/popupMenu element may override whether platform
contributions are allowed to the menu with its allowsPlatformContributions attribute.
"Platform Contributions" are menu items that are added through the org.eclipse.ui.popupMenus
CommonActionProvider has opportunities to contribute to the context menu and
IActionBars whenever the selection in the viewer changes. Action Providers
are selected based on the enablement expressions of their associated content extension or their
own enablement expression if it is declared as a top-level <actionProvider /> element (of
the org.eclipse.ui.navigator.navigatorContent extension point). See the schema
documentation of org.eclipse.ui.navigator.navigatorContent for more information on how to
specify an Action Provider.
Clients that reuse this service outside of an instance of
CommonNavigator must be sure
fillActionBars(IActionBars) is called whenever the selection changes. The
retargetable actions for each selection could change, based on who contributed the items.
|Constructor and Description|
|Modifier and Type||Method and Description|
Dispose of any state or resources held by the service.
Request that the service invoke extensions to fill the given IActionBars with retargetable actions or view menu contributions from Action Providers that are interested in the given selection.
Requests that the service invoke extensions to fill the given menu with Action Providers that are interested in elements from the given selection.
Prepares the menu for object contributions, if the option is set in the extension.
Use the given memento to restore the state of each Action Provider as it is initialized.
Request that Action Providers save any state that they find interesting.
getContext, setContext, updateActionBars
public NavigatorActionService(ICommonViewerSite aCommonViewerSite, StructuredViewer aStructuredViewer, INavigatorContentService aContentService)
aCommonViewerSite- A site that provides information about the context for extensions.
aStructuredViewer- The associated StructuredViewer. Used to initialize extensions. May NOT be null.
aContentService- The associated INavigatorContentService (for extensions that coordinate behavior with content extensions -- either nested or top-level action providers). May NOT be null.
public void prepareMenuForPlatformContributions(MenuManager menu, ISelectionProvider aSelectionProvider, boolean force)
menu- The context menu of the IViewPart
aSelectionProvider- The selection provider that will supplement actions with a valid, current selection.
force- A value of 'true' forces the menu to be registered for object/view contributions. Otherwise, the option from the extension point will be respected. See org.eclipse.ui.navigator.viewer/viewer for more information.
public void fillContextMenu(IMenuManager aMenu)
Object contributions (see org.eclipes.ui.popupMenus) may also respected by this
toRespectObjectContributions is true.
public void fillActionBars(IActionBars theActionBars)
public void dispose()
public void restoreState(IMemento aMemento)
public void saveState(IMemento aMemento)
public CommonActionProvider getActionProviderInstance(org.eclipse.ui.internal.navigator.actions.CommonActionProviderDescriptor aProviderDescriptor)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.