1
我的RCP應用程序通過在WorkbenchWindowAdvisor#preWindowOpen
中設置configurer.setShowCoolBar(true)
可以看到冷卻欄。但是,當我向主工具欄提供工具欄時,它永遠不會顯示出來。這裏是我的貢獻代碼:Eclipse RCP無法貢獻到主工具欄
<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
}
...
}
我使用this code添加了一個定製透視圖切換。這是比較舊,但我到處在網上看到添加這樣的工具欄主工具欄上的例子,所以我失去了一些東西elsewher,我認爲
謝謝。我根據bug中的解決方法實施了它。它工作除了我不能讓工具欄顯示更新。在WorkbecnhWindowControlContribution的fill方法中,我在createControl中創建的父級上創建一個工具欄。當應用程序加載時,我會成功填充工具欄。但後來,當我想將一個項目添加到工具欄中時,我調用了填充,我發現它添加了該項目,但是在我重新啓動應用程序之前,工具欄不會顯示新項目。我試圖在工具欄及其父母上調用更新和佈局。在WorkbecnhWindow上也稱爲updateActionBars。我怎樣才能讓工具欄更新? – MidnightJava