Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365641 - [Contributions] When a command is declaratively added to the coolbar inside an editor's toolbar, it is not sticky
Summary: [Contributions] When a command is declaratively added to the coolbar inside a...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-05 13:00 EST by Vasanth Velusamy CLA
Modified: 2019-11-14 03:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasanth Velusamy CLA 2011-12-05 13:00:06 EST
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
Comment 1 Lars Vogel CLA 2019-11-14 03:17:43 EST
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.