[oXygen-user] Buffer-related questions (when opened from plugin)

Oxygen XML Editor Support support at oxygenxml.com
Thu Jun 14 09:31:53 CDT 2012


Hi Florent,

You could implement a HashMap in your WorkspaceAccessPluginExtension 
which would keep that flag for a certain URL for which you wanted the 
open operation to work.

Is that boolean flag somewhat related to whether the URL was opened for 
editing or read-only by the user?

If so you might consider adding a parameter to the URL string like:

> protocol://host/path/to/resource.xml?read-only=true

In this way the information would be saved in the URL itself and if you 
have a custom URLHandler the information would get also passed to the 
handler because it will be able to read the parameter from the URL.

You can add more than one parameter to specify different choices that 
the user made when opening the URL, this is a good method to pass 
parameters to the URLHandler.

As for this question:

> 2/ to
> specify a method to be called before closing the buffer (kind of a
> buffer listener, so I can do some treatment before closing it)?

So you want some kind of a listener to notify you before an opened 
editor is closed, right?

You have this API method:

> ro.sync.exml.workspace.api.PluginWorkspace.addEditorChangeListener(WSEditorChangeListener, int)

and the listener has these interesting methods which can be overridden:

> ro.sync.exml.workspace.api.listeners.WSEditorChangeListener.editorAboutToBeClosed(URL)

This method would actually allow you to reject the close if some 
condition is not fulfilled (if the user did not save or did not check in 
for example).

and:

> ro.sync.exml.workspace.api.listeners.WSEditorChangeListener.editorClosed(URL)

Regards,
Radu

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

On 6/14/2012 4:45 PM, Florent Georges wrote:
>    Hi,
>
>    When opening a buffer from within a plugin (using Workspace.open()),
> is there any way to 1/ attach a specific value to the buffer (kind of
> a buffer-scoped variable, in my case just a boolean flag) and 2/ to
> specify a method to be called before closing the buffer (kind of a
> buffer listener, so I can do some treatment before closing it)?
>
>    Regards,
>


More information about the oXygen-user mailing list