add OptionListener to OptionStorage in wsaccess js plugin

Post here questions and problems related to oXygen frameworks/document types.
bk-one
Posts: 13
Joined: Mon Oct 23, 2017 3:42 pm

add OptionListener to OptionStorage in wsaccess js plugin

Post by bk-one »

hi,

has somebody in the oxygen team successfully added an OptionListener to the optionStorage in an javascript based wsaccess plugin?

best wishes,
barbara
Radu
Posts: 9053
Joined: Fri Jul 09, 2004 5:18 pm

Re: add OptionListener to OptionStorage in wsaccess js plugin

Post by Radu »

Hi Barbara,

Right, the "ro.sync.exml.workspace.api.options.WSOptionListener" abstract class has a constructor which needs to be passed the key as an argument:

https://www.oxygenxml.com/InstData/Edit ... tener.html

and I also cannot find a way to do this from the Javascript code.
If you want I can try to add on our side of the code a default constructor for "WSOptionListener" and an extra method "setKey", in this way the Javascript which would add the listener:

Code: Select all

  optionsListener = {
optionValueChanged: function (event) {
}
}
adapter = new JavaAdapter(Packages.ro.sync.exml.workspace.api.options.WSOptionListener, optionsListener);
adapter.setKey("myKey");
pluginWorkspaceAccess.getOptionsStorage().addOptionListener(adapter);
Would it help you if I made these changes to the "WSOptionListener" class (default constructor and "setKey" method) available for Oxygen 21 (February 2019)?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
bk-one
Posts: 13
Joined: Mon Oct 23, 2017 3:42 pm

Re: add OptionListener to OptionStorage in wsaccess js plugin

Post by bk-one »

hi radu,

thanks for your effort.
that would be great!

best wishes,
barbara
Post Reply