Project: Eclipse_Platform_UI
Bug 179980 [Contributions] visibleWhen does not work properly for multiple workbench windows
Reported: 2007-03-29 09:14:50 | Status: verified fixed

Hi, i have problems using new menu/handlers framework in 3.3M6. As i understand there is possibility to contribute to main menu from my plugin defining something like this: <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=open"> <menu id="command" label="Command" mnemonic="C"> <visibleWhen> <with variable="activeContexts"> <iterate operator="or"> <equals value="biz.wss.rcp.fxmanager.FXDealEntryEditor"/> </iterate> </with> </visibleWhen> </menu> </menuContribution> </extension> It means every time when context biz.wss.rcp.fxmanager.FXDealEntryEditor is active menu is displayed. I activate context every time when my plugin's editor is activated. It works properly and menu is displayed properly. Problem occurs when i open another workbench window. I arranged them so both are together visible on the screen. I clicked to one of them to any other editor then my so my menu is not visible. In the second i clicked to my editor and menu changed as i expected, but menu were changed also in the first editor however my editor is not active there. I think problem is caused by evaluating of activeWhen expression. I am checking active context and i would expect it is held per WorkbenchWindow, unfortunatelly it is held by whole workbench. So when click to my editor in the second window my context is activated but not only in this workbench window but also in the first. Same situation is when i change my condition to "activeEditorId". Only one editor is active for whole workbench and it ignores what editor is active in WorkbenchWindow. It results in situation when i don't know how to create in new framework menus what are visible only when my editor is active... Thanks in advance Tomas

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalMenuService.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/TrimContributionManager.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WindowMenuService.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationAuthority.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationReference.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationService.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/services/EvaluationServiceTest.java