Contexts and key bindings

A context can be specified for a key binding so that the binding is only available when the user is working within a specific context. Contexts are declared in the org.eclipse.ui.contexts extension point.

A context can be bound to a key binding by specifying the id of the context when the key binding is defined. For example, if we only wanted the save command to work while the user is editing text, we could specify a context for the key binding:

<extension
         point="org.eclipse.ui.bindings">
  <key
      sequence="Ctrl+S"
      commandId="org.eclipse.ui.file.save"
      contextId="org.eclipse.ui.textEditorScope"
      schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
  </key>
</extension>
...
(See Contexts) for a more detailed discussion of contexts and how they are defined.