Plugin development - authorAccess.selectWord()

Having trouble installing Oxygen? Got a bug to report? Post it all here.
calvados
Posts: 22
Joined: Wed Jul 30, 2008 12:46 am

Plugin development - authorAccess.selectWord()

Post by calvados »

Hi there, I've noticed that authorAccess.selectWord() will not select all of a 'word' if the 'word' contains brackets. ie. "1(1)(iv)(A)" will only select the first "1" and not the rest. Is there a way to select the entire content of this 'word'. If it helps this word is the only content in the content node. ie. <nodeName id='someID'>1(1)(iv)(A)</nodeName>

Thanks for your help with this matter..

Cal.
Radu
Posts: 9438
Joined: Fri Jul 09, 2004 5:18 pm

Re: Plugin development - authorAccess.selectWord()

Post by Radu »

Hi Cal,

I think the behavior of the authorAccess.selectWord() is correct.
The content of the tag is not a word but also contains control characters, operators.

For now we do not provide in the AuthorAccess API a way to select a variable portion of text.

We will try to add this method for the Oxygen 10 release which will probably be available in a couple of days.

When Oxygen 10 is released you will be able to select the whole text content of the tag using the following code:

Code: Select all


    try {
AuthorNode nodeAtOffset = authorAccess.getDocumentController().getNodeAtOffset(authorAccess.getCaretOffset());
authorAccess.select(nodeAtOffset.getStartOffset() + 1, nodeAtOffset.getEndOffset());
} catch (BadLocationException e) {
e.printStackTrace();
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply