Cannot compose keyboardShortcut string

Post here questions and problems related to oXygen frameworks/document types.
msklvsk
Posts: 9
Joined: Wed May 04, 2016 2:53 pm

Cannot compose keyboardShortcut string

Post by msklvsk »

The docs tell to compose keyboardShortcut string for a plugin like this:
To compose string representations of the desired shortcut keys you can go to the Oxygen XML Developer Menu Shortcut Keys preferences page, press Edit on any action, press the desired key sequence and use the representation that appears in the Edit dialog box.
However, strings from the Edit dialog box doesn't work and doesn't look like those in example, e.g. in example plugin they are like "ctrl alt DOWN", but in Edit dialog box they are "M1+M3+↓" (I need universal keys, but neither do OS-specific work).
Latest everything, tried Mac/Win.
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: Cannot compose keyboardShortcut string

Post by Costin »

Hello,

Thank you for reporting this to us.

I hereby confirm that the valid Java string representations should look like "ctrl alt DOWN".
You can get the keys combination by going into oXygen menu Options > Menu Shortcut Keys and click "Edit" to edit the appropriate shortcut for the specific actions you need.

In the shortcut key editing dialog, tick the checkbox in front of the "Enable platform-independent shortcut keys" option to disable it, as indeed the OS-specific ones would not work.

Then you should replace the "+"s with spaces in order to obtain the correct format.

I have also logged an issue in our internal issue tracking system in order to have consistency between the example in the documentation and the shortcut key configuration in oXygen.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Radu
Posts: 9056
Joined: Fri Jul 09, 2004 5:18 pm

Re: Cannot compose keyboardShortcut string

Post by Radu »

Hi,

To add a little bit to that, in Oxygen 18.0 we added the possibility to register an action along with its default shortcut from a "Workspace Access" plugin extension type using a construct like:

ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.getActionsProvider().registerAction(actionKey, action, "M1 M3 Y")

The benefit of this new API is that the action will also be present in the Oxygen Menu Shortcut Keys list and the user will be able to modify its default shortcut from the application. Also the action accepts platform independent ways of specifying the modifiers where:

Code: Select all

   * <ul>
* <li>M1 represents the Command key on MacOS X, and the Ctrl key on other platforms.</li>
* <li>M2 represents the Shift key.</li>
* <li>M3 represents the Option key on MacOS X, and the Alt key on other platforms.</li>
* <li>M4 represents the Ctrl key on MacOS X, and is undefined on other platforms.</li>
* </ul>
so you may also consider at some point trying to migrate to this newer API way of doing things.

About this remark:
However, strings from the Edit dialog box doesn't work and doesn't look like those in example, e.g. in example plugin they are like "ctrl alt DOWN", but in Edit dialog box they are "M1+M3+↓" (I need universal keys, but neither do OS-specific work).
Latest everything, tried Mac/Win.
Indeed on Mac OSX the shortcut editor dialog shows symbols instead of the "serialized" key version, but on Windows it should show a shortcut version that you can use directly by replacing "+" with a space.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
msklvsk
Posts: 9
Joined: Wed May 04, 2016 2:53 pm

Re: Cannot compose keyboardShortcut string

Post by msklvsk »

registerAction() works fine and is indeed a better way to set a shortcut.
I struggled with plugin shortcut strings before because I was registering them to strings that were already taken by core actions.
Radu
Posts: 9056
Joined: Fri Jul 09, 2004 5:18 pm

Re: Cannot compose keyboardShortcut string

Post by Radu »

Hi,

Yes, indeed, we have so many already assigned shortcuts in Oxygen that's it's practically impossible to find a good unassigned shortcut :)

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply