Page 1 of 1

How to add a java-based action

Posted: Wed Dec 04, 2013 5:29 pm
by fsteimke

we have to extend oxygen with a new, java-based action. I'd like to keep it as simple as possible and need a hint where to start.

We have to manage a list of UNICODE Characters together with some properties. We made a simple schema and a document instance, something like this:

Code: Select all

<char codepoints="000A" subcategory="CONTROL" name="LINE FEED" blockName="BASIC_LATIN"/>
<char codepoints="000D" subcategory="CONTROL" name="CARRIAGE RETURN" blockName="BASIC_LATIN"/>
(In reality there are much more properties, only some of them from unicode character database).

I'd like to extend Oxygen, so that, after choosing a new menu item, a form pops up where i can enter the hexcode of a new charcter. After doing so a new text fragment for the character shall be generated and inserted, with properties filled from some JAVA Code (UNICODE Properties of JAVA char datatype).

Im pretty sure this can be done, but where to start? Is it a Oxygen plugin, or is it something for authors SDK? Do you have samples which behave similar, so that i could learn from them? The whole thing could be done in text view as well as in author view.

Thanks in advance,

Re: How to add a java-based action

Posted: Thu Dec 05, 2013 1:20 pm
by Radu
Hi Frank,

Do you use a custom XML vocabulary? Have you already defined a framework/document type for it?
If so, you can use our Author SDK: ... horing_SDK

to create a new custom Java-based operation which extends ro.sync.ecss.extensions.api.AuthorOperation. Your operation would read the XML file containing all characters, create a swing based-dialog, show it to the user and then use our ro.sync.ecss.extensions.api.AuthorDocumentController API to insert the text in the Author editor mode at the caret position.
Something like: ... HowTo.html

Once created the custom Java operation gets bundled in a JAR library which is contributed to the classpath of your custom document type.
Then you can create an action for it and add it to the toolbar, main or contextual menu: ... olbar.html


Re: How to add a java-based action

Posted: Thu Dec 05, 2013 1:24 pm
by Radu
As an update on my previous post, I noticed your last remark in the post:
The whole thing could be done in text view as well as in author view.
The Author SDK can create operations only for the Author visual editing mode.
If you want a toolbar action to be used both in the Text and Author modes you will need to go another way and implement a Workspace Access plugin using our Plugins SDK: ... er_Plugins

There is a sample "Workspace Access" plugin in the Plugins SDK. Such a plugin can contribute either with a custom toolbar to Oxygen or with an action to an already existing Oxygen toolbar. When invoked, the action could look and see what editor is currently selected and depending on the mode in which it is opened (Text or Author) use the API (which differs) to make changes to the editor content.