Insert text programtically into active editor [message #333054] |
Fri, 21 November 2008 20:27  |
Eclipse User |
|
|
|
Hello,
I can get the active page and the document. When I do this:
document.replace(1,0,"some text");
I get a BadLocationException. I noticed that this exception only occurs
when the text file is empty or when there is no text at the offset to
replace.
Could anyone help me with these?
Thanks,
Jason
|
|
|
Re: Insert text programtically into active editor [message #333169 is a reply to message #333054] |
Thu, 27 November 2008 13:16  |
Eclipse User |
|
|
|
Jason Carter wrote:
> I can get the active page and the document. When I do this:
>
> document.replace(1,0,"some text");
>
> I get a BadLocationException. I noticed that this exception only occurs
> when the text file is empty or when there is no text at the offset to
> replace.
I think IDocuments start with an offset of 0. You should start replacing
from 0 instead of 1, that should solve the "text file is empty" problem
I think.
Remy
|
|
|
Powered by
FUDForum. Page generated in 0.06124 seconds