Friday 3 August 2012

Binding a key sequence with an action in eclipse

Actions and Commands are two different things in eclipse plug-in/ RCP. Both have different mechanisms. Information related to binding keys to a command are easily available but if you want to bind an action to shortcut keys, you have to shed some sweat before you can get any helpful information. That’s why I have decided to do this blog post. It'll serve me as a book mark. If you have found this post to be useful do let me know.

The reality is you cant just bind shortcut keys to an action. You have to write a command for that too.  Which means you have an action, a command and a binding in your plugin.xml file.

In the definition id attribute of action specify the command ID of your command specified to your action. And in the command id of binding write the command id of command again.
That way when you press the keys your action will get executed.

Hope that helps

ge33ek

No comments:

Post a Comment