Example
The following example shows how to map the Ctrl+Home key combination on the keyboard for a rich client application running in Eclipse RCP or Lotus® Expeditor. First, add the command tag for [home], and key tag for Ctrl+Home, to the plugin.xml file in the HATS RCP Runtime Extension plug-in as shown below:
<extension
point="org.eclipse.ui.commands">
...
<command
name="[home]"
category="com.ibm.hats.rcp.transformationCategory"
id="com.ibm.hats.rcp.send_[home]">
</command>
...
</extension>
<extension
point="org.eclipse.ui.bindings">
...
<key
commandId="com.ibm.hats.rcp.send_[home]"
contextId="com.ibm.hats.rcp.transformationContext"
configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="Ctrl+Home"
</key>
...
</extension>
Next, update the transformation view code so that
the view is aware that a new key mapping is registered in the plugin.xml
file. To do this, edit the MainView.java file in your project. This
file is located in the \Source\<project name>\views
folder under your project in the HATS Projects view. Double-click
on the MainView.java file to open it in the editor. Add the createKeyboardActions
method following the MainView method as shown below:
protected void createKeyboardActions() {
super.createKeyboardActions();
addKeyboardAction("[home]", "com.ibm.hats.rcp.send_[home]");
}| As with HATS Web applications, be aware that you cannot remap the Ctrl, Alt, and Shift modifier keys for HATS rich client applications. |
You can provide a way for your users to configure the default Eclipse keyboard preferences. This is normally configured from the menu bar using Window > Preferences > Workbench > Keys. If you provide this for your users, they will be able to override the key mappings defined in the HATS RCP Runtime Extension plug-in.