Key Binding Conflict Question [message #330438] |
Mon, 28 July 2008 18:35  |
Eclipse User |
|
|
|
I am using the org.eclipse.ui.menus extension to define some context menu
commands and I have a pair of items that are mutually exclusive WRT their
visibleWhen expressions and their handler's activeWhen/enableWhen
ecpressions. I would like to be able to assign the same key binding to
each, but I cannot get past the key binding conflict. Is there anything in
the extension points that would allow this, or is there a programmatic way
to get past this?
|
|
|
|
Re: Key Binding Conflict Question [message #330501 is a reply to message #330449] |
Wed, 30 July 2008 10:50  |
Eclipse User |
|
|
|
Hi Paul,
Thanks for this suggestion. I ended up using a single
command/handler/binding, and used the dynamic contribution mechanism to
set different strings in the menu based on the state of the selection. The
handler also used this state to route to the desired behavior.
Mike
Paul Webster wrote:
> The keybindings themselves are static in nature (i.e. they are not
> enabled/disabled by command state, but simply do nothing if the command
> is disabled).
> Depending on what you want to accomplish, one possibility is to create a
> context using org.eclipse.ui.contexts that is a sub context of an
> appropriate context (like org.eclipse.ui.window). When your context is
> active, that keybinding defined in that context will override a
> keybinding defined in the org.eclipse.ui.window context.
> Then you would just say "Command A is the common case, CTRL+5 A in
> window, Command B is the other case, CTRL+5 A in my.context"
> Then when appropriate, you would use the IContextService to activate
> my.context.
> PW
|
|
|
Powered by
FUDForum. Page generated in 0.04598 seconds