[oXygen-user] Feedback on experimental plugin features.

Michael Anthony Smith
Thu Mar 3 10:11:03 CST 2011


I have now made use of four of the experimental oXygen plugin workspace 
API options (on a Mac running OS X - Snow Leopard) :

(1) getOptionsStorage -  This has a straightforaward interface, which 
worked as expected.
(2) createNewEditor - This was slightly more awkward to use in our 
plugin's context (more details below).
(3) getEntityResolver - Works as expected (thanks).
(4) getURIResolver - Appears to works as expected (but currently, not 
tested).

I have managed to get the 'createNewEditor' API call to create a fresh 
document that is considered to be modified, using the following code:

    Writer writer = new StringWriter();
    ...
    // Write to the string.
    ...
    URL url= workspace.createNewEditor("xml", "text/xml",
    writer.toString());
    WSEditor ed=workspace.getEditorAccess(url,
    StandalonePluginWorkspace.MAIN_EDITING_AREA);
    ed.setModified(true);


Observations:

(1) This approach may be problematic for big documents, as the whole 
document is stored in a string.
(2) The created document is not marked as modified.

There are at least two ways of addressing the first of these points. One 
approach is to create a small blank document that is then overridden 
using the WSEditod's realoadContent(Reader). Here, the question I had 
was: what is the minimal XML document that can be overridden (and get 
the right document type association - e.g. DITA)? It might be that 
oXygen could automatically create such a document from the first two 
arguments of the createNewEditor method.

A second approach could be to replace the third argument of the 
createNewEditor method with a java.io.Reader argument, such as is used 
when reloading a document into an existing WSEditor 
(editor.reloadContent(reader)).

Overall, I am pleased with these experimental enhancements.

Regards,
Anthony.

-- 

-- -------------------------------------------------------------------------
Michael Anthony Smith, DeltaXML Ltd "Change control for XML"
T: +44 1684 578751   E:    http://www.deltaxml.com
Registered in England 02528681 Reg. Office: Monsell House, WR8 0QN, UK

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20110303/0fb65e9e/attachment.html 


More information about the oXygen-user mailing list