close

Filter

loading table of contents...

Studio Developer Manual / Version 2107

Table Of Contents

7.10 Adding Shortcuts

Once an action is registered in the actionList of a container, a shortcut can easily be applied to it via the AddKeyboardShortcut. Continuing from the example code of the previous section, this looks like follows.

<editor:StudioPlugin ...>
  ...
  <editor:configuration>
    <editor:AddKeyboardShortcut
            shortcut="{resourceManager.getString(
              'com.coremedia.cms.editor.sdk.shortcuts.Shortcut',
              'Shortcut_my_action_key')}"
            description="{resourceManager.getString(
              'com.coremedia.cms.editor.sdk.shortcuts.Shortcut',
              'Shortcut_my_action_description')}"
            actionId="{MY_GLOBAL_ACTION_ID}"
            defaultEventAction="stopEvent"/>
    ...
  </editor:configuration>
</editor:StudioPlugin>

The example shows how a shortcut is registered for MyGlobalAction that is already registered.

Shortcuts are defined inside the properties file Shortcut.properties. For customizing existing shortcuts, a properties file has to be created that overrides the Shortcut.properties file via the following code snippet that can be added to the fx:Script section of your Studio plugin:

<fx:Script><![CDATA[
...
ResourceBundle.overrideProperties(
        ResourceManager.getInstance().getResourceBundle(null, "com.coremedia.cms.editor.sdk.shortcuts.Shortcut"),
        ResourceManager.getInstance().getResourceBundle(null, "com.coremedia.blueprint.studio.MyCustomShortcuts")
);
...
 ]]></fx:Script>

To ensure that the documentation for newly created shortcuts is generated automatically and shown in the Studio preferences dialog, the key values inside the properties file must match the following format:

Shortcut_<SHORTCUT_NAME>_key=<KEY_DEFINITION>
Shortcut_<SHORTCUT_NAME>_description=<SHORTCUT_DESCRIPTION>

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.