[oXygen-user] Plugin config, plugin dir, and API

Oxygen XML Editor Support support at oxygenxml.com
Mon Feb 27 03:50:13 CST 2012


Hi Florent,

Well, to my shame it seems we already have a way.

I looked more closely at the API and it seems we already have a method 
called:

> ro.sync.exml.plugin.PluginDescriptor.getBaseDir()

So from a custom 
ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension 
implementation you could use code like this:

> WorkspaceAccessPlugin.getInstance().getDescriptor().getBaseDir()

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 2/25/2012 3:26 PM, Florent Georges wrote:
> Oxygen XML Editor Support wrote:
>
>    Hi,
>
>> We do not yet have such support of setting pairs of key/value in the
>> plugin.xml and then making them available to the Plugin Java
>> classes.  But it seems like an interesting improvement in order to
>> control some configuration of a plugin without making changes in the
>> Java code so we'll look into it.
>
>    Thanks.  Actually, if we could have the current plugin directory, it
> would be very easy to implement such a feature.  Either with property
> files, or even better with, you know, XML files...
>
>>>    My second (related) question is: how can we get the plugin dir
>>> via the API?  And how to resolve resources in that dir?
>
>> Well, you could use the class loader to see from where the main
>> plugin JAR library was loaded.
>> [...]
>> Another approach would be to find out the location where Oxygen is
>> installed using code like:
>> [...]
>> and then append a "plugins/your-plugin-name" to that path.
>
>    Thanks!  I use the second approach, as it looks like more robust,
> even though it requires to hard-code the plugin name in Java.  The
> ideal solution would be to improve the API (e.g. on Plugin or
> PluginExtension) with a new method like:
>
>      public File getPluginDir();
>
>>>    Congrats for the SDK!  Starting a new plugin is very easy! (even
>>> though I still have to investigate more deeply the APIs :-p)
>
>> If you find any quirks or have trouble finding certain APIs please
>> do not hesitate to contact us.
>
>    I will ;-)
>
>    Thanks for your response,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/
>


More information about the oXygen-user mailing list