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.
Open the
fragment.e4xmi
in theclock.ui
project.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:Once the binding context has been imported, it can be used within a binding table. Click on Model Fragments and select Add to create a new fragment. Fill in the details as follows:
Extended Element ID:
org.eclipse.e4.legacy.ide.application
Feature Name:
bindingTables
In the BindingTable element, choose the
org.eclipse.ui.contexts.dialogAndWindow
context. This will ensure that the key binding is available in all windows and dialogs:Click on...