|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.common.core.service.AbstractProvider
org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider
public abstract class AbstractContributionItemProvider
An abstract implementation of the IContributionItemProvider interface This provider performs the contribution by reading its XML contribution descriptor and parsing it in the correct format.
Contribution item providers wishing "not" to read an XML-based descriptor
but rather performs the contribution totally programatically should not
subclass this class but rather implement the IContributionItemProvider
interface directly.
Constructor Summary | |
---|---|
AbstractContributionItemProvider()
|
Method Summary | |
---|---|
void |
contributeToActionBars(IActionBars actionBars,
IWorkbenchPartDescriptor partDescriptor)
Contributes to the given action bars that belong to a part described with the given part descriptor. |
void |
contributeToPopupMenu(IMenuManager popupMenu,
IWorkbenchPart workbenchPart)
Contributes to the given popup menu of the given part The popup menu id has to match the id used to register this menu with the part's site. |
protected IAction |
createAction(java.lang.String actionId,
IWorkbenchPartDescriptor partDescriptor)
Creates the action with the given id. |
protected ActionGroup |
createActionGroup(java.lang.String actionGroupId,
IWorkbenchPartDescriptor partDescriptor)
Creates the action group for the given id. |
protected IContributionItem |
createCustomContributionItem(java.lang.String customId,
IWorkbenchPartDescriptor partDescriptor)
Creates the custom contribution with the given id. |
protected IMenuManager |
createMenuManager(java.lang.String menuId,
IWorkbenchPartDescriptor partDescriptor)
Creates the menu manager with the given id. |
void |
disposeContributions(IWorkbenchPartDescriptor partDescriptor)
Gives the provider a chance to clean up and dispose any cached contributions previously targeted at a part described by the given descriptor. |
protected IAction |
getAction(java.lang.String actionId,
IWorkbenchPartDescriptor partDescriptor)
Returns the action with the given id that is created for the given part id. |
protected IAction |
getAction(java.lang.String actionId,
IWorkbenchPartDescriptor partDescriptor,
IPartSelector partSelector)
Returns the action with the given id that is created for the given part id. |
protected IAction |
getActionFromRegistry(java.lang.String actionId,
IWorkbenchPartDescriptor partDescriptor,
ActionRegistry registry)
This method put in order to override the action registry caching. |
protected ActionGroup |
getActionGroup(java.lang.String actionGroupId,
IWorkbenchPartDescriptor partDescriptor)
Returns the ActionGroup with the given id that is created for the given part id An ActionGroup is created once and cached for each unique part's id |
protected java.lang.Object |
getSelectedObject(IWorkbenchPartDescriptor partDescriptor)
Gets the first object in the selection in the workbench part described by partDescriptor . |
protected IStructuredSelection |
getStructuredSelection(IWorkbenchPartDescriptor partDescriptor)
Gets the structured selection from the workbench part described by partDescriptor . |
boolean |
provides(IOperation operation)
Indicates whether this provider provides the specified operation. |
void |
setContributionDescriptor(org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.ProviderContributionDescriptor descriptor)
Sets the contribution descriptor of the provider. |
void |
updateActionBars(IActionBars actionBars,
IWorkbenchPartDescriptor partDescriptor)
Contributes to the given action bars that belong to a part described with the given part descriptor ONLY IF this provider has not already contributed to this part. |
Methods inherited from class org.eclipse.gmf.runtime.common.core.service.AbstractProvider |
---|
addProviderChangeListener, fireProviderChange, removeProviderChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider |
---|
addProviderChangeListener, removeProviderChangeListener |
Constructor Detail |
---|
public AbstractContributionItemProvider()
Method Detail |
---|
protected IStructuredSelection getStructuredSelection(IWorkbenchPartDescriptor partDescriptor)
partDescriptor
.
partDescriptor
- the part descriptor
protected java.lang.Object getSelectedObject(IWorkbenchPartDescriptor partDescriptor)
partDescriptor
.
partDescriptor
- the part descriptor
public final void setContributionDescriptor(org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.ProviderContributionDescriptor descriptor)
org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionDescriptorReader
setContributionDescriptor
in interface org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionDescriptorReader
descriptor
- the contribution descriptor of the providerpublic final void contributeToActionBars(IActionBars actionBars, IWorkbenchPartDescriptor partDescriptor)
org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
This API is usually called from the init()
method
of a EditorActionBarContributor
class for editors
and from init()
method of IViewPart
implementation for views.
contributeToActionBars
in interface org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
actionBars
- The target action barspartDescriptor
- The context workbench part descriptorpublic final void updateActionBars(IActionBars actionBars, IWorkbenchPartDescriptor partDescriptor)
org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
This API is usually called when an event takes place such that new providers may now provide contributions to the actionbars. Only those new providers need to add their contributions.
updateActionBars
in interface org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
actionBars
- The target action barspartDescriptor
- The context workbench part descriptorpublic final void contributeToPopupMenu(IMenuManager popupMenu, IWorkbenchPart workbenchPart)
org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
This API is usually called from menuAboutToShow()
method
of the main IMenuListener
to a given context menu.
contributeToPopupMenu
in interface org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
popupMenu
- The target popup menu managerworkbenchPart
- The context workbench partpublic final void disposeContributions(IWorkbenchPartDescriptor partDescriptor)
org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
This API is usually called when the part contributor is disposing. This
would be form the dispose
method of the
EditorActioBarContributor
for editors and the dispose
method of IViewPart
for views.
disposeContributions
in interface org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider
partDescriptor
- The context workbench part descriptorpublic final boolean provides(IOperation operation)
IProvider
Providers generally cast the operation to a service specific
IOperation
-derived class in order to determine whether they
support the request.
provides
in interface IProvider
operation
- The operation in question.
true
if this provider provides the operation;
false
otherwise.protected final IAction getAction(java.lang.String actionId, IWorkbenchPartDescriptor partDescriptor)
actionId
- The request action idpartDescriptor
- The workbench part descriptor
protected final IAction getAction(java.lang.String actionId, IWorkbenchPartDescriptor partDescriptor, IPartSelector partSelector)
The part selector is used is when the new action is an
AbstractActionHandler
to determine whether or not the
action is applicable to a given selected part. If the part is not
applicable, the action will not be refreshed when selection changes in
the part.
actionId
- The request action idpartDescriptor
- The workbench part descriptorpartSelector
- The part selector
protected final ActionGroup getActionGroup(java.lang.String actionGroupId, IWorkbenchPartDescriptor partDescriptor)
actionGroupId
- The request action group idpartDescriptor
- The workbench part descriptor
protected IAction getActionFromRegistry(java.lang.String actionId, IWorkbenchPartDescriptor partDescriptor, ActionRegistry registry)
actionId
- the action idpartDescriptor
- the part descriptorregistry
- the action registry
actionId
retrieved from the action
registry
.protected IAction createAction(java.lang.String actionId, IWorkbenchPartDescriptor partDescriptor)
actionId
- The action idpartDescriptor
- The workbench part descriptor
protected ActionGroup createActionGroup(java.lang.String actionGroupId, IWorkbenchPartDescriptor partDescriptor)
actionGroupId
- The action group idpartDescriptor
- The workbench part descriptor
protected IMenuManager createMenuManager(java.lang.String menuId, IWorkbenchPartDescriptor partDescriptor)
menuId
- The menu manager idpartDescriptor
- The workbench part descriptor
protected IContributionItem createCustomContributionItem(java.lang.String customId, IWorkbenchPartDescriptor partDescriptor)
customId
- The custom contribution idpartDescriptor
- The workbench part descriptor
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.