[oXygen-sdk] JTextArea#replaceRange in the editor does not seem to work
Adam Retter
adam.retter at googlemail.com
Sun Apr 10 13:55:59 CDT 2016
Hey Alex,
Thanks for your reply. It was very helpful, my comments are inline below:
> It might be a problem with the offsets given to the method. At a first
> glance I would say that the interval to replace should be (to cover the case
> when start > 0):
>
> jTextArea.replaceRange(suggestion, start + lastIndex, start + lastIndex
> + ADD_NEW.length());
Doh! Yes, of course you are correct, my offsets should be from
`start`. When I make that change, then replaceRange does indeed work.
> Perhaps you can also resolve the use case without a timer.
> CIValue#getInsertString() gets called after the user chooses a value in the
> content completion window, at the moment when we have to decide what to
> insert in the document. I suggest overriding this method and getting the
> value from the user then. I've tested it in Oxygen v17.1 and it worked well.
I was hoping that you might suggest something like that :-)
I just used `Timer` as it enabled me to get something working quickly
without having to dig into the Oxygen API in too much detail. I have
now switched to overriding CIValue#getInsertString() and it is working
well.
Thanks again. Adam.
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
More information about the oXygen-sdk
mailing list