problem to create selection plugin : UUIDGenerator

Oxygen general issues.
relume
Posts: 6
Joined: Wed Aug 09, 2006 1:03 pm

problem to create selection plugin : UUIDGenerator

Post by relume »

Hello

I would like to create a selection plugin for oXygen to insert at the cursor position an UUID in the canonical format. For that purposes I have adapted the oXygen sample plugin UpperCase.

Code: Select all



file : UppercasePluginExtension.java
...
import ro.sync.exml.plugin.selection.SelectionPluginResultImpl;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
...
public SelectionPluginResult process(SelectionPluginContext context) {
String my UUID = "test";
// myUUID = UUIDGenerator.getInstance().generateRandomBasedUUID().toString();
return new SelectionPluginResultImpl(context.getSelection()+myUUID) ;
// return new SelectionPluginResultImpl(context.getSelection().toUpperCase());

}
...
As long as I am expanding the "context.getSelection()" string with an additional "normal" string content the plugin is working fine by calling it - the additional string is inserted to the cursor position. But if there is any call to the UUIDGenerator included/uncommented (see code below) the plugin compiles well (without any error), loads well in oXygen but does not work at all by calling it. The selection at the cursor position is neither replaced nor altered - just nothing happens - even no error message.

Code: Select all



file : UppercasePluginExtension.java
...
import ro.sync.exml.plugin.selection.SelectionPluginResultImpl;
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
...
public SelectionPluginResult process(SelectionPluginContext context) {
String my UUID = "test";
myUUID = UUIDGenerator.getInstance().generateRandomBasedUUID().toString();
return new SelectionPluginResultImpl(context.getSelection()+myUUID) ;
// return new SelectionPluginResultImpl(context.getSelection().toUpperCase());
}
...
Unfortunately as I am just a java newbie so it is hard for me to find out why the call to the UUIDGenerator will disturb the proper function of the plugin. For any hint I would be very grateful.

Many thanks in advance,

André
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello André,

Did you add the jar file containing the org.safehaus.uuid.UUIDGenerator class to the runtime section of plugin.xml ? The Uppercase plugin folder contains a plugin.xml file with a runtime element:

Code: Select all

<runtime>
<library name="lib/uppercase.jar"/>
</runtime>
Copy the jug-asl-2.0.0.jar to the lib subfolder of the Uppercase folder, add it to the runtime element and restart <oXygen/>:

Code: Select all

<runtime>
<library name="lib/uppercase.jar"/>
<library name="lib/jug-asl-2.0.0.jar"/>
</runtime>
Regards,
Sorin
relume
Posts: 6
Joined: Wed Aug 09, 2006 1:03 pm

Post by relume »

Hello Sorin

Thank you for your prompt response. No I did not add the "lib/jug-asl-2.0.0.jar" in the plugin.xml file. Now I have added it, but even after restarting oXygen the behavior of the plugin is the same as before. With the uncommented line where the UUIDGenrator is called the plugin does nothing. Is there any error.log of oXygen where also minor problems will be logged? As basis I have used the actual OxygenPluginsDevelopmentKit - is it also backward compatible with oXygen 6.2?

Thank you, with best regards,

André
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

The plugins included in the OxygenPluginsDevelopmentKit should work in all versions 6.x and 7.x. Please send your code as an archive to support at oxygenxml dot com. I will try to debug it.

Regards,
Sorin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Thank you for the files. In plugin.xml you have to replace

<library name="lib/jug-asl-2.0.0.jar"/>

with

<library name="lib/jug-lgpl-2.0.0.jar"/>

because this is the name of the jar in the lib folder of your plugin. I used in my test plugin the other jar provided by Safehaus, called jug-asl-2.0.0.jar but you use jug-lgpl-2.0.0.jar so you have to specify that in plugin.xml. With this change the plugin works in oXygen 6.2 and also in the latest version (7.2).

Regards,
Sorin
relume
Posts: 6
Joined: Wed Aug 09, 2006 1:03 pm

Post by relume »

Hello Sorin

Thank you very much for your work and help. I am sorry for my "stupid" inattention about the correct jug lib name, I have enlisted in the plugin.xml file. Now the plugin is working as expected.

Many thanks again and with best regards,

André
smitty
Posts: 3
Joined: Tue Sep 19, 2006 7:49 am

Post by smitty »

Hi André,

Can you make your plugin available to others? I have a need for a similar plugin, and I could make my own, but if one already exists and is available I would rather use that and spend my time on more meaningful things.

Smith
relume
Posts: 6
Joined: Wed Aug 09, 2006 1:03 pm

Post by relume »

smitty wrote:Hi André,

Can you make your plugin available to others? I have a need for a similar plugin, and I could make my own, but if one already exists and is available I would rather use that and spend my time on more meaningful things.

Smith
Hello Smith

Please download the plugin under the following link http://www.himmel-blau.com/downloads/pu ... rtUUID.zip as it is.

best regards, André
smitty
Posts: 3
Joined: Tue Sep 19, 2006 7:49 am

Post by smitty »

Thanks, André! Works well and was easy to install.
Post Reply