Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Command handlers in custom non-modal window
Command handlers in custom non-modal window [message #1015357] Thu, 28 February 2013 10:44
Peter Severin is currently offline Peter SeverinFriend
Messages: 19
Registered: July 2009
Junior Member

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)
contextService.registerShell(shell, IContextService.TYPE_WINDOW);
contextService.activateContext("myContextId", new
ActiveShellExpression(shell), false)

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!

Best regards,

Previous Topic:Retarget Debug actions are not enabled on editor page change
Next Topic:Short Survey for Eclipse Developer/Maintainers
Goto Forum:

Current Time: Tue Oct 27 02:01:13 GMT 2020

Powered by FUDForum. Page generated in 0.01784 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top