## Workbench key bindings

The workbench defines many keyboard accelerators for invoking common actions with the keyboard. In early versions of the platform, plug-ins could define the accelerator key to be used for their action when the action was defined. However, this strategy can cause several problems:

- Different plug-ins may define the same accelerator key for actions that are not related.
- Plug-ins may define different accelerator keys for actions that are semantically the same.
- Plug-ins may define accelerator keys that later conflict with the workbench (as the workbench is upgraded).

In order to alleviate these problems, the platform defines a configurable key binding strategy that is extendable by plug-ins. It solves the problems listed above and introduces new capabilities:

- The user can control which key bindings should be used.
- Plug-ins can define key bindings that emulate other tools that may be familiar to users of the plug-in.
- Plug-ins can define contexts for key bindings so that they are only active in certain situations.

The basic strategy is that plug-ins use commands to define semantic actions. Commands are simply declarations of an action and its associated category. These commands can then be associated with key bindings, actions, and handlers. Commands do not define an implementation for the action. When a plug-in defines an action for an editor, action set, or view, the action can specify that it is an implementation of one of these commands. This allows semantically similar actions to be associated with the same command.

Once a command is defined, a key binding may be defined that references the command. The key binding defines the key sequence that should be used to invoke the command. A key binding may reference a scheme which is used to group key bindings into different named schemes that the user may activate via the Preferences dialog.

This is all best understood by walking through the workbench and looking at how commands and key bindings are declared. We'll look at all of this from the point of view of defining key bindings for existing workbench actions.

See the org.eclipse.ui.bindings section for simple binding scenarios and the Basic workbench extension points using commands section for using the new command framework.