Can I use a command parameter in its handler's enabledWhen? [message #483539] |
Tue, 01 September 2009 23:57 |
|
I have a command declared with a parameter and several menu contributions
and a handler extension referencing that command. I'd like to show the
menu contributions based on selection type type and enable them
independently based on a combination of the selection's state and the
parameter value. I have visibleWhen clauses on the menu contributions
checking the selection type. Now I want to determine enablement of the
handler.
Am I correct in thinking the enablement of each menu item is determined
by the (common) handler's enabledWhen clause being checked for each menu
item upon drawing the menu? If so can I use "with selection" to examine
its state and use a "with" or "resolve" to somehow check the parameter
associated with each menu item? I would appreciate any help in how to
test the command parameter each menu item is associated with.
Thanks,
Craig Foote
|
|
|
|
Re: Can I use a command parameter in its handler's enabledWhen? [message #483780 is a reply to message #483732] |
Wed, 02 September 2009 22:59 |
|
Ok Paul, thanks for the reply.
Craig
On Wed, 02 Sep 2009 14:29:49 -0400, Paul Webster wrote:
> in 3.x, a command is a global object and its the one that has the
> enabled state. Parameters (like the view id on showView) are passed in
> during an execute call, but are not available otherwise.
>
> Because of the command design and the use of the global application
> context, a command is enabled or disabled for the entire application.
> i.e. if you disabled the showView command, all of the menu items under
> Window>Show View would be disabled.
>
> In 4.0 we're investigating the notion of context sensitive queries
> (asking isActive, isEnabled, and isVisible from a specific view, for
> example) but that is such a change that it is not being considered in
> 3.x.
>
> PW
|
|
|
Powered by
FUDForum. Page generated in 0.02683 seconds