Runtime

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

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

All Implemented Interfaces:
  java.util.EventListener, IProvider, IProviderChangeListener, org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider

    public class ContributionItemService

extends Service
implements org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider

A service for contributing items into different `IWorkbenchPart`'s contribution managers: ActionBars and ContextMenu(s).

See Also:
  `IContributionItemProvider`, `AbstractContributionItemProvider`

Nested Class Summary
`protected static class` `ContributionItemService.ProviderDescriptor` A descriptor for `IContributionItemProvider` defined by a configuration element.

Field Summary

Fields inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`INVALID_ELEMENT_MESSAGE_PATTERN`

Method Summary
`void` `contributeToActionBars(IActionBars actionBars, IWorkbenchPart workbenchPart)` Makes contributions to the given `actionBars` that belong to the given part.
`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.
`void` `disposeContributions(IWorkbenchPartDescriptor workbenchPartDescriptor)` Gives the provider a chance to clean up and dispose any cached contributions previously targeted at a part described by the given descriptor.
`static ContributionItemService` `getInstance()` Returns the single instanceo of the `ContributionItemService`.
`protected Service.ProviderDescriptor` `newProviderDescriptor(IConfigurationElement element)` Creates a new provider descriptor for the specified configuration `element`.
`void` `updateActionBars(IActionBars actionBars, IWorkbenchPartDescriptor workbenchPartDescriptor)` 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.Service
`addProvider, clearCache, configureProviders, configureProviders, createPriorityCache, execute, executeUnique, getAllProviders, getCachingKey, getPriority, getProviders, isOptimistic, isOptimized, providerChanged, provides, provides, removeProvider`

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, provides, removeProviderChangeListener`

Method Detail

### getInstance

    public static ContributionItemService getInstance()

  Returns the single instanceo of the `ContributionItemService`.

  Returns:
    The single instance of the `ContributionItemService`

### newProviderDescriptor

    protected Service.ProviderDescriptor newProviderDescriptor(IConfigurationElement element)

  Description copied from class: `Service`
  Creates a new provider descriptor for the specified configuration `element`.

  Overrides:
    `newProviderDescriptor` in class `Service`
  Parameters:
    `element` - The configuration element from which to create the descriptor.
  Returns:
    A new provider descriptor.

### contributeToActionBars

    public void contributeToActionBars(IActionBars actionBars,
                                       IWorkbenchPart workbenchPart)

  Makes contributions to the given `actionBars` that belong to the given part.

  Specified by:
    `contributeToActionBars` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  Parameters:
    `actionBars` - the action bars
    `workbenchPart` - the workbench part
  See Also:
    `IContributionItemProvider.contributeToActionBars(IActionBars, IWorkbenchPartDescriptor)`

### contributeToPopupMenu

    public void contributeToPopupMenu(IMenuManager popupMenu,
                                      IWorkbenchPart workbenchPart)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  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. Since the current selection could be a context to this API, a selection could be retrieved from the part's site's selection provider.

  This API is usually called from `menuAboutToShow()` method of the main `IMenuListener` to a given context menu.

  Specified by:
    `contributeToPopupMenu` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  Parameters:
    `popupMenu` - The target popup menu manager
    `workbenchPart` - The context workbench part

### disposeContributions

    public void disposeContributions(IWorkbenchPartDescriptor workbenchPartDescriptor)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  Gives the provider a chance to clean up and dispose any cached contributions previously targeted at a part described by the given descriptor.

  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.

  Specified by:
    `disposeContributions` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  Parameters:
    `workbenchPartDescriptor` - The context workbench part descriptor

### updateActionBars

    public void updateActionBars(IActionBars actionBars,
                                 IWorkbenchPartDescriptor workbenchPartDescriptor)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  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.

  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.

  Specified by:
    `updateActionBars` in interface `org.eclipse.gmf.runtime.common.ui.services.action.internal.contributionitem.IContributionItemProvider`
  Parameters:
    `actionBars` - The target action bars
    `workbenchPartDescriptor` - The context workbench part descriptor

Runtime

Guidelines for using Eclipse APIs.

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