Community
Participate
Working Groups
Using I20070213-0907, and the fix to bug 171079, I have a handler with <activeWhen> and <enabledWhen> clauses that is not enabling when it should. The handler should be enabled when the active part is NOT the snippet editor, and there is an available execution context (for a debugger evaluation). The contribution looks like the following: <extension point="org.eclipse.ui.handlers"> <handler class="org.eclipse.jdt.internal.debug.ui.evaluation.ForceReturnHandler" commandId="org.eclipse.jdt.debug.ui.commands.ForceReturn"> <activeWhen> <with variable="activePartId"> <not> <equals value="org.eclipse.jdt.debug.ui.SnippetEditor"> </equals> </not> </with> </activeWhen> <enabledWhen> <with variable="activeContexts"> <test property="org.eclipse.jdt.debug.ui.contains" value="org.eclipse.jdt.debug.ui.evaluation"> </test> </with> </enabledWhen> </handler> </extension> NOTES: - when I remove the <not> clause for the SnippetEditor, and exchange it for an "equals specific part" clause, the active/enabled states work as expected. It seems that as soon as I insert the "not", the handler is never considered to be active. - If I swap <active/enabledWhen> states (i.e. active when there is a context, and enabled when not in the snippet editor), it works (but that's not the behavior I want, since I want a different handler for the snippet editor). I can attach a patch of the work in progress if needed.
Created attachment 59338 [details] Active Handler project v01 First test project PW
I'll see what I can do with this one...
Created attachment 64780 [details] active handler example Darin - I'm trying to come up with a simple case that will demonstrate the problem, and so far have had no luck. Attached is a project with a sample handler that is active when the active part is NOT a java editor and enabled when the coolbar is visible. This works as expected, so I suppose it proves that <activeWhen> with a <not> clause on a specific part works as expected, and can work in conjunction with an enabledWhen expression. So I would guess the real problem is some subtlety in the enabledWhen expression. Can you double check that your property tester is enabling correctly or otherwise comment on how your case might be different...
Darin, if you feel confident that your enabledWhen expression is reasonable, then just attach the code that demonstrates your specific problem and I'll dig further.
Created attachment 64802 [details] active handler example v03 I did a quick test with an expression that included a property tester. It depends on having platform-ui-tests checked out into the workspace. It works as one would expect. I suspect that this problem was fixed end of Feb with bug 171079, prior to that it was not reliably updated. PW
I no longer have the work in progress - it was abandonned. If you think the problem is fixed, please mark it as such. It looks like we will not be migrating to the new action support until 3.4. If we find new problems we will open bugs then. Thanks.
marking WORKSFORME
verified that it is working in Win XP, I20070430-0800