Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Insert text programtically into active editor
Insert text programtically into active editor [message #333054] Fri, 21 November 2008 20:27 Go to next message
Jason Carter is currently offline Jason CarterFriend
Messages: 13
Registered: July 2009
Junior Member
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 Go to previous message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
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
Previous Topic:Reusing the console view
Next Topic:Missing ISynchronizeParticipant creation API from Platform?
Goto Forum:
  


Current Time: Thu Apr 25 13:47:43 GMT 2024

Powered by FUDForum. Page generated in 0.05146 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top