Page 1 of 1

problem to create selection plugin : UUIDGenerator

Posted: Wed Aug 09, 2006 1:33 pm
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é

Posted: Wed Aug 09, 2006 2:31 pm
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

Posted: Wed Aug 09, 2006 3:16 pm
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é

Posted: Wed Aug 09, 2006 3:46 pm
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

Posted: Thu Aug 10, 2006 1:06 pm
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

Posted: Thu Aug 10, 2006 1:35 pm
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é

Posted: Tue Nov 14, 2006 2:27 am
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

Posted: Tue Nov 14, 2006 10:22 am
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é

Posted: Tue Nov 14, 2006 6:31 pm
by smitty
Thanks, André! Works well and was easy to install.