eclipseeclipse-plugineclipse-rcp

How to find a command ID for a key binding in Eclipse?


In Eclipse (3.x for that matter) you can use the Plug-in Spy and Menu Selection Spy to find out information about UI elements which are accessible via the mouse.

I am now facing the problem that I want to find out about the command (I need the command id) which is triggered by a certain key binding, because I want to create a menu item for this command in my custom UI (view/editor)).

In my concrete case I am looking for the Expand All children command which is triggered by Numpad+Plus in a common navigator. However, I am interested in a general way to find out about key bindings.

I know that I can access the key bindings via the preferences dialog or the key binding QuickView (CTRL+SHIFT+L in Windows); but there, I can only find out about the command name, not the ID or the contributing plug-in of the command.


Solution

  • You can use the Eclipse Search / Plug-in Search to search for an extension point. In this case search for org.eclipse.ui.bindings to see the key bindings: Search dialog

    The search will give to a list of plug-ins, open a list item to see the plugin.xml for the plug-in with the extension point highlighted. You will have to search through the plug-ins and entries to find what you want.

    The Expand All key binding is defined in the org.eclipse.ui plug-in and has command id org.eclipse.ui.navigate.expandAll

    You may need to check the Include all plug-ins from target in Java search in Preferences > Plug-in Development to get the search to look in the target platform (which needs to be Eclipse).