using Workspace java interface

Oxygen general issues.
BrianDrian
Posts: 6
Joined: Sat Oct 05, 2013 4:34 pm

using Workspace java interface

Post by BrianDrian »

java.net.URL url = new java.net.URL ("file:///" +filename);
ro.sync.exml.workspace.api.Workspace.open(url);

Hi I am trying to use the Workspace interface to open a file. I am getting Cannot make a static reference to the non-static method open(URL) from the type Workspace

How is it best to do this?
alex_jitianu
Posts: 1010
Joined: Wed Nov 16, 2005 11:11 am

Re: using Workspace java interface

Post by alex_jitianu »

Hello,

To use this API you must implement an Workspace Access extension plugin. Such a sample implementation is available at http://oxygenxml.com/oxygen_sdk.html#Developer_Plugins. Such a plugin extension has an applicationStarted() callback that receives an instance of StandalonePluginWorkspace that you can use to invoke the open method. Since the method is not static you can't invoke it the way you tried to invoke it.

More on the Workspace Access plugin:
http://www.oxygenxml.com/doc/ug-editor/ ... lugin.html

If you are trying to invoke this code from a framework level API then you can get to an Workspace instance by using AuthorAccess#getWorkspaceAccess(). Something like: authorAccess.getWorkspaceAccess().open(url).

Best regards,
Alex
BrianDrian
Posts: 6
Joined: Sat Oct 05, 2013 4:34 pm

Re: using Workspace java interface

Post by BrianDrian »

I took a look and plugins look to be trigger from a already open oxygen editor. What I want to do is run up oxygen from my application providing a list of xml files to be opened.
alex_jitianu
Posts: 1010
Joined: Wed Nov 16, 2005 11:11 am

Re: using Workspace java interface

Post by alex_jitianu »

Hi,

I see that you already got a hint for opening files from an external Java application on http://www.oxygenxml.com/forum/topic10128.html. I'm making a reference to that post so that anyone that comes to this thread sees the solution.

Alex
BrianDrian
Posts: 6
Joined: Sat Oct 05, 2013 4:34 pm

Re: using Workspace java interface

Post by BrianDrian »

This hint works, however the set of files I want to open is variable. I had to jump through a few hoops to get it to work in all cases. I could be useful to have oxygen scan the String[] array and just ignore nulls.

Anyway it works. btw thanks for the reply. I might add some plugins for my app.

Brian
Post Reply