Page 1 of 1

highlighting/underlining in text mode?

Posted: Tue May 27, 2014 11:43 pm
by daniel7
Hi,

I can get a highlighter in author mode like this:

Code: Select all

authorAccess.getEditorAccess().getHighlighter()
Is there anything like that for text mode? It seems to exist, as this is what the spell checker does, but I could not find it in the API.

Thanks,

Daniel

Re: highlighting/underlining in text mode?

Posted: Wed May 28, 2014 8:39 am
by Radu
Hi Daniel,

How exactly did you start using our API for the customization?
Did you implement a Workspace Access Plugin using our Plugins SDK?

http://www.oxygenxml.com/oxygen_sdk.htm ... ne_plugins

A Workspace Access Plugin allows you to see what editor is current selected (ro.sync.exml.workspace.api.editor.WSEditor API) and to see what editor mode (Text, Grid or Author) is currently selected using ro.sync.exml.workspace.api.editor.WSEditor.getCurrentPage().
Then this page can either be an instance of ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPage for the Author editing mode or ro.sync.exml.workspace.api.editor.page.text.xml.WSXMLTextEditorPage for the Text editing mode.
The Text and Author editing modes have totally different internal models. The Text editing mode is based on a regular Java Swing javax.swing.JTextArea and can be obtained using the API ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage.getTextComponent() and then use the regular Swing API for adding highlights:

Code: Select all

WSTextEditorPage currentPage = (WSTextEditorPage)editor.getCurrentPage();
Object textComponent = currentPage.getTextComponent();
if (textComponent instanceof JTextArea) {
JTextArea textArea = (JTextArea) textComponent;
Highlighter highlighther = textArea.getHighlighter();
highlighther.addHighlight(p0, p1, p)
}
Maybe this similar topic would also help:

http://www.oxygenxml.com/forum/topic10519.html

Regards,
Radu

Re: highlighting/underlining in text mode?

Posted: Wed May 28, 2014 8:43 am
by Radu
By the way, a plugin for Oxygen can be bundled as an add-on and then installed over the web from an Oxygen installation:

http://www.oxygenxml.com/addons.html

Regards,
Radu

Re: highlighting/underlining in text mode?

Posted: Wed May 28, 2014 10:54 am
by daniel7
Radu wrote:The Text editing mode is based on a regular Java Swing javax.swing.JTextArea and can be obtained using the API ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage.getTextComponent() and then use the regular Swing API for adding highlights:
Thanks, that does the trick.