Runtime

## org.eclipse.gmf.runtime.common.ui.services.action.contributionitem
Class AbstractContributionItemProvider

    java.lang.Object
      org.eclipse.gmf.runtime.common.core.service.AbstractProvider
          org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider

All Implemented Interfaces:
  IProvider, org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionDescriptorReader, org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider

Direct Known Subclasses:
  DiagramContributionItemProvider

    public abstract class AbstractContributionItemProvider

extends AbstractProvider
implements org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider, org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionDescriptorReader

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, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)`
`void` `contributeToPopupMenu(IMenuManager popupMenu, IWorkbenchPart workbenchPart)`
`protected IAction` `createAction(java.lang.String actionId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Creates the action with the given id.
`protected ActionGroup` `createActionGroup(java.lang.String actionGroupId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Creates the action group for the given id.
`protected IContributionItem` `createCustomContributionItem(java.lang.String customId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Creates the custom contribution with the given id.
`protected IMenuManager` `createMenuManager(java.lang.String menuId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Creates the menu manager with the given id.
`void` `disposeContributions(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)`
`protected IAction` `getAction(java.lang.String actionId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Returns the action with the given id that is created for the given part id.
`protected IAction` `getAction(java.lang.String actionId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor, org.eclipse.gmf.runtime.common.ui.util.IPartSelector partSelector)` Returns the action with the given id that is created for the given part id.
`protected IAction` `getActionFromRegistry(java.lang.String actionId, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor, ActionRegistry registry)` This method put in order to override the action registry caching.
`protected ActionGroup` `getActionGroup(java.lang.String actionGroupId, org.eclipse.gmf.runtime.common.ui.util.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(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)` Gets the first object in the selection in the workbench part described by `partDescriptor`.
`protected IStructuredSelection` `getStructuredSelection(org.eclipse.gmf.runtime.common.ui.util.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)`
`void` `updateActionBars(IActionBars actionBars, org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)`

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

### AbstractContributionItemProvider

    public AbstractContributionItemProvider()

Method Detail

### getStructuredSelection

    protected IStructuredSelection getStructuredSelection(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Gets the structured selection from the workbench part described by `partDescriptor`.

  Parameters:
    `partDescriptor` - the part descriptor
  Returns:
    the structured selection

### getSelectedObject

    protected java.lang.Object getSelectedObject(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Gets the first object in the selection in the workbench part described by `partDescriptor`.

  Parameters:
    `partDescriptor` - the part descriptor
  Returns:
    the first object in the selection

### setContributionDescriptor

    public final void setContributionDescriptor(org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.ProviderContributionDescriptor descriptor)

  Specified by:
    `setContributionDescriptor` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionDescriptorReader`

### contributeToActionBars

    public final void contributeToActionBars(IActionBars actionBars,
                                             org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Specified by:
    `contributeToActionBars` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`

### updateActionBars

    public final void updateActionBars(IActionBars actionBars,
                                       org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Specified by:
    `updateActionBars` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`

### contributeToPopupMenu

    public final void contributeToPopupMenu(IMenuManager popupMenu,
                                            IWorkbenchPart workbenchPart)

  Specified by:
    `contributeToPopupMenu` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`

### disposeContributions

    public final void disposeContributions(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Specified by:
    `disposeContributions` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`

### provides

    public final boolean provides(IOperation operation)

  Description copied from interface: `IProvider`
  Indicates whether this provider provides the specified operation.

  Providers generally cast the operation to a service specific `IOperation`-derived class in order to determine whether they support the request.

  Specified by:
    `provides` in interface `IProvider`
  Parameters:
    `operation` - The operation in question.
  Returns:
    `true` if this provider provides the operation; `false` otherwise.

### getAction

    protected final IAction getAction(java.lang.String actionId,
                                      org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Returns the action with the given id that is created for the given part id. An action is created once and cached for each unique part's id.

  Parameters:
    `actionId` - The request action id
    `partDescriptor` - The workbench part descriptor
  Returns:
    The action with the given id

### getAction

    protected final IAction getAction(java.lang.String actionId,
                                      org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor,
                                      org.eclipse.gmf.runtime.common.ui.util.IPartSelector partSelector)

  Returns the action with the given id that is created for the given part id. An action is created once and cached for each unique part's id.

  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.

  Parameters:
    `actionId` - The request action id
    `partDescriptor` - The workbench part descriptor
    `partSelector` - The part selector
  Returns:
    The action with the given id

### getActionGroup

    protected final ActionGroup getActionGroup(java.lang.String actionGroupId,
                                               org.eclipse.gmf.runtime.common.ui.util.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

  Parameters:
    `actionGroupId` - The request action group id
    `partDescriptor` - The workbench part descriptor
  Returns:
    The ActionGroup with the given id

### getActionFromRegistry

    protected IAction getActionFromRegistry(java.lang.String actionId,
                                            org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor,
                                            ActionRegistry registry)

  This method put in order to override the action registry caching. Used to get around unimplemented features of contribution item service.

  Parameters:
    `actionId` - the action id
    `partDescriptor` - the part descriptor
    `registry` - the action registry
  Returns:
    the action with `actionId` retrieved from the action `registry`.

### createAction

    protected IAction createAction(java.lang.String actionId,
                                   org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Creates the action with the given id. By default, this method does nothing. Subclasses must override to provide their own implementation of action creation.

  Parameters:
    `actionId` - The action id
    `partDescriptor` - The workbench part descriptor
  Returns:
    The action with the given id

### createActionGroup

    protected ActionGroup createActionGroup(java.lang.String actionGroupId,
                                            org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Creates the action group for the given id. By default, this method does nothing. Subclasses must override to provide their own implementation of action group creation.

  Parameters:
    `actionGroupId` - The action group id
    `partDescriptor` - The workbench part descriptor
  Returns:
    Action Group for the given id

### createMenuManager

    protected IMenuManager createMenuManager(java.lang.String menuId,
                                             org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Creates the menu manager with the given id. By default, this method does nothing. Subclasses must override to provide their own implementation of menu manager creation.

  Parameters:
    `menuId` - The menu manager id
    `partDescriptor` - The workbench part descriptor
  Returns:
    The menu manager with the given id

### createCustomContributionItem

    protected IContributionItem createCustomContributionItem(java.lang.String customId,
                                                             org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor)

  Creates the custom contribution with the given id. By default, this method does nothing. Subclasses must override to provide their own implementation of custom contribution creation.

  Parameters:
    `customId` - The custom contribution id
    `partDescriptor` - The workbench part descriptor
  Returns:
    The custom contribution with the given id

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.