问题
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.StatusLineManagerto 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
allPopupsattribute totrue
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