QAPI actions: keyboard accelerators and toolbar icons

2.61K viewsGeneral Discussion
0

Hi. I have experimented with actions last week, and found some interesting features. As an example, keyboard accelerators are very useful, but in plugin.xml you have to set the ‘accelerator’ attribute in ‘action’ elements with this syntax:
accelerator=”control F9″ (multiple keys separated by spaces)
(not “Ctrl+F9” as you would normally do in the eclipse environment). Under mac osx, the command (apple) key is indicated by “meta”. Other tokens for key modifiers are “alt” and “shift”. I have not figured out how to set different key-sequences for win and mac versions.
I also could not figure out what I am missing in order to have icons shown for toolbar buttons. I enclose a simple plugin showing my attempt.
Thanks in advance for any hint.

0

Hi Brian, thank so much for your prompt response.
As to icons, I found some problems declaring a “/” library in plugin.xml (quantrix launch hangs and plugin not loaded). I resorted to compiling the icon files in the main jar file, and this works.
Thanks also for the directions on accelerators. I will provide two different plugin.xml versions to win and mac users.
Bye

0

Hi Luca,

There are several issues here.
1. The icon issue. The icon is found by using the bundle classpath for the bundle. The only path in the bundle is the lucaActions.jar file. You will need to add the root path “/” to the class path. While we now recommend using the eclipse standard MANIFEST.MF file, you can do this in the plugin.xml by adding the following fragment.
<library name=”/”>
<export name=”*”>
</export>
</library>
2. The accelerators. When the qapi action extension point was written, we decided to use the syntax used by the javax.swing.KeyStroke class. See the documentation for KeyStroke.getKeyStroke(String). Unfortunately it is not very platform independent as you pointed out. In our QDK actions we have a specific attribute for the osxaccelerator, which should be ported to the qapi action extension point. I will file an issue to that effect.

Thank you for your support of Quantrix. Hope this addresses your questions.

Brian Cabana
Software Developer
Quantrix