Accelerator sets

The association between an action definition and the key combinations that should invoke the action is called an accelerator.  An accelerator set is a list of accelerators.  Plug-ins can contribute accelerator sets using the org.eclipse.ui.acceleratorSets extension point.  The workbench defines an accelerator set that provides emacs-like key bindings: 

<extension
      point="org.eclipse.ui.acceleratorSets">
   <acceleratorSet
         scopeId="org.eclipse.ui.globalScope"
         configurationId="org.eclipse.ui.emacsAcceleratorConfiguration">
      <accelerator
            key="Ctrl+F4||Ctrl+X Ctrl+K"
            id="org.eclipse.ui.file.close">
      </accelerator>
      <accelerator
            key="Ctrl+Shift+F4||Ctrl+X Ctrl+C"
            id="org.eclipse.ui.file.closeAll">
      </accelerator>
      <accelerator
            key="Ctrl+X Ctrl+S"
            id="org.eclipse.ui.file.save">
      </accelerator>
      ...

There is our friend org.eclipse.ui.file.save.  Recall our hypothetical action definition:

<extension point = "org.eclipse.ui.actionSets">
	   <actionSet id="com.example.actions.actionSet"
		   label="Example Actions"
		   visible="true">
		   <action id="com.example.actions.action1"
			   menubarPath="additions"
			   label="Example Save Action"
			   class="org.example.actions.ExampleActionDelegate"
			   definitionID="org.eclipse.ui.file.save">
		   </action>
		   ...
	   </actionSet>
</extension>

When our example action set is active, our save action will be invoked when the user chooses Ctrl+X followed by Ctrl+S. (The use of ||, such as "Ctrl+Shift+F4||Ctrl+X Ctrl+C" indicates that either key combination can be used to activate the action.)

Likewise, when the workbench SaveAction is active, the same key combinations will invoke it instead, since the workbench used the same action definition id for the SaveAction.

To complete the example, we need to understand what the scopeID and configurationId are all about.  Let's tackle configurations first.

Copyright IBM Corp. and others 2000,2002.