problem to create selection plugin : UUIDGenerator

<oXygen/> general issues.
relume
Posts: 4

problem to create selection plugin : UUIDGenerator

Wed Aug 09, 2006 1:33 pm

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: 4144

Wed Aug 09, 2006 2:31 pm

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: 4

Wed Aug 09, 2006 3:16 pm

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: 4144

Wed Aug 09, 2006 3:46 pm

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: 4144

Thu Aug 10, 2006 1:06 pm

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: 4

Thu Aug 10, 2006 1:35 pm

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

Tue Nov 14, 2006 2:27 am

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: 4

Tue Nov 14, 2006 10:22 am

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/public/oXygen/oXygen_insertUUID.zip as it is.

best regards, André
smitty
Posts: 3

Tue Nov 14, 2006 6:31 pm

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

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest