Time for action – binding commands to keys

Hooking up the command to a keystroke requires a KeyBinding. This allows a key (or series of keys) to be used to invoke the command instead of only via the menu. KeyBindings are set up inside a Binding Table and associated with a Binding Context.

  1. Open the fragment.e4xmi in the clock.ui project.
  2. In the imports, select the Binding Context from the dropdown and click on Add. In the Reference-ID, click on Find… and a dialog will be shown with the contexts. Choose the org.eclipse.ui.contexts.dialogAndWindow context:
    Time for action – binding commands to keys
  3. Once the binding context has been imported, it can be used within a binding table. Click on Model ...

Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.