DESCRIPTION

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


COMMENTS

author: Brenden Conley
date: 2011-05-06 14:37:59.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/644/ 

-------------------------------------
author: Brenden Conley
date: 2011-05-06 14:52:42.000000000

Patch Set 1: I would prefer that you didn't submit this

Build Unstable 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/644/ : UNSTABLE

-------------------------------------
author: Carlie Harper
date: 2011-05-09 13:45:10.000000000

Patch Set 1: (1 inline comment)



Line:299, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java -> Just for me to understand: When is mySelection == null? 

In my tests, whenever this is the case, I get an <empty selection> as return value from convertSelection. So what is the usecase for the evalutation of the IEvaluationContext?

-------------------------------------
author: Imani Waller
date: 2011-05-09 23:19:57.000000000

Patch Set 1: (1 inline comment)



Line:299, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java -> When I called the ActionCommands.COMPARE_WITH_INDEX_ACTION from the staging view I found that it would not use my supplied context instead getEvaluationContext() would be called, convertSelection would then return <empty selection> instead of the selection in my supplied context.

The framework class Command in executeWithChecks calls setEnabled(event.getApplicationContext()) (e.g. the supplied context) and then isEnabled() which without this change uses a different context.

This is my first foray into eclipse RCP and its a big learning curve so I may have missed something completely.  This change 'makes it work for me' though...

-------------------------------------
author: Carlie Harper
date: 2011-05-11 13:50:58.000000000

Patch Set 1: Build Successful

(1 inline comment)



Line:299, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java -> Ah, thanks. Now I see what it's for.

I'm not that familiar with that, but your solution works.

-------------------------------------
