Eclipse RCP无法参与主工具栏 [英] Eclipse RCP Can't Contribute to Main Toolbar
问题描述
通过在WorkbenchWindowAdvisor#preWindowOpen
中设置configurer.setShowCoolBar(true)
,我的RCP应用程序具有显示的冷却栏.但是,当我向主工具栏贡献工具栏时,它永远不会显示出来.这是我的贡献代码:
My RCP app has the coolbar visible by setting configurer.setShowCoolBar(true)
in WorkbenchWindowAdvisor#preWindowOpen
. But when I contribute a toolbar to the main toolbar, it never shows up. Here's my contribution code:
<extension point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar id="toolbar.perspectivesDynamic">
<dynamic
class="my.package.PerspectiveSwitcherToolbar"
id="perspectiveSwitcherToolbar">
</dynamic>
</toolbar>
</menuContribution>
</extension>
和ContributionItem
类:
public class PerspectiveSwitcherToolbar extends ContributionItem {
...
@Override
public void fill(final ToolBar parent, int index) {
//Does not get called
}
@Override
public void fill(CoolBar parent, int index) {
//Does not get called
}
...
}
我正在使用此代码添加自定义透视图切换器.它已经很老了,但我在Internet上到处都看到示例,在主工具栏上添加了这样的工具栏,因此我想念其他东西
I'm using this code for adding a custom perspective switcher. It's rather old, but I see examples everywhere on the Internet adding a toolbar like this to the main toolbar, so I'm missing something elsewher, I assume
推荐答案
I think that is bug 392457: <toolbar><dynamic></toolbar>
doesn't work at the moment. You can work around it by using a <control>
and managing the contents yourself.
这篇关于Eclipse RCP无法参与主工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!