Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370340 - visibleWhen is not checked for key binding only commands
Summary: visibleWhen is not checked for key binding only commands
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.4 RC1   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-01 10:35 EST by Szymon Brandys CLA
Modified: 2012-02-06 13:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.