Setting Linebreaks around elements via plugin
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 18
- Joined: Thu Mar 16, 2017 8:44 pm
Setting Linebreaks around elements via plugin
In the UI, one can use Preferences > XML > Element Spacing > Line Break tab to add elements to a list to insert line breaks before and after. For many Preferences, we have used the approach described in the documentation of saving our preferences to an external file, finding the string name that describes it, and using the pluginWorkspaceAccess.setGlobalObjectProperty() method to set them in our plugin. For this particular setting, named editor.format.break.line.elements in the preferences XML, it expects a breakLineElement-array element. Is there a way to create one and set this preference via plugin?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting Linebreaks around elements via plugin
Hi,
You can do something like this:
but we also have this API:
allowing you to use an XML options file to impose global settings. Our main menu Options->"Export global options" action allows you to export such an XML options file.
Regards,
Radu
You can do something like this:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("editor.format.break.line.elements", new ro.sync.exml.serialize.state.BreakLineElement[] {
new BreakLineElement("*", BreakLineElement.NO_BREAK)
});
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().importGlobalOptions(optionsFile)
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 18
- Joined: Thu Mar 16, 2017 8:44 pm
Re: Setting Linebreaks around elements via plugin
Thanks, Radu! We knew of the ability to import a global options xml file, but it overrides the users settings. It appears by setting it via setGlobalObjectProperty() we can set the default, and the user can override it if they so choose, hence our preference to use the latter approach.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting Linebreaks around elements via plugin
Hi,
About this remark:
If you do not want to impose the option all the time when Oxygen is started, maybe you can impose the option only the first time the add-on is initialized, use another custom setting set in the "ro.sync.exml.workspace.api.PluginWorkspace.getOptionsStorage()" to remember that the add-on has already imposed global options so it must no longer do that every time Oxygen is started.
Regards,
Radu
About this remark:
Actually you are imposing the option, so it's exactly like calling "importGlobalOptions(optionsFile)".It appears by setting it via setGlobalObjectProperty() we can set the default
If you do not want to impose the option all the time when Oxygen is started, maybe you can impose the option only the first time the add-on is initialized, use another custom setting set in the "ro.sync.exml.workspace.api.PluginWorkspace.getOptionsStorage()" to remember that the add-on has already imposed global options so it must no longer do that every time Oxygen is started.
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)
- ↳ 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