[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Inserting into a file
|
- From: bob.donovan@xxxxxxxx (Bob Donovan)
- Date: Thu, 17 Apr 2003 20:01:34 +0000 (UTC)
- Newsgroups: eclipse.tools
- Organization: http://www.eclipse.org
- User-agent: NewsPortal 0.23
Hi,
I need to have some code automatically inserted into a source file that I
am managing with a custom editor. Is there a recommended way to do this.
My plan is to scan the file, find the appropriate place to insert, insert
the text into the file.
One way that I have figure out how to do this, is to get the contents from
the IFile, convert to a string, then to a StringBuffer, insert the text,
covert the StringBuffer to a InputStream, then call
IFile.setContents(InputStream).
Seems like a lot of work, but its the only way I could figure it out so
far. Does anyone have any suggestions? Do this procedure destroy any
markers that are present on the file? Is there are better way?
Bob