Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Overriding Ctrl-W behavior
Overriding Ctrl-W behavior [message #1115740] Tue, 24 September 2013 14:11 Go to next message
Sebastien Pennec is currently offline Sebastien Pennec
Messages: 22
Registered: April 2013
Location: Switzerland
Junior Member
Hello,

In my E4 app, I'd like to bind a command to the M1+W shortcut, which should translate to Ctrl-W on Windows.

I have created a Binding Context with the ID "org.eclipse.ui.contexts.window", and a KeyBinding that links the shortcut and the command. The KeyBinding has the ID "org.eclipse.ui.file.close".


Unfortunately, when I launch my app and do a Ctrl-W, I see a little popup at the lower left of the screen with two possible actions. One is "Close", which is the default command, and the other is the command that I have bound to the shortcut.

Is there something more that I should override?

Thanks for your help!
Re: Overriding Ctrl-W behavior [message #1115911 is a reply to message #1115740] Tue, 24 September 2013 19:22 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

You should likely remove the original default command (or at least its key-binding) to get rid of the conflict.
Re: Overriding Ctrl-W behavior [message #1116209 is a reply to message #1115911] Wed, 25 September 2013 05:14 Go to previous messageGo to next message
Sebastien Pennec is currently offline Sebastien Pennec
Messages: 22
Registered: April 2013
Location: Switzerland
Junior Member
Hello Eric,

Thanks for your answer.

Is there a way to do that from the e4xmi file, or should I do it programmatically? If I have to do it programmatically, where is the best place to do it? In an Addon? Or in a PostContruct of a class that I declare as "lifeCycleURI" in the product?

Also, shouldn't the binding framework manage the presence of multiple bindings with the same ID? I would have expected that if I set a binding up with that ID, it would take precedance over the existing default binding.

[Updated on: Wed, 25 September 2013 05:49]

Report message to a moderator

Re: Overriding Ctrl-W behavior [message #1131698 is a reply to message #1116209] Thu, 10 October 2013 18:46 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

"shouldn't the binding framework manage the presence of multiple bindings with the same ID?", that's exactly what it's doing...the little dialog you see it the KeyBindingManager asking you to choose from two different bindings both of which have declared themselves 'active'...
Re: Overriding Ctrl-W behavior [message #1221996 is a reply to message #1115740] Thu, 19 December 2013 09:59 Go to previous message
Sebastien Pennec is currently offline Sebastien Pennec
Messages: 22
Registered: April 2013
Location: Switzerland
Junior Member
Thanks for your answer.

What would be the best place/moment to remove the bindings?

I tried to do it in a method @ProcessRemovals, in a class defined as lifeCycleURI, but then I cannot access the binding tables in the context...
Previous Topic:Reinjection on object removal
Next Topic:ChangeListener on MPartStack?
Goto Forum:
  


Current Time: Sat Sep 20 22:14:54 GMT 2014

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

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