access preferences through API
Oxygen general issues.
-
- Posts: 19
- Joined: Mon Aug 15, 2011 10:57 am
access preferences through API
Hi.
Oxygen provides the feature called "Highlight elements near caret". Though we use different background colors in our framework this feature can become confusing, because it messes with the background colors of the elements at the caret position.
The feature can be easily disabled in the Options->Preferences - Menu, but I'd like to spare this step to every of our frameworks users and deliver this settings with our framework.
I realised, that settings are stored in the oxyOptionsSa15.0.xml and can be accessed by the OptionsStorage - class. Unforunately with the OptionsStorage of the AuthorAccess from the AuthorExtensionStateListener I can only access settings of the type <DocumentTypeID>.<setting>.
Is there a way to access the basic preferences of oxygen, like "author.show.caret.proximity.highlight" via an extension or is there another way to deliver prescribed settings with a framework/extension? Ideally in a way, that the disabling of the caret hightlighting just takes effect in associated file types where my framework is actually active?
Thanks,
Thomas.
Oxygen provides the feature called "Highlight elements near caret". Though we use different background colors in our framework this feature can become confusing, because it messes with the background colors of the elements at the caret position.
The feature can be easily disabled in the Options->Preferences - Menu, but I'd like to spare this step to every of our frameworks users and deliver this settings with our framework.
I realised, that settings are stored in the oxyOptionsSa15.0.xml and can be accessed by the OptionsStorage - class. Unforunately with the OptionsStorage of the AuthorAccess from the AuthorExtensionStateListener I can only access settings of the type <DocumentTypeID>.<setting>.
Is there a way to access the basic preferences of oxygen, like "author.show.caret.proximity.highlight" via an extension or is there another way to deliver prescribed settings with a framework/extension? Ideally in a way, that the disabling of the caret hightlighting just takes effect in associated file types where my framework is actually active?
Thanks,
Thomas.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: access preferences through API
Post by alex_jitianu »
Hello,
One possibility is to specify a default options file: http://oxygenxml.com/doc/ug-editor/#top ... tions.html. The second one is from an Workspace Access plugin where you have access to API to change global options(starting with version 15.0):
ro.sync.exml.workspace.api.PluginWorkspace.setGlobalObjectProperty("author.show.caret.proximity.highlight", Boolean.FALSE)
Both approaches change the global option so the feature will be disable for all document types. If you don't want to create a plugin and want to do this from an AuthorExtensionStateListener, you can do it like so (although not that nice):
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("author.show.caret.proximity.highlight", Boolean.FALSE);
Best regards,
Alex
One possibility is to specify a default options file: http://oxygenxml.com/doc/ug-editor/#top ... tions.html. The second one is from an Workspace Access plugin where you have access to API to change global options(starting with version 15.0):
ro.sync.exml.workspace.api.PluginWorkspace.setGlobalObjectProperty("author.show.caret.proximity.highlight", Boolean.FALSE)
Both approaches change the global option so the feature will be disable for all document types. If you don't want to create a plugin and want to do this from an AuthorExtensionStateListener, you can do it like so (although not that nice):
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("author.show.caret.proximity.highlight", Boolean.FALSE);
Best regards,
Alex
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
Re: access preferences through API
Hi,
I also try to set and get global preferences and have two questions:
1.) How to set extensions.update.sites through setGlobalObjectProperty? It's a option with multiple entries.
2.) How to get the properties? I did not found a getGlobalObjectProperty function.
Thanks,
Patrick
I also try to set and get global preferences and have two questions:
1.) How to set extensions.update.sites through setGlobalObjectProperty? It's a option with multiple entries.
2.) How to get the properties? I did not found a getGlobalObjectProperty function.
Thanks,
Patrick
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: access preferences through API
Hi Patrick,
Regards,
Radu
You would do this like:1.) How to set extensions.update.sites through setGlobalObjectProperty? It's a option with multiple entries.
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("extensions.update.sites", new String[] {"http://www.oxygenxml.com/InstData/Addons/default/updateSite.xml"});
Sorry but we do not have API for you to read our global preferences. The API would not be hard for us to add but our legal department has issues with other plugins being able to access settings like authentication information saved by the user in the global preferences.2.) How to get the properties? I did not found a getGlobalObjectProperty function.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
Re: access preferences through API
Thank you!
But two more questions:
1.) How it works for author.mathml.mathflow to set the license file path? the configuration structure seems to be different to the single value and addon-settings.
2.) Is it possible to apply the settings directly? Currently I have to restart Oxygen. Or if not, can I restart Oxygen within the script?
But two more questions:
1.) How it works for author.mathml.mathflow to set the license file path? the configuration structure seems to be different to the single value and addon-settings.
2.) Is it possible to apply the settings directly? Currently I have to restart Oxygen. Or if not, can I restart Oxygen within the script?
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: access preferences through API
Hi Patrick,
The value which should be set for the key is a persistent object called ro.sync.ecss.images.xmlimages.mathml.MathFlowPO. You can create one, it is not obfuscated and use the setter methods of the object to set the properties to it. Then call our API to set the created object as the value for that key.
But:
How do you plan to distribute the MathFlow license files to the end users? The license files which get configured in the Oxygen Preferences are user based.
The ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace interface extends an interface called ro.sync.exml.workspace.api.math.MathFlowConfigurator which allows you to set special fixed license keys for MathFlow configuration.
A MathFlow fixed license key for the editor has the format MFSCKKK-KKKKKK-KKKKK and replaces the need to define a location for the MathFlow license file.
You should probably talk also to MathFlow about how you plan to provide licensing to the end user if you plan to do this automatically.
Regards,
Radu
Indeed the options key under which the entire MathFlow options from the Preferences->"Editor / Edit modes / Author / MathML" page get saved is author.mathml.mathflow.1.) How it works for author.mathml.mathflow to set the license file path? the configuration structure seems to be different to the single value and addon-settings.
The value which should be set for the key is a persistent object called ro.sync.ecss.images.xmlimages.mathml.MathFlowPO. You can create one, it is not obfuscated and use the setter methods of the object to set the properties to it. Then call our API to set the created object as the value for that key.
But:
How do you plan to distribute the MathFlow license files to the end users? The license files which get configured in the Oxygen Preferences are user based.
The ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace interface extends an interface called ro.sync.exml.workspace.api.math.MathFlowConfigurator which allows you to set special fixed license keys for MathFlow configuration.
A MathFlow fixed license key for the editor has the format MFSCKKK-KKKKKK-KKKKK and replaces the need to define a location for the MathFlow license file.
You should probably talk also to MathFlow about how you plan to provide licensing to the end user if you plan to do this automatically.
You mean the "extensions.update.sites" setting, right? When exactly do you set that option? Do you set it on the WorkspaceAccessPluginExtension.applicationStarted(StandalonePluginWorkspace) callback?2.) Is it possible to apply the settings directly? Currently I have to restart Oxygen. Or if not, can I restart Oxygen within the script?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 96
- Joined: Mon May 09, 2011 11:54 am
Re: access preferences through API
Hi Radu,
thats a problem, yes. But we use concurrent licenses in our company and not fixed licenses, so I also have the hostname of the license server. If it's possible to use this settings without a license file, it would be great. But we also have to deploy the MathML SDK separately, so it's not a big difference if we have to deploy the license file, too. - Or is there a solution to deploy the mathflow files through a plugin?
I set the options by clicking a menu entry and not directly at the applicationStarted callback, so the user has the chance to deny the change of the settings.
Thanks,
Patrick
thats a problem, yes. But we use concurrent licenses in our company and not fixed licenses, so I also have the hostname of the license server. If it's possible to use this settings without a license file, it would be great. But we also have to deploy the MathML SDK separately, so it's not a big difference if we have to deploy the license file, too. - Or is there a solution to deploy the mathflow files through a plugin?
I set the options by clicking a menu entry and not directly at the applicationStarted callback, so the user has the chance to deny the change of the settings.
Thanks,
Patrick
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: access preferences through API
Hi Patrick,
Unfortunately not. I also don't see any API on the MathFlow side to do this.
We have some future plans to create a new plugin type which would contribute additional JAR libraries to the Oxygen main class loader.
Regards,
Radu
thats a problem, yes. But we use concurrent licenses in our company and not fixed licenses, so I also have the hostname of the license server. If it's possible to use this settings without a license file, it would be great.
Unfortunately not. I also don't see any API on the MathFlow side to do this.
Basically you would need a way to get all the MathFlow JARs in the main Oxygen class loader. As an alternative to setting the MathFlow installation directory in the Preferences, copying the MathFlow JAR libraries to the "OXYGEN_INSTALL_DIR\lib" folder would do the trick.But we also have to deploy the MathML SDK separately, so it's not a big difference if we have to deploy the license file, too. - Or is there a solution to deploy the mathflow files through a plugin?
We have some future plans to create a new plugin type which would contribute additional JAR libraries to the Oxygen main class loader.
Then indeed you would need to also show a dialog to the user and urge him to restart the application in order to have the settings applied.I set the options by clicking a menu entry and not directly at the applicationStarted callback, so the user has the chance to deny the change of the settings.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: access preferences through API
Hi Patrick,
Coming back to this as I got more details from MathFlow about licensing (probably someone from your side started the discussion with them):
If you build a plugin for Oxygen which would include in an inner folder the MathFlow libraries and a license file then you could indeed construct a ro.sync.ecss.images.xmlimages.mathml.MathFlowPO object on which you could use the ro.sync.ecss.images.xmlimages.mathml.MathFlowPO.setInstallationDirectory(File) method to set the path to that inner folder in which the JARs are located and the method ro.sync.ecss.images.xmlimages.mathml.MathFlowPO.setLicenseFile(File) to set the path to the license file.
You can find the base directory of the plugin calling:
ro.sync.sample.plugin.workspace.WorkspaceAccessPlugin.getInstance().getDescriptor().getBaseDir()
Regards,
Radu
Coming back to this as I got more details from MathFlow about licensing (probably someone from your side started the discussion with them):
So even if you have concurrent licensing you can still have a license file with the server details inside it.The license file can be either a concurrent license or a fixed license. The concurrent license points to a server location where a license manager can control license check-in and check-out. The fixed license has a key in it that is tied to the hostname or MAC address of the computer so that MathFlow can only run on the machine that the key is tied to. However, we can put multiple keys in the same license file. This is how we accommodate customers who load MathFlow from a network location - they all access MathFlow from the same shared drive (including the license file), but since it runs on different machines, the license file will have a key for each machine.
If you build a plugin for Oxygen which would include in an inner folder the MathFlow libraries and a license file then you could indeed construct a ro.sync.ecss.images.xmlimages.mathml.MathFlowPO object on which you could use the ro.sync.ecss.images.xmlimages.mathml.MathFlowPO.setInstallationDirectory(File) method to set the path to that inner folder in which the JARs are located and the method ro.sync.ecss.images.xmlimages.mathml.MathFlowPO.setLicenseFile(File) to set the path to the license file.
You can find the base directory of the plugin calling:
ro.sync.sample.plugin.workspace.WorkspaceAccessPlugin.getInstance().getDescriptor().getBaseDir()
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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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