Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Generating random filename using IFile in eclipse
Generating random filename using IFile in eclipse [message #297162] Tue, 10 January 2006 05:31 Go to next message
Eclipse UserFriend
Originally posted by: gpnvssuresh.gmail.com

Hi,
I am a new bie to eclipse.In the following scenario i want to know
whether i can generate random filename while creating a file using IFile

I am writing data to a file and while writing to a file i am checking for
fatal errors and when error occurs i want to revert back to the previous
state of file by storing the data in a temporary file and revert the file
to previous state with the data in temporary file.

Pls suggest me how to generate random filename while creating a file using
IFile in eclipse.
Re: Generating random filename using IFile in eclipse [message #297190 is a reply to message #297162] Tue, 10 January 2006 08:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: diebosto.fi.vupv.es

gpnvssuresh@gmail.com (GPNVSSuresh) wrote in
news:a0871a317a8be3b69e78eb147796540c$1@www.eclipse.org:

Maybe a name like "errorxxxxxxxxx" where xxxxxxxxxxx is a timestamp

> Hi,
> I am a new bie to eclipse.In the following scenario i want to know
> whether i can generate random filename while creating a file using
> IFile
>
> I am writing data to a file and while writing to a file i am checking
> for fatal errors and when error occurs i want to revert back to the
> previous state of file by storing the data in a temporary file and
> revert the file to previous state with the data in temporary file.
>
> Pls suggest me how to generate random filename while creating a file
> using IFile in eclipse.
>
>
Re: Generating random filename using IFile in eclipse [message #297192 is a reply to message #297190] Tue, 10 January 2006 08:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gpnvssuresh.gmail.com

Hi Bosco,
Can u pls mention how it is done using IFile of Eclipse in
particular as I want to know is it possible to do using the the IFile of
Eclipse. If yes pls mention how it is done.
Re: Generating random filename using IFile in eclipse [message #297198 is a reply to message #297192] Tue, 10 January 2006 09:33 Go to previous message
Eclipse UserFriend
Originally posted by: address.starts.after.hyphen-martin.umgeher.joanneum.at

GPNVSSuresh wrote:
> Hi Bosco,
> Can u pls mention how it is done using IFile of Eclipse in
> particular as I want to know is it possible to do using the the IFile of
> Eclipse. If yes pls mention how it is done.

You just need to create a unique name as String and use it as filename.
Get the file handle e.g. with IFolder.getFile, then create the file with
IFile.create.

You should also take a look at the workspace history features of
eclipse. Changes to a file are recorded and can be reverted by the
resource framework, so you wouldn't have to do that manually. I haven't
used it myself yet, so I can't help you with that.

Regards,
M
Previous Topic:How to open a file from an eclipse plug in?
Next Topic:search in JAR files
Goto Forum:
  


Current Time: Thu Sep 18 11:33:04 EDT 2025

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

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

Back to the top