summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBernard Leach2011-05-06 10:14:32 (EDT)
committer Bernard Leach2011-05-13 07:50:54 (EDT)
commit96d0ac7d0234f0fef6dbab34c9834d22ad084a9d (patch)
tree702b919f310146c02186c22dc9de8924e733f908
parentc7a6a92124878a6f2f4d52425195768db2a75590 (diff)
downloadegit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.zip
egit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.tar.gz
egit-96d0ac7d0234f0fef6dbab34c9834d22ad084a9d.tar.bz2
Save evaluation context to allow isEnabled to use caller's contextrefs/changes/54/3354/2
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.java7
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 5bb0e5e..2975273 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()