Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » File search & replace programatically?
File search & replace programatically? [message #327404] Thu, 17 April 2008 16:48 Go to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Is there any simple API for doing a search & replace within a single
file? I'm looking at the IFile interface and it looks like I could use
some combination of getContents() and setContents() but there would
still be a lot of coding to bridge the gap.
Is there a cleaner/simpler way?

Thanks in advance,
Eric
Re: File search & replace programatically? [message #327417 is a reply to message #327404] Fri, 18 April 2008 07:14 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> Is there any simple API for doing a search & replace within a single
> file? I'm looking at the IFile interface and it looks like I could use
> some combination of getContents() and setContents() but there would
> still be a lot of coding to bridge the gap.
> Is there a cleaner/simpler way?
Use file buffers to get the document (this handles all the encoding woos
for you) and then use org.eclipse.jface.text.FindReplaceDocumentAdapter
which also supports regex.

Dani
>
> Thanks in advance,
> Eric
Previous Topic:Re: Can I customize when the plug-in be loaded?
Next Topic:Getting the default modifier key for hyperlinks from the preference store
Goto Forum:
  


Current Time: Sun Jun 30 13:44:30 GMT 2024

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

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

Back to the top