Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370340

Summary: visibleWhen is not checked for key binding only commands
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: ClientAssignee: Susan McCourt <susan>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pwebster
Version: unspecified   
Target Milestone: 0.4 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Szymon Brandys CLA 2012-02-01 10:35:07 EST
I have a dom command with a check in visibleWhen(). It is added to my page in the following way:
commandService.registerCommandContribution("eclipse.orion.git.openCommitCommand", 102, "pageActions", "eclipse.gitGroup");
When the command framework renders the dom commands visibleWhen check is called.

Now I made the command a key binding only command.
commandService.registerCommandContribution("eclipse.orion.git.openCommitCommand", 102, "pageActions", "eclipse.gitGroup", true, new mCommands.CommandKeyBinding('h', true, true);
vivibleWhen is now not checked.
Comment 1 Susan McCourt CLA 2012-02-01 12:02:32 EST
our first binding-only command that isn't always active.

Paul also mentioned the irony of "visibleWhen" when in fact this is an activation expression because the command is never "visible".  I'm not sure we need to distinguish, but perhaps a better name.
Comment 2 Susan McCourt CLA 2012-02-03 02:28:10 EST
fixed.
Szymon, apart from seeing the console log in the visible when expression, I didn't have a way to make sure the validation was working as you expect.  Please reopen if there's any problem.
Comment 3 Susan McCourt CLA 2012-02-06 13:17:35 EST
The dynamic case of the page target changing is not handled.  For example...
on the repositories page, when it is just "Repositories" the visibleWhen for "open commit" is false.  Good.

Now the page target is changed to a particular repository.
We recalculate and render and we indeed get a binding.  Good.

Now change page target back to "Repositories."
We need a way to mark the binding as being inactive again.  We have never in the past checked a binding when we aren't rendering a command.  Here, we know we don't want to render it, but we still need to deactive the binding.

Pushed a fix.