简体   繁体   English

Eclipse Kepler中工具栏按钮的顺序

[英]Order of toolbar buttons in Eclipse Kepler

I'm trying to contribute to the same custom toolbar from two different plugin.xml files. 我试图通过两个不同的plugin.xml文件为同一自定义工具栏做出贡献。 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 并在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. 在主要的plugin.xml文件中,必须在工具栏上定义分隔符,并应在其中插入其他按钮。

In the second plugin.xml file the toolbar contribution should look similar to this: 在第二个plugin.xml文件中,工具栏的显示应类似于以下内容:

<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. 其中mainAdditions是分隔符的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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