Lock check

Oxygen general issues.
Srinarayan
Posts: 42
Joined: Tue Jun 08, 2021 3:27 pm

Lock check

Post by Srinarayan »

Hi team,

I am making a java plugin for oxygen. I want to know if there is a way to check in java whether the document currently opened in oxygen author is locked or not?

Regards
Srinarayan
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Lock check

Post by Radu »

Hi Srinarayan,

What do you mean by "locked"? From what storage system is the XML document loaded? If it's loaded from your own content management system you can write your own code which decides if the XML is locked or not.
If the XML document is not editable you can use the API "ro.sync.exml.workspace.api.editor.WSEditor.isEditable()" to check that.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Srinarayan
Posts: 42
Joined: Tue Jun 08, 2021 3:27 pm

Re: Lock check

Post by Srinarayan »

Hi Radu,

I have seen an example of using the API but I am not sure how we can get the output from the operation.
The example :

this.editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation', {
fragment: '&lt;' + 'xref href="' + text + '"/>'
}, callback);

Can you please tell me how to use the API "ro.sync.exml.workspace.api.editor.WSEditor.isEditable()" in a WebAuthor Plugin?

Regards,
Srinarayan
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Lock check

Post by cristi_talau »

Hello,

We have a tutorial for a similar use-case: https://www.oxygenxml.com/maven/com/oxy ... esult.html . Please let me know if you need more information.

Best,
Cristian
Srinarayan
Posts: 42
Joined: Tue Jun 08, 2021 3:27 pm

Re: Lock check

Post by Srinarayan »

Hello,

In my Java plugin, to check if the editor is editable or not, I used a deprecated method AuthorAccess.getEditorLocation() and then used the URL I got from this in AuthorAccess.getWorkspaceAccess().getEditorAccess(URL).isEditable().

If AuthorAccess.getEditorLocation() is deprecated then is there a better alternative? This method kind of makes it easier, so what does oxygen recommend me to use if not this API?

Regards
Srinarayan
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Lock check

Post by cristi_talau »

Hello,

The recommended alternative is to use authorAccess.getEditorAccess().getEditorLocation().

Best,
Cristian
Post Reply