使用命令在Eclipse coolbar RCP中启动Space

时间:2016-08-26 09:31:02

标签: eclipse-plugin eclipse-rcp

我使用org.eclipse.ui.menus扩展点从plugin.xml在我的RCP应用程序的coolbar上添加了命令。当我启动它时,我在开头有一个空间,如下图所示:

{{3}}

我该怎么调试呢?我尝试添加插件间谍,但它没有显示任何东西。有趣的是,当我添加Action贡献时,没有空间。

plugin.xml片段将此命令添加到coolbar:

<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:org.eclipse.ui.main.toolbar">
         <toolbar
               id="myapp.application.toolbar3">
            <command
                  commandId="myapp.application.setttings.id"
                  icon="icons/3.png"
                  label="Settings"
                  style="push">
            </command>
         </toolbar>
      <toolbar
               id="myapp.application.toolbar1">
            <command
                  commandId="myapp.application.openWizards"
                  icon="icons/5.png"
                  id="myapp.application.openWizards.dropdown"
                  label="Open"
                  mode="FORCE_TEXT"
                  style="pulldown">
            </command>
         </toolbar>

  </menuContribution>
   </extension>

1 个答案:

答案 0 :(得分:1)

我有类似的问题 Gap between search menu and its previous menu on addition of search plugin

我修改了我的RCP应用程序的ApplicationWorkbenchWindowAdvisor类的postWindowCreate方法

在我调试的地方,添加了哪些IContributionItem项目。

    IWorkbenchPage page = this.getWindowConfigurer().getWindow().getActivePage();
    MenuManager menuBarManager = ((ApplicationWindow)page.getWorkbenchWindow()).getMenuBarManager();
    IContributionItem[] items = menuBarManager.getItems();
    // iterate on items and its children and see which contribution item is getting added 
    // if any unwanted items are present the remove it