Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [Bindings] Removing a key-binding
[Bindings] Removing a key-binding [message #654605] Wed, 16 February 2011 13:31 Go to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
Actually, redefining a key binding is easy by providing a ney key
extension for the extension point org.eclipse.ui.bindings. Now I have
the following problem: Sometimes a pre-defined key-binding is just ugly,
e.g. I consider the pre-defined key-binding for the CollapseAll handler
as "ugly", "M1+M2+NUMPAD_DIVIDE" is just a mess. In this case it would
be ideal for us, if this Handler would not provide *any* key-binding at
all. But according to the extension point definition
org.eclipse.ui.bindings#key the value is required. Does there exist an
officially supported mechanism to remove a key-binding or replacing it
my something that corresponds to 'no-binding-at-all' magic?

Thanks & Greetings from Bremen,

Daniel Krügler
Re: [Bindings] Removing a key-binding [message #654712 is a reply to message #654605] Wed, 16 February 2011 18:54 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You cannot mark a command that way, but you can delete a specific
keybinding in a specific context:

copy out the Collapse All keybinding, and simply remove the commandId
.... that will wipe out that binding.

But with a delete marker at the same level provided by a plugin.xml
(considered SYSTEM) only users would be able to bind that key sequence
to something more useful (with a few minor exceptions)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: [Bindings] Removing a key-binding [message #654800 is a reply to message #654712] Thu, 17 February 2011 08:41 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2011-02-16 19:54, Paul Webster wrote:
> You cannot mark a command that way, but you can delete a specific
> keybinding in a specific context:
>
> copy out the Collapse All keybinding, and simply remove the commandId
> ... that will wipe out that binding.

OK, that worked, thanks!

> But with a delete marker at the same level provided by a plugin.xml
> (considered SYSTEM) only users would be able to bind that key sequence
> to something more useful (with a few minor exceptions)

I have problems to follow you here, could you elaborate, please?

1) Is the "delete marker" the above mentioned keybinding registration
that omits the commandId?

2) I don't understand, in which sense "SYSTEM" and "users" are entering
the game here.

Do you want to describe that by doing above effective removal of the
key-binding "M1+M2+NUMPAD_DIVIDE" I can never reassign this binding to
another command?

Thanks & Greetings from Bremen,

- Daniel Krügler
Re: [Bindings] Removing a key-binding [message #654884 is a reply to message #654800] Thu, 17 February 2011 13:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 02/17/2011 03:41 AM, Daniel Krügler wrote:
> 1) Is the "delete marker" the above mentioned keybinding registration
> that omits the commandId?

yes

> 2) I don't understand, in which sense "SYSTEM" and "users" are entering
> the game here.

Anything that comes in through plugin.xml is SYSTEM. Anything changed
in the keys preference page is USER.


> Do you want to describe that by doing above effective removal of the
> key-binding "M1+M2+NUMPAD_DIVIDE" I can never reassign this binding to
> another command?

right now you have:

binding1: M1+M2+NUMPAD_DIVIDE collapseAll
org.eclipse.ui.contexts.window
org.eclipse.ui.defaultAcceleratorConfiguration SYSTEM

binding2: M1+M2+NUMPAD_DIVIDE <delete-no-id>
org.eclipse.ui.contexts.window
org.eclipse.ui.defaultAcceleratorConfiguration SYSTEM


binding2 will delete any bindings that match the other attributes (same
scheme, same context, same key sequence, etc).

It just means that you can't re-assign it in your plugin.xml to another
command in org.eclipse.ui.contexts.window
org.eclipse.ui.defaultAcceleratorConfiguration

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: [Bindings] Removing a key-binding [message #654908 is a reply to message #654884] Thu, 17 February 2011 14:52 Go to previous message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2011-02-17 14:57, Paul Webster wrote:
> On 02/17/2011 03:41 AM, Daniel Krügler wrote:
>> 1) Is the "delete marker" the above mentioned keybinding registration
>> that omits the commandId?
>
> yes
>
>> 2) I don't understand, in which sense "SYSTEM" and "users" are entering
>> the game here.
>
> Anything that comes in through plugin.xml is SYSTEM. Anything changed in
> the keys preference page is USER.
>

OK, I understand - even though I never have looked at it with such roles
in my mind.

>> Do you want to describe that by doing above effective removal of the
>> key-binding "M1+M2+NUMPAD_DIVIDE" I can never reassign this binding to
>> another command?
>
> right now you have:
>
> binding1: M1+M2+NUMPAD_DIVIDE collapseAll org.eclipse.ui.contexts.window
> org.eclipse.ui.defaultAcceleratorConfiguration SYSTEM
>
> binding2: M1+M2+NUMPAD_DIVIDE <delete-no-id>
> org.eclipse.ui.contexts.window
> org.eclipse.ui.defaultAcceleratorConfiguration SYSTEM
>
>
> binding2 will delete any bindings that match the other attributes (same
> scheme, same context, same key sequence, etc).
>
> It just means that you can't re-assign it in your plugin.xml to another
> command in org.eclipse.ui.contexts.window
> org.eclipse.ui.defaultAcceleratorConfiguration

Thanks for your thorough explanation, Paul - it was very helpful.

- Daniel
Previous Topic:Master/Detail with Interface
Next Topic:Migrating from 3.3 to 3.6
Goto Forum:
  


Current Time: Tue Sep 16 07:31:42 GMT 2014

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

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