prettyPrint with oXygen settings
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 9
- Joined: Wed May 04, 2016 2:53 pm
prettyPrint with oXygen settings
Documentation states that pluginWorkspaceAccess.getXMLUtilAccess().prettyPrint() will print with oXygen settings, however for me it doesn't. Particularly, it line-breaks elements which have no whitespace in between, while Format and Indent action behaves as expected. I tried null and "http://www.tei-c.org/Lite/DTD/teixlite.dtd" as systemId parameter. How can I simulate Format and Indent action? And more generally, what is the proper way to programmatically invoke oXygen's action?
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: prettyPrint with oXygen settings
Hi,
There indeed seems to be a difference between the API and the "Format and Indent" action. The "Format and indent" action also looks at the schema (RNG or DTD) referenced by the XML while the API method ignores it. I will add an issue to see if we can fix this on our side.
But you seem to want to actually call the toolbar action on the current opened file contents. Do you use a workspace access plugin extension? For example if you want to format and indent the file on open you could use some code like:
Regards,
Radu
There indeed seems to be a difference between the API and the "Format and Indent" action. The "Format and indent" action also looks at the schema (RNG or DTD) referenced by the XML while the API method ignores it. I will add an issue to see if we can fix this on our side.
But you seem to want to actually call the toolbar action on the current opened file contents. Do you use a workspace access plugin extension? For example if you want to format and indent the file on open you could use some code like:
Code: Select all
@Override
public void applicationStarted(final StandalonePluginWorkspace pluginWorkspaceAccess) {
pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener(){
public void editorOpened(URL editorLocation) {
WSEditor editor = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
WSEditorPage edPage = editor.getCurrentPage();
if(edPage instanceof WSXMLTextEditorPage){
WSXMLTextEditorPage tp = (WSXMLTextEditorPage)edPage;
Object formatAndIndentAction = tp.getActionsProvider().getTextActions().get("Source/Pretty_print_tooltip");
tp.getActionsProvider().invokeAction(formatAndIndentAction);
}
}
}, PluginWorkspace.MAIN_EDITING_AREA);
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9
- Joined: Wed May 04, 2016 2:53 pm
Re: prettyPrint with oXygen settings
Hi Radu!
Yes, I am using workspace access plugin extension.
Invoking actions in your snippet's way works, but now the question is where can I get actions' ID strings, like that "Source/Pretty_print_tooltip"?
Yes, I am using workspace access plugin extension.
Invoking actions in your snippet's way works, but now the question is where can I get actions' ID strings, like that "Source/Pretty_print_tooltip"?
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: prettyPrint with oXygen settings
Hi,
We do not have particular documentation for each action ID but you can use System.err to print to console the entire map tp.getActionsProvider().getTextActions(). If you start Oxygen using the command line startup script you should see in the console messages from your plugins.
Regards,
Radu
We do not have particular documentation for each action ID but you can use System.err to print to console the entire map tp.getActionsProvider().getTextActions(). If you start Oxygen using the command line startup script you should see in the console messages from your plugins.
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