highlighting/underlining in text mode?

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
daniel7
Posts: 10

highlighting/underlining in text mode?

Tue May 27, 2014 11:43 pm

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: 5751

Re: highlighting/underlining in text mode?

Wed May 28, 2014 8:39 am

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.html#oXygen_standalone_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: 5751

Re: highlighting/underlining in text mode?

Wed May 28, 2014 8:43 am

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

Re: highlighting/underlining in text mode?

Wed May 28, 2014 10:54 am

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.

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 4 guests