Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Adding Menu Items To Commerce Manager's Main Toolbar

Adding Menu Items To Commerce Manager's Main Toolbar

Commerce Manager implements all its toolbars as ToolBar objects, with the exception of the main (top) toolbar, which is implemented as a CoolBar. Items, such as icons or buttons, are added to the menu as ContributionItems.

To add a new menu item to an existing Commerce Manager toolbar, you must extend the existing toolbar using an Eclipse Extension Point and add a new toolbar and add your ContributionItems to that toolbar. Like all extensions, Toolbar extensions are created in commerce-extensions/cm/ext-cm-modules/ext-cm-plugins.

First, define your new toolbar as a menuContribution child element of the org.eclipse.ui.menus extension point in plugin.xml.

Note: Separators

Adding Seperators has no effect. In order to achive separation of UI elements, consider grouping items within separate toolbars.

Extending Eclipse Extension Points

For more information on extending Eclipse Toolbars, see the Eclipse Workbench Extension documentation.

To add a contribution item to the main Commerce Manager toolbar, you must do the following in your extension project:
  • Provide an extension point for org.eclipse.ui.menus in your extended plugin's plugin.xml file.
  • Populate the extension point with <menuContribution> and its child elements, <toolbar> and <command>.
    • <menuContribution> has one attribute, locationURI. When adding to the main commerce manager toolbar, locationURI should be toolbar:org.eclipse.ui.main.toolbarFor more information on locationURI syntax, see Eclipse's Menu Contributions documentation.
    • <toolbar> has one attribute, id, which defines the name of the new toolbar you wish to contribute to the main menu bar.
    • <command>, which represents the behaviour of a menu item in the abstract. <command> is a very flexible element, and is best understood by reading Eclipse Workbench's <command> documentation.

The following example adds a contribution item added to the Entitlements perspective.


						label="Entitlement Contribution Item"
						tooltip="Entitlement Contribution Item">


In order to provide actual implementation of the command, you must also extend the org.eclipse.ui.commands extension point, where defaultHandler is a path to the class where your menu item is implemented. The extension point for the commands is needed in order to provide implementation. The id in this case matches the command id.

<extension point="org.eclipse.ui.commands">
        name="Open Entitlement Stuff">


When adding contribution items to menus, there are two exceptions to the rules presented above.


RAP does not render toolbar:org.eclipse.ui.trim.command2 – the right trim area – of the toolbar correctly. If attempting to contribute UI elements to toolbar:org.eclipse.ui.trim.command2, use Elastic Path's alternative, toolbar:com.elasticpath.cmclient.core.toolbars.right instead. This uses Elastic Path's ContributionLoader class to extract all the items contributed to a specific toolbar URI and load them into ToolBarManager correctly.

Perspective Toolbar

In order to add a new item to the Perspective toolbar the following id must be used as the locationURI: com.elasticpath.cmclient.core.toolbars.activities.