highlighting/underlining in text mode?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
daniel7
Posts: 10
Joined: Tue May 27, 2014 10:00 am

highlighting/underlining in text mode?

Post 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
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: highlighting/underlining in text mode?

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: highlighting/underlining in text mode?

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
daniel7
Posts: 10
Joined: Tue May 27, 2014 10:00 am

Re: highlighting/underlining in text mode?

Post 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.
Post Reply