简体   繁体   中英

Order of toolbar buttons in Eclipse Kepler

I'm trying to contribute to the same custom toolbar from two different plugin.xml files. Unfortunately I can't find a way to specify the order in which the buttons appear. The one that is supposed to be the last appears as the first button.

I already tried to specify the insertion position by using

...
MenuManager manager = new MenuManager(null, "my.toolbar.id");
IMenuService menuService = (IMenuService) getEditorSite().getService( IMenuService.class);
manager.add(new GroupMarker("testing"));
menuService.populateContributionManager(manager, "toolbar:my.toolbar.id?after=testing");
...

and in the plugin.xml

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="toolbar:my.toolbar.id?after=testing">
    <toolbar id="my.toolbar.id">
<command ...

Does anybody have an idea what could be wrong?

I finally figured it out.

In the main plugin.xml file a separator has to be defined on the toolbar where the additional buttons are supposed to be inserted.

In the second plugin.xml file the toolbar contribution should look similar to this:

<extension
     point="org.eclipse.ui.menus">
<menuContribution
        locationURI="toolbar:my.toolbar.id?after=mainAdditions">
     <!-- no toolbar element with id here-->
        <command ...
  </menuContribution>

where mainAdditions is the name of the separator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM