Page 1 of 1

Plugin development - authorAccess.selectWord()

Posted: Wed Oct 15, 2008 8:34 pm
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.

Re: Plugin development - authorAccess.selectWord()

Posted: Thu Oct 16, 2008 3:06 pm
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