【问题标题】:Order of toolbar buttons in Eclipse KeplerEclipse Kepler 中工具栏按钮的顺序
【发布时间】:2013-10-08 15:27:24
【问题描述】:

我正在尝试从两个不同的 plugin.xml 文件中为同一个自定义工具栏做出贡献。不幸的是,我找不到指定按钮出现顺序的方法。应该是最后一个的按钮会显示为第一个按钮。

我已经尝试使用指定插入位置

...
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");
...

在plugin.xml中

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

有人知道可能出了什么问题吗?

【问题讨论】:

    标签: eclipse toolbar eclipse-kepler


    【解决方案1】:

    我终于明白了。

    在主 plugin.xml 文件中,必须在工具栏上定义一个分隔符,其中应该插入附加按钮。

    在第二个 plugin.xml 文件中,工具栏的贡献应该类似于:

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

    其中 mainAdditions 是分隔符的名称。

    【讨论】:

    • 谢谢,你拯救了我的一天
    猜你喜欢
    • 1970-01-01
    • 2013-11-04
    • 2010-09-14
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    • 1970-01-01
    • 2014-02-28
    • 2021-08-17
    相关资源
    最近更新 更多