Eclipse Platform
Release 3.2

org.eclipse.ui.navigator
Class CommonActionProvider

java.lang.Object
  extended byorg.eclipse.ui.actions.ActionGroup
      extended byorg.eclipse.ui.navigator.CommonActionProvider
All Implemented Interfaces:
IMementoAware
Direct Known Subclasses:
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 Summary
CommonActionProvider()
           
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonActionProvider

public CommonActionProvider()
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.

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.

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.