Page 1 of 1

using Workspace java interface

Posted: Sat Oct 05, 2013 4:39 pm
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?

Re: using Workspace java interface

Posted: Mon Oct 07, 2013 2:53 pm
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

Re: using Workspace java interface

Posted: Mon Oct 07, 2013 10:37 pm
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.

Re: using Workspace java interface

Posted: Wed Oct 09, 2013 8:54 am
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

Re: using Workspace java interface

Posted: Fri Oct 11, 2013 5:40 pm
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