Page 1 of 1

add OptionListener to OptionStorage in wsaccess js plugin

Posted: Wed Jan 09, 2019 4:13 pm
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

Re: add OptionListener to OptionStorage in wsaccess js plugin

Posted: Thu Jan 10, 2019 12:31 pm
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

Re: add OptionListener to OptionStorage in wsaccess js plugin

Posted: Thu Jan 10, 2019 1:25 pm
by bk-one
hi radu,

thanks for your effort.
that would be great!

best wishes,
barbara