public abstract class SynchronizePageActionGroup extends ActionGroup
ISynchronizePage
. An action group is added to a synchronize
page by adding the group to the ISynchronizePageConfiguration
after
configuration has been created by the page but before the page is created.
The life cycle of an action group is:
initialize(ISynchronizePageConfiguration}
method is
invoked before the methods to populate menus. This is done to give clients
a change to create and initialize the actions of the action group.
fillActionBars(IActionBars)
method is invoked
to populate the page's action bars (view menu and toolbar). It is
possible for the action bars to be missing one or more components
so clients are expected to check for null
when accessing
the menus from the action bars.
fillContextMenu(IMenuManager)
method is invoked each time
the context menu is shown. Before this method is called, the
action group will be provided with an ActionContext
containing the view selection. Clients can access the context using
getContext()
.
updateActionBars()
method is invoked whenever the
page's selection changes. Before this method is called, the
action group will be provided with an ActionContext
containing the view selection. Clients can access the context using
getContext()
.
modelChanged(ISynchronizeModelElement)
method is
invoked whenever the model being displayed is changed. This gives clients
a chance to adjust the input to actions that operate on all visible elements.
dispose()
method is called when the page is disposed.
Constructor and Description |
---|
SynchronizePageActionGroup() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
appendToGroup(IContributionManager manager,
String groupId,
IAction action)
Helper method to add an action to a group in a menu.
|
protected boolean |
appendToGroup(IContributionManager manager,
String groupId,
IContributionItem item)
Helper method to add a contribution item to a group in a menu.
|
protected void |
appendToGroup(String menuId,
String groupId,
IAction action)
Helper method that can be invoked during initialization to add an action
to a particular menu (one of P_TOOLBAR_MENU, P_VIEW_MENU, P_CONTEXT_MENU
from ISynchronizePageConfiguration).
|
protected void |
appendToGroup(String menuId,
String groupId,
IContributionItem item)
Helper method that can be invoked during initialization to add an item to
a particular menu (one of P_TOOLBAR_MENU, P_VIEW_MENU, P_CONTEXT_MENU
from ISynchronizePageConfiguration).
|
void |
dispose()
Dispose of the action group.
|
void |
fillActionBars(IActionBars actionBars)
Adds the applicable actions to a part's action bars,
including setting any global action handlers.
|
void |
fillContextMenu(IMenuManager menu)
Adds the applicable actions to a context menu,
based on the state of the
ActionContext . |
protected IContributionItem |
findGroup(IContributionManager menu,
String groupId)
Helper method to find the group of the given id for the page associated
with the configuration of this action group.
|
ISynchronizePageConfiguration |
getConfiguration()
Return the configuration for the page to which the action group
is associated.
|
protected ISelectionProvider |
getVisibleRootsSelectionProvider()
Return a selection provider whose selection includes all roots of the
elements visible in the page.
|
void |
initialize(ISynchronizePageConfiguration configuration)
Initialize the actions of this contribution.
|
void |
modelChanged(ISynchronizeModelElement root)
This method is invoked whenever the model being displayed in the view
changes.
|
getContext, setContext, updateActionBars
public void initialize(ISynchronizePageConfiguration configuration)
filleContextMenu
or
setActionBars
but after the control for the page has been
created. As a result of this, the site of the configuration can be
accessed. Subclasses may override this method but must invoke the
overridden method.configuration
- the configuration for the part to which the
contribution is associatedpublic void modelChanged(ISynchronizeModelElement root)
root
- the root of the model being viewedpublic void dispose()
dispose
in class ActionGroup
protected IContributionItem findGroup(IContributionManager menu, String groupId)
menu
- the menugroupId
- the id of the group being searched fornull
protected boolean appendToGroup(IContributionManager manager, String groupId, IAction action)
null
.manager
- the menu managergroupId
- the group to append the action toaction
- the action to addtrue
if the group exists and the action was added
and false
if the action was not addedprotected boolean appendToGroup(IContributionManager manager, String groupId, IContributionItem item)
null
.manager
- the menu managergroupId
- the group to append the action toitem
- the item to addtrue
if the group exists and the action was added
and false
if the action was not addedprotected void appendToGroup(String menuId, String groupId, IAction action)
menuId
- the menu id (one of P_TOOLBAR_MENU, P_VIEW_MENU,
P_CONTEXT_MENU from ISynchronizePageConfiguration)groupId
- the group id in the menu to which the action is to be
addedaction
- the action to be addedprotected void appendToGroup(String menuId, String groupId, IContributionItem item)
menuId
- the menu id (one of P_TOOLBAR_MENU, P_VIEW_MENU,
P_CONTEXT_MENU from ISynchronizePageConfiguration)groupId
- the group id in the menu to which the item is to be addeditem
- the item to be addedprotected ISelectionProvider getVisibleRootsSelectionProvider()
public void fillContextMenu(IMenuManager menu)
ActionGroup
ActionContext
.
The default implementation does nothing. Subclasses may override or extend this method.
fillContextMenu
in class ActionGroup
menu
- the context menu managerpublic void fillActionBars(IActionBars actionBars)
ActionGroup
The default implementation does nothing. Subclasses may override or extend this method.
fillActionBars
in class ActionGroup
actionBars
- the part's action barspublic ISynchronizePageConfiguration getConfiguration()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.