Contributed control to the status bar not visible

▼魔方 西西 提交于 2019-12-07 04:29:33

问题


I would like to place a control in the status bar of the workbench window. The whole process should be straight-forward, but whatever I try, the status bar contribution does not become visible.

Because I do not own the application but just contrinbute a plug-in to the IDE, WorkbenchWindowAdvisor and friends are not an option.

The extension point is this:

<extension point="org.eclipse.ui.menus">
   <menuContribution locationURI="toolbar:org.eclipse.ui.trim.status" allPopups="false">
      <control class="MyContributionItem" id="myContributionItem" />
   </menuContribution>
</extension>

and the MyContributionItem class is like this:

public class MyContributionItem extends WorkbenchWindowControlContribution {
  protected Control createControl( Composite parent ) {
    Label label = new Label( parent, SWT.NONE );
    label.setText( "STATUS BAR!" );
    return label;
  }
}

What I tried so far, all without sucess (i.e. the status bar contribution does not show up):

  • added ?after=org.eclipse.jface.action.StatusLineManager to the locationURI
  • put a breakpoint in MyContributionItem#createControl(), it is never reached
  • target platform: Eclipse Platform SDK 3.8 or 4.4: makes no difference
  • changing the allPopups attribute to true

I am quite sure that I am mising something very obvious, ...


回答1:


Try this: Plugin.xml

<extension
     point="org.eclipse.ui.menus">
      <menuContribution
        allPopups="false"
        locationURI="toolbar:org.eclipse.ui.trim.status">
     <toolbar
           id="org.ancit.search.web.searchbar"
           label="Search Bar">
        <control
              class="org.ancit.search.web.controlContributions.GoogleSearchControlContribution"
              id="org.ancit.search.web.controlContributions.GoogleSearchControlContribution">
        </control>
     </toolbar>
      </menuContribution>
   </extension>

Check GoogleSearchControlContribution class on github



来源:https://stackoverflow.com/questions/28202990/contributed-control-to-the-status-bar-not-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!