Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

FAQ How do I create my own key-binding configuration?

Revision as of 19:11, 17 December 2008 by Eclipse.voom.net (Talk | contribs) (Added introductory paragraph, updated to match Eclipse 3.4. However, I do not understand what file this keyConfiguration goes into, so this article is still incomplete.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A keyboard shortcut (key binding) defines a key that when pressed will execute an Eclipse command. Keyboard shortcuts are organized into independent sets called key configurations or schemes. The user chooses the key configuration that emulates the shortcut keys of his or her favorite editor or IDE.

To see the current key configuration and its keyboard shortcuts, choose the Window > Preferences menu command to open the Eclipse workbench Preferences. Select the General > Editor > Keys page. This page displays the currently active Scheme (key configuration) and the keyboard shortcuts it defines. Emacs is a set of keyboard shortcuts that emulates emacs. Similarly, Microsoft Visual Studio defines a set of shortcuts that emulates that IDE. The native configuration for Eclipse is Default.

There are no APIs for defining key-binding configurations programmatically, but you can create them in a plug-in by using the org.eclipse.ui.commands extension point. First, you need to define your new configuration:

   <keyConfiguration
      name="My Configuration"
      parent="org.eclipse.ui.defaultAcceleratorConfiguration"
      description="This is a simple configuration"
      id="org.eclipse.faq.sampleConfiguration">
   </keyConfiguration>

By specifying a parent, you are saying that your configuration should inherit key bindings from the parent unless they are explicitly set in your configuration. When key bindings are defined, they will refer to the configuration they belong to. If you write your own configuration, you&#146;ll also need to define new key bindings for all the commands that you want to belong to your configuration.

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.