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

Florent Georges lists at fgeorges.org
Sat Feb 25 07:26:43 CST 2012


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