diff options
| author | Paul Webster | 2013-04-15 17:39:42 +0000 |
|---|---|---|
| committer | Gerrit Code Review @ Eclipse.org | 2013-04-17 16:27:46 +0000 |
| commit | f1cd3bf45ceb9e023bacbf2577eb28bea52f0260 (patch) | |
| tree | b05cca3e89ecb0dd59686eb2307d93f5258dcd07 | |
| parent | f738c495f4f885cc4a3f824a16a9f32f02ef6195 (diff) | |
| download | eclipse.platform.ui-f1cd3bf45ceb9e023bacbf2577eb28bea52f0260.tar.gz eclipse.platform.ui-f1cd3bf45ceb9e023bacbf2577eb28bea52f0260.tar.xz eclipse.platform.ui-f1cd3bf45ceb9e023bacbf2577eb28bea52f0260.zip | |
Bug 394336 - File->Close menu item is disabled even when current editor
is activated
ExpressionContext is used from the topmost or starting context, not the
leaf.
Change-Id: I44d9d9434157a9cf5472d14bdce1dbe9c120227c
2 files changed, 9 insertions, 4 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java index c5b65f95dbc..afd6d306904 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java @@ -125,7 +125,7 @@ public final class ContextService implements IContextService { } return false; } - ExpressionContext ctx = new ExpressionContext(eclipseContext.getActiveLeaf()); + ExpressionContext ctx = new ExpressionContext(eclipseContext); try { if (updating) { EvaluationResult result = expression.evaluate(ctx); diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java index 7e08b321187..81f2ed83879 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java @@ -29,6 +29,7 @@ import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.core.di.annotations.Optional; import org.eclipse.e4.ui.internal.workbench.Activator; import org.eclipse.e4.ui.internal.workbench.Policy; +import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.workbench.modeling.ExpressionContext; import org.eclipse.swt.widgets.Event; import org.eclipse.ui.PlatformUI; @@ -51,10 +52,14 @@ public class E4HandlerProxy implements IHandlerListener { } @CanExecute - public boolean canExecute(IEclipseContext context, @Optional IEvaluationContext staticContext) { + public boolean canExecute(IEclipseContext context, @Optional IEvaluationContext staticContext, + MApplication application) { if (handler instanceof IHandler2) { - ((IHandler2) handler).setEnabled(staticContext == null ? new ExpressionContext(context) - : staticContext); + Object ctx = staticContext; + if (ctx == null) { + ctx = new ExpressionContext(application.getContext()); + } + ((IHandler2) handler).setEnabled(ctx); } return handler.isEnabled(); } |
