Compact Tag Layout option - selectively overriding
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 2
- Joined: Mon May 19, 2025 7:07 pm
Compact Tag Layout option - selectively overriding
Hello,
We would like the default value of the Compact Tag Layout option to be false rather than the system default of true. In order to accomplish this, we included the following entry in a globalOptions.xml file that we import at startup using a plugin (code and xml edited for brevity):
This approach, however, results in a value explicitly set by the user in Options/Preferences being lost when restarting Oxygen. To address this case, we need to be able to distinguish between system default values and values explicitly set by the user (overriding the former, but not the latter). One approach we looked into was to add a GlobalOptionListener in the plugin to detect user modification of this option and save this somewhere to inform the behavior of our logic to override the system default (or perhaps just update the globalOptions.xml file to use the user value):
The problem we encountered, however is that apparently the addGlobalOptionListener() method (and other methods in the GlobalOptionsStorage interface) only allows key values declared in the APIAccessibleOptionTags class which includes "tagless.editor.tags.display.mode" but not "tags.compact.mode".
So, with that background, I guess my questions are:
Any information or guidance would be appreciated!
Thank you!
Dennis
We would like the default value of the Compact Tag Layout option to be false rather than the system default of true. In order to accomplish this, we included the following entry in a globalOptions.xml file that we import at startup using a plugin (code and xml edited for brevity):
Code: Select all
...
<entry>
<String>tags.compact.mode</String>
<Boolean>false</Boolean>
</entry>
...
Code: Select all
private static final String GLOBAL_OPTIONS_IMPORT_PATH = "plugins/globalOptions/resources/globalOptions.xml";
public void applicationStarted(StandalonePluginWorkspace pwa) {
String pluginPath = pwa.getUtilAccess().expandEditorVariables(EditorVariables.OXYGEN_HOME_URL, null) + GLOBAL_OPTIONS_IMPORT_PATH;
URL url= new URL(pluginPath);
File file = new File(new URI(url));
pwa.importGlobalOptions(file);
}
...
Code: Select all
String key = "tags.compact.mode";
pwa.addGlobalOptionListener(new OptionListener(key) {
@Override
public void optionValueChanged(OptionChangedEvent event) {
String key = event.getOptionKey();
Object oldValue = event.getOldObjectValue();
Object newValue = event.getNewObjectValue();
// save this somewhere to determine override behavior at startup
}
});
So, with that background, I guess my questions are:
- Is there a better way to accomplish the primary goal - automatically override default value of "tags.compact.mode" while allowing the user to manually override the value with such changes preserved when Oxygen is restarted
- If not, does the above (admittedly pretty ugly sledgehammer approach) sound plausible
- If so, is there a way to to apply the addGlobalOptionListener() method (and other methods in the GlobalOptionsStorage interface) to the "tags.compact.mode" key (or a different key I should be using)
- Or another way to distinguish between system default and user set values of this property, or a way to only override the system default, but not values explicitly set by the user.
Any information or guidance would be appreciated!
Thank you!
Dennis
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Compact Tag Layout option - selectively overriding
Hello Dennis,
For Oxygen 28 I just moved the TAGS_COMPACT_MODE key to the APIAccessibleOptionTags so that it will be easier to manipulate (read or listen to) using the APIs.
For now one thing you could do would be to call "pwa.importGlobalOptions(file);" only once instead of calling it each time Oxygen opens, in this way you impose the forced settings only once. How can this be done? Maybe you can set an extra key in the "ro.sync.exml.workspace.api.PluginWorkspace.getOptionsStorage()" like "already.imposed.settings" with value "true" and check if you have already imposed the settings once before calling "pwa.importGlobalOptions(file);". If you have not, call the "pwa.importGlobalOptions(file);" and set the "already.imposed.settings" key to "true" in the local PluginWorkspace.getOptionsStorage().
Regards,
Radu
For Oxygen 28 I just moved the TAGS_COMPACT_MODE key to the APIAccessibleOptionTags so that it will be easier to manipulate (read or listen to) using the APIs.
For now one thing you could do would be to call "pwa.importGlobalOptions(file);" only once instead of calling it each time Oxygen opens, in this way you impose the forced settings only once. How can this be done? Maybe you can set an extra key in the "ro.sync.exml.workspace.api.PluginWorkspace.getOptionsStorage()" like "already.imposed.settings" with value "true" and check if you have already imposed the settings once before calling "pwa.importGlobalOptions(file);". If you have not, call the "pwa.importGlobalOptions(file);" and set the "already.imposed.settings" key to "true" in the local PluginWorkspace.getOptionsStorage().
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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