diff options
| author | Bernard Leach | 2011-05-06 14:14:32 +0000 |
|---|---|---|
| committer | Bernard Leach | 2011-05-13 11:50:54 +0000 |
| commit | 96d0ac7d0234f0fef6dbab34c9834d22ad084a9d (patch) | |
| tree | 702b919f310146c02186c22dc9de8924e733f908 | |
| parent | c7a6a92124878a6f2f4d52425195768db2a75590 (diff) | |
| download | egit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.tar.gz egit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.tar.xz egit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.zip | |
Save evaluation context to allow isEnabled to use caller's context
When an action implements isEnabled() the method setEnabled() is
used to set the evaluation context prior to the isEnabled() call.
Prior to this change the implementation would obtain the global
context rather than use any specified by the caller.
Change-Id: I7d2ffb9df66d21271a66a365b88411f7b7d7fe04
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java index 5bb0e5efd6..2975273cdd 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java @@ -54,6 +54,7 @@ import org.eclipse.ui.ide.ResourceUtil; * A helper class for Team Actions on Git controlled projects */ abstract class RepositoryActionHandler extends AbstractHandler { + private IEvaluationContext evaluationContext; private IStructuredSelection mySelection; @@ -295,7 +296,7 @@ abstract class RepositoryActionHandler extends AbstractHandler { // if the selection was set explicitly, use it if (mySelection != null) return mySelection; - return convertSelection(getEvaluationContext(), null); + return convertSelection(evaluationContext, null); } private IStructuredSelection convertSelection(IEvaluationContext aContext, @@ -328,6 +329,10 @@ abstract class RepositoryActionHandler extends AbstractHandler { return StructuredSelection.EMPTY; } + public void setEnabled(Object evaluationContext) { + this.evaluationContext = (IEvaluationContext) evaluationContext; + } + private IEvaluationContext getEvaluationContext() { IEvaluationContext ctx; IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench() |
