diff options
author | Remy Suen | 2011-08-10 17:07:02 +0000 |
---|---|---|
committer | Paul Webster | 2011-08-25 14:22:01 +0000 |
commit | 5a7711b1717966779cecb91dbbdab4341f438074 (patch) | |
tree | 0746f550e50fd7491a5423dede18814d9cae198c | |
parent | d5e6b7a103e8fb938470fd5bb83d96ee8b0f3b40 (diff) | |
download | eclipse.platform.ui-5a7711b1717966779cecb91dbbdab4341f438074.tar.gz eclipse.platform.ui-5a7711b1717966779cecb91dbbdab4341f438074.tar.xz eclipse.platform.ui-5a7711b1717966779cecb91dbbdab4341f438074.zip |
Bug 348920 [Compatibility] Contribution visibility seems to leak to
other workbench windows
Action sets were being seen in other workbench windows even they
did not apply because the action set activations requested from
the manager did not scope the context activation to its parent
workbench window. Scoping the activation on a workbench window
prevents the activations from leaking up to the application and
affecting all of its child windows.
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java index 614bf9d1016..200a5b19086 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,10 +17,11 @@ import java.util.Map; import org.eclipse.core.runtime.ListenerList; import org.eclipse.ui.IPropertyListener; +import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextService; +import org.eclipse.ui.internal.expressions.WorkbenchWindowExpression; import org.eclipse.ui.internal.registry.IActionSetDescriptor; -import org.eclipse.ui.services.IServiceLocator; /** * Maintains a reference counted set of action sets, with a visibility mask. @@ -68,9 +69,11 @@ public class ActionSetManager { private IPropertyListener contextListener; private Map activationsById = new HashMap(); private IContextService contextService; + private IWorkbenchWindow window; - public ActionSetManager(IServiceLocator locator) { + public ActionSetManager(IWorkbenchWindow locator) { contextService = (IContextService) locator.getService(IContextService.class); + window = locator; addListener(getContextListener()); } @@ -85,8 +88,8 @@ public class ActionSetManager { IActionSetDescriptor desc = (IActionSetDescriptor) source; String id = desc.getId(); if (propId == PROP_VISIBLE) { - activationsById.put(id, contextService - .activateContext(id)); + activationsById.put(id, contextService.activateContext(id, + new WorkbenchWindowExpression(window))); } else if (propId == PROP_HIDDEN) { IContextActivation act = (IContextActivation) activationsById .remove(id); |