get Value of Custom Editor Variable in JSOperation
Oxygen general issues.
-
- Posts: 19
- Joined: Mon Sep 13, 2021 10:41 am
get Value of Custom Editor Variable in JSOperation
Hello,
I added a custom Editor variable and want to use it in an JSOperation Action. I try to understand the solution of the wsAccess github. But how far I understand, because I am not a Java programmer, with I add a custom editor variable.
I searched and searched the total API for a getCustomEditorVariable(string) method or function.
Please help.
Thank you very much.
Greets Lars
I added a custom Editor variable and want to use it in an JSOperation Action. I try to understand the solution of the wsAccess github. But how far I understand, because I am not a Java programmer, with
Code: Select all
addCustomEditorVariablesResolver
I searched and searched the total API for a getCustomEditorVariable(string) method or function.
Please help.
Thank you very much.
Greets Lars
-
- Posts: 19
- Joined: Mon Sep 13, 2021 10:41 am
Re: get Value of Custom Editor Variable in JSOperation
I did find the solution.
Interesting that the name is 'expand'.
Code: Select all
var utilAccess = authorAccess.getUtilAccess();
var myVar = utilAccess.expandEditorVariables("${myVar}", null);
Packages.javax.swing.JOptionPane.showMessageDialog(parentFrame, myVar);
Last edited by larsS on Wed Jun 07, 2023 6:39 pm, edited 1 time in total.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: get Value of Custom Editor Variable in JSOperation
Hi,
Thanks for posting the solution.
I assume you added the editor variables resolver from a Javascript-based Oxygen plugin, right? Like in this sample:
https://github.com/oxygenxml/wsaccess-j ... sAccess.js
Yes, the way in which you expand the editor variable using our API in the Javascript operation looks fine to me.
About this remark:
Regards,
Radu
Thanks for posting the solution.
I assume you added the editor variables resolver from a Javascript-based Oxygen plugin, right? Like in this sample:
https://github.com/oxygenxml/wsaccess-j ... sAccess.js
Yes, the way in which you expand the editor variable using our API in the Javascript operation looks fine to me.
About this remark:
Were you expecting another name for the method? Maybe "resolve"? I think you may be right but as this is API we will probably leave the name of the method as it isInteresting that the name is 'expand'.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 19
- Joined: Mon Sep 13, 2021 10:41 am
Re: get Value of Custom Editor Variable in JSOperation
Hello Radu,
I don't want to be rude. Sorry for the maybe not so kind words. English is not my native language and as I said, I am not a Java developer.
As I understand it, the resolver is more of a setter for resolving an object/class that is passed to the method and adds a new editor variable to the "scope".
I didn't understand it to do this permanently or only in the current session, like a local store in browsers. This would be my only future question.
As extender I interpret a method that interpolate or enlarge an existing scope and does not get the value of a variable.
But if the functionality or the naming is according to Java conventions then it's probably because extend means something like unfold or expand and this I do not or did not know before.
Thank you very much for your time to answer.
I don't want to be rude. Sorry for the maybe not so kind words. English is not my native language and as I said, I am not a Java developer.
As I understand it, the resolver is more of a setter for resolving an object/class that is passed to the method and adds a new editor variable to the "scope".
I didn't understand it to do this permanently or only in the current session, like a local store in browsers. This would be my only future question.

As extender I interpret a method that interpolate or enlarge an existing scope and does not get the value of a variable.
But if the functionality or the naming is according to Java conventions then it's probably because extend means something like unfold or expand and this I do not or did not know before.
Thank you very much for your time to answer.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: get Value of Custom Editor Variable in JSOperation
Hi,
Please see some answers below:

https://www.oxygenxml.com/InstData/Edit ... sResolver-
By default Oxygen knows how to expand these editor variables:
https://www.oxygenxml.com/doc/versions/ ... ables.html
Regards,
Radu
Please see some answers below:
There is no rudeness in discussing our APIs, we are happy to receive feedback.I don't want to be rude. Sorry for the maybe not so kind words.
Neither for usEnglish is not my native language

Oxygen is a Java application, our API is Java based and most plugins are implemented in Java, so most of plugin developers would use Java to implement Oxygen plugins, but indeed we have this possibility to use Javascript to implement an Oxygen plugin.and as I said, I am not a Java developer.
Basically from Javascript when someone adds an editor variables resolver, this API method will be called from our Java API:As I understand it, the resolver is more of a setter for resolving an object/class that is passed to the method and adds a new editor variable to the "scope".
https://www.oxygenxml.com/InstData/Edit ... sResolver-
An Oxygen plugin is instantiated when Oxygen starts up and is active while Oxygen is running. The plugin runs in the entire application context. So if I add from a plugin an EditorVariablesResolver, if you call from any opened document the "utilAccess.expandEditorVariables" API, the resolver will be used when expanding editor variables..I didn't understand it to do this permanently or only in the current session, like a local store in browsers. This would be my only future question.
The method name is "expandEditorVariables", I think "expand" is appropriate for it as if takes a string containing one or multiple editor variables and it replaces the editor variables with their values.As extender I interpret a method that interpolate or enlarge an existing scope and does not get the value of a variable.
But if the functionality or the naming is according to Java conventions then it's probably because extend means something like unfold or expand and this I do not or did not know before.
By default Oxygen knows how to expand these editor variables:
https://www.oxygenxml.com/doc/versions/ ... ables.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service