public class BasicActionProvider
extends org.eclipse.ui.navigator.CommonActionProvider
Initialization is ensured by the method init(ICommonActionExtensionSite) that is not supposed to overridden by client implementations (override doInit() instead).
Filling and emptying contextual menu (maintained by manager) with actions are respectively supported by populateManager(IContributionManager, Collection, String) and depopulateManager(IContributionManager, Collection).
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.jface.viewers.ISelectionProvider |
selectionProvider |
protected org.eclipse.jface.viewers.Viewer |
viewer |
protected java.lang.String |
viewerId |
protected org.eclipse.ui.IWorkbenchPart |
workbenchPart |
Constructor and Description |
---|
BasicActionProvider() |
Modifier and Type | Method and Description |
---|---|
protected org.eclipse.jface.action.IMenuManager |
addSubMenu(org.eclipse.jface.action.IMenuManager contextMenuManager)
Returns the
sub menu into which the actions
provided by this action provider implementation are to be placed. |
protected void |
depopulateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Collection<? extends org.eclipse.jface.action.IAction> actions)
Removes from the specified
manager all
contribution items based on the
actions contained in the actions collection. |
protected void |
depopulateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions)
This removes from the specified
manager all MenuManager s and their
ActionContributionItem s based on the IAction s
contained in the submenuActions map. |
protected void |
doInit()
Method to override in order to provide a custom initialization of this action
provider.
|
protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> |
extractSubmenuActions(java.util.Collection<org.eclipse.jface.action.IAction> createActions,
org.eclipse.jface.viewers.ISelection selection)
This extracts those actions in the
submenuActions collection whose text is qualified and returns a
map of these actions, keyed by submenu text (see GenModel option "Editor > Creation Sub-menus" for details). |
void |
fillContextMenu(org.eclipse.jface.action.IMenuManager contextMenuManager) |
protected void |
fillSubMenu(org.eclipse.jface.action.IMenuManager subMenuManager)
Adds the applicable actions to the
sub menu of
the context menu resulting from previous invocation of addSubMenu(IMenuManager) . |
protected org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomainFromSelection(org.eclipse.jface.viewers.ISelection selection)
A convenience method to get the editing domain from an
ISelection . |
void |
init(org.eclipse.ui.navigator.ICommonActionExtensionSite site) |
protected boolean |
isActivePropertySheet()
Returns true when the property sheet is the current active page.
|
protected boolean |
isTransient(java.lang.Object object)
Returns true if the given object is a transient item provider i.e.
|
protected void |
populateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Collection<? extends org.eclipse.jface.action.IAction> actions,
java.lang.String contributionId)
Populates the specified
manager with
contribution items based on the
actions contained in the actions collection, by
inserting them before the specified contribution item contributionId .If contributionId is null , they are simply added. |
protected void |
populateManager(org.eclipse.jface.action.IContributionManager manager,
java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions,
java.lang.String contributionId)
This populates the specified
manager with MenuManager s containing
ActionContributionItem s based on the IAction s
contained in the submenuActions collection, by inserting them before the specified contribution item
contributionId . |
filterAction, getActionSite, restoreState, saveState
protected org.eclipse.ui.IWorkbenchPart workbenchPart
protected org.eclipse.jface.viewers.Viewer viewer
protected java.lang.String viewerId
protected org.eclipse.jface.viewers.ISelectionProvider selectionProvider
public final void init(org.eclipse.ui.navigator.ICommonActionExtensionSite site)
init
in class org.eclipse.ui.navigator.CommonActionProvider
public void fillContextMenu(org.eclipse.jface.action.IMenuManager contextMenuManager)
fillContextMenu
in class org.eclipse.ui.actions.ActionGroup
protected void doInit()
protected boolean isActivePropertySheet()
protected org.eclipse.jface.action.IMenuManager addSubMenu(org.eclipse.jface.action.IMenuManager contextMenuManager)
sub menu
into which the actions
provided by this action provider
implementation are to be placed. Creates a new
sub menu
and appends it to specified context menu
if no such is present
yet. Returns null
if the actions should go directly
into the context menu
. The default implementation returns null
. Subclasses may
override or extend this method.contextMenuManager
- The context menu
for which the sub menu
is to be retrieved
or created.sub menu
into which the actions
provided by this action provider
implementation are to be placed or
null
if they should go directly into the context menu
.fillSubMenu(IMenuManager)
protected void fillSubMenu(org.eclipse.jface.action.IMenuManager subMenuManager)
sub menu
of
the context menu
resulting from previous invocation of addSubMenu(IMenuManager)
.
The default implementation does nothing. Subclasses may override or extend this method.subMenu
- The sub menu
to which applicable actions are to be added.addSubMenu(IMenuManager)
protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomainFromSelection(org.eclipse.jface.viewers.ISelection selection)
ISelection
. This method will return null in
different cases :
IStructuredSelection
.
selection
- protected void populateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Collection<? extends org.eclipse.jface.action.IAction> actions, java.lang.String contributionId)
manager
with
contribution items based on the
actions contained in the actions
collection, by
inserting them before the specified contribution item contributionId
.contributionId
is null
, they are simply added.manager
- The contribution manager to which specified actions must be populated.actions
- The actions to insert in the menu described by the given
manager
.contributionId
- The identifier of the contribution before which actions must be inserted.protected void populateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions, java.lang.String contributionId)
manager
with MenuManager
s containing
ActionContributionItem
s based on the IAction
s
contained in the submenuActions
collection, by inserting them before the specified contribution item
contributionId
. If contributionId
is null
, they are simply added.manager
- The contribution manager to which specified actions must be populated.submenuActions
- The submenu actionss to insert in the menu described by the given
manager
.contributionId
- The identifier of the contribution before which actions must be inserted.protected void depopulateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Collection<? extends org.eclipse.jface.action.IAction> actions)
manager
all
contribution items based on the
actions contained in the actions
collection.manager
- The contribution manager from which specified actions must be removed.actions
- The actions to remove from the menu described by the given
manager
.protected void depopulateManager(org.eclipse.jface.action.IContributionManager manager, java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> submenuActions)
manager
all MenuManager
s and their
ActionContributionItem
s based on the IAction
s
contained in the submenuActions
map.manager
- The contribution manager from which specified actions must be removed.submenuActions
- The submenu actionss to remove from the menu described by the given
manager
.protected java.util.Map<java.lang.String,java.util.Collection<org.eclipse.jface.action.IAction>> extractSubmenuActions(java.util.Collection<org.eclipse.jface.action.IAction> createActions, org.eclipse.jface.viewers.ISelection selection)
submenuActions
collection whose text is qualified and returns a
map of these actions, keyed by submenu text (see GenModel option "Editor > Creation Sub-menus" for details).protected boolean isTransient(java.lang.Object object)
object
- an object.