问题描述
我想在工作台窗口的状态栏中放置一个控件。整个过程应该是直接的,但无论我尝试什么,状态栏的贡献都不会变得可见。
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.
因为我不自己的应用程序,但只是插入到IDE中, WorkbenchWindowAdvisor
和朋友不是一个选项。
Because I do not own the application but just contrinbute a plug-in to the IDE, WorkbenchWindowAdvisor
and friends are not an option.
扩展点是这样的:
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="toolbar:org.eclipse.ui.trim.status" allPopups="false">
<control class="MyContributionItem" id="myContributionItem" />
</menuContribution>
</extension>
和 MyContributionItem
类是这样的:
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):
- 添加
?after = org.eclipse.jface.action。 StatusLineManager
到locationURI
- 在
MyContributionItem#createControl()
,它永远不会达到 - 目标平台:Eclipse Platform SDK 3.8或4.4:没有区别
- code> allPopups 属性为
true
- added
?after=org.eclipse.jface.action.StatusLineManager
to thelocationURI
- 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 totrue
我很确定我在做一些非常明显的事情,...
I am quite sure that I am mising something very obvious, ...
推荐答案
尝试这个:
插件.xml
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>
检查 github上的类
Check GoogleSearchControlContribution class on github
这篇关于对状态栏的贡献控制不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!