Community
Participate
Working Groups
Build Identifier: 20110615-0604 I am trying to add a command to the main coolbar/toolbar. It works fine if I add the command in a generic place, like after 'additions' (toolbar:org.eclipse.ui.main.toolbar?after=additions), but it does not work well if I add the command to my editor's toolbar group (toolbar:org.eclipse.ui.main.toolbar?endof=my.editor), where my.editor is the id for my editor. The problem is this: Menu/toolbar contributions from plugin.xml are read once, when eclipse starts. In my case, the command definition is read, and it is stored to be part of the main toolbar. When the editor is opened for the first time, the command is in the editor's toolbar group and it works fine. However, when I close the editor, the command is removed from the editor's coolbar and a placeholder is inserted instead. This is fine. But, when the editor is reopened, the command declared in plugin.xml is not put back in the coolbar. I am not sure if this is by design. Seems more like an oversight. Hence this bug. Some of the areas in code that are relevant: org.eclipse.ui.internal.EditorActionBars.dispose() - The coolbar is cleared here. coolItemToolBarMgr.removeAll() org.eclipse.ui.internal.menus.MenuAdditionCacheEntry - This is where the toolbar contributions are read, but only once. If whatever I have explained so far is valid, I suppose the solution would be to read through the declared contributions and get all relevant commands for the editor and add them back, when the editor is reopened. My current workaround is to programmatically declare the command in my editor's implementation of org.eclipse.ui.part.EditorActionBarContributor.contributeToToolBar(IToolBarManager), which works, but not ideal since some of my other declarations are in plugin.xml. Reproducible: Always
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag.