Page 1 of 1

Lock check

Posted: Mon Oct 04, 2021 1:33 pm
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

Re: Lock check

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

Re: Lock check

Posted: Tue Oct 05, 2021 3:05 pm
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: '<' + '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

Re: Lock check

Posted: Wed Oct 06, 2021 12:30 pm
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

Re: Lock check

Posted: Wed Oct 06, 2021 2:43 pm
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

Re: Lock check

Posted: Wed Oct 06, 2021 3:05 pm
by cristi_talau
Hello,

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

Best,
Cristian