|Command handlers in custom non-modal window [message #1015357]
||Thu, 28 February 2013 10:44
| Peter Severin
Registered: July 2009
I am trying to implement the following scenario. My editor has a command
that opens a new non-modal window (a shell with the display as parent).
In this window I'd like to be able to define local handlers and to use
key bindings defined in preferences. Specifically, I'd like to have
zoomIn and zoomOut commands. Note that these commands are also defined
in the editor.
What I did is the following. To define a custom handler I do:
final IHandlerService handlerService = (IHandlerService)
final IHandlerActivation activation =
handlerService.activateHandler(commandId, new ActiveShellExpression(shell));
Then I also activate the context using:
final IContextService contextService = (IContextService)
Here myContextId is the scope I use for my key bindings. This scope is
also activated in the editor.
So what happens is that when I press the zoom in in my window, it
actually invokes the zoomIn command in the editor. If I remove the
zoomIn handler from the editor then zoomIn works in the viewer. However
I can still invoke all other commands handled in the editor while being
inside the viewer which is not what I want.
I'd like to make commands work inside the viewer the same way they do in
workbench parts. When the active part changes a different set of
commands gets active.
Is something like this possible? What would be the correct approach?
Thanks in advance!
Powered by FUDForum
. Page generated in 0.02593 seconds