Two views in the workbench window. Both contain a toolbar with a CommmandContributionItem. Both CommandContributionItems belong to the same command. Each one should set its enablement-status independently according to its view context. BUT: You cannot have one CommmandContributionItem enabled and the other not at the same time.
That Problem is described in http://www.eclipsezone.com/eclipse/forums/t112307.html
Excerpt from that article:
As I see it, the problem is not directly related to the handlers, but to
the commands themselves, which (being typically defined in the plug-in’s
plugin.xml file) are instantiated by the platform only once. Thus, if
two command contribution items in two workbench windows are associated
with the same command ID, they are also referencing the same command
object. Since this command can, in turn, only be associated with (at
most) one handler at any one time, and this handler is responsible for
determining the commands enabled status, it is (as Mark says) impossible
to enable the command contribution item in one workbench window, whilst
keeping the command contribution using the same command ID in the other
workbench window disabled (or vice versa).
You can reproduce that wrong behaviour with Eclipse 3.4 or Eclipse 3.5 as follows (excerpt from the mentioned article):
- Start Eclipse IDE, specifying a workspace containing at least one file editable via the Text Editor.
- Close any editors. The “Print” toolbar item should now be disabled.
- Open a new workbench window via “Window > New Window”
- Open the Text Editor on a workspace file.
- Note that the “Print” toolbar item is now not only (correctly) enabled for the new workspace window, but is also (incorrectly) enabled for the original workspace window, even though there is nothing to print there.