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:Eclipse Installation Breakdown : What versions are in wide use ?
Next Topic:Eclipse is always not responding!
Goto Forum:

Current Time: Wed May 23 17:07:47 GMT 2018

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

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

Back to the top