Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Creation of IFIles to slow
Creation of IFIles to slow [message #325473] Tue, 19 February 2008 16:46 Go to next message
Philipp Simon is currently offline Philipp SimonFriend
Messages: 26
Registered: July 2009
Junior Member
Hey,

i am importing some files into the workspace and create the new IFiles
with the method attached below. But somehow the speed of the copy
process is to low compared to other copy operations but i somehow can
not figure out why this is the case.

I fear that the workbench adds up some time because of the "resource
state tracking" and workspace file creation through several calls of
IFolder.getFile(), but am not sure that its not my fault with using the
wrong way to create the files. Any help appreciated


greetings Philipp

private void copyFileToWorkspace(File source, IFile destination) {
FileInputStream fis = null;
BufferedInputStream bfis = null;
try {
fis = new FileInputStream(source);
bfis = new BufferedInputStream(fis,8192);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if (!destination.exists()) {
try {
currentMonitor.subTask("Copying file:" + destination.getName());
destination.create(bfis, true, currentMonitor);
currentMonitor.worked(1);
} catch (CoreException e) {
e.printStackTrace();
} finally {
try {
bfis.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Re: Creation of IFIles to slow [message #325485 is a reply to message #325473] Wed, 20 February 2008 01:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Philipp Simon" <philipp_simon@web.de> wrote in message
news:fpf15i$qpv$1@build.eclipse.org...
> Hey,
>
> i am importing some files into the workspace and create the new IFiles
> with the method attached below. But somehow the speed of the copy
> process is to low compared to other copy operations but i somehow can
> not figure out why this is the case.
>
> I fear that the workbench adds up some time because of the "resource
> state tracking" and workspace file creation through several calls of
> IFolder.getFile(), but am not sure that its not my fault with using the
> wrong way to create the files. Any help appreciated


Have you tried debugging into the destination.create() call, to see if it is
doing anything unexpected?

I imagine there's a WorkspaceRunnable inside there, but if not you might
want to wrap your whole task inside one to defer update notifications till
the end. Just a thought, I'm a newbie to that code as well.
Re: Creation of IFIles to slow [message #325496 is a reply to message #325485] Wed, 20 February 2008 09:31 Go to previous messageGo to next message
Philipp Simon is currently offline Philipp SimonFriend
Messages: 26
Registered: July 2009
Junior Member
I haven't tried debugging it there will do it. Though as far as i
understood the mechanics wrapping the modifications in a
Workspacemodifyoperation should delay those updates already. And that is
what i do in the end. Using this method from a Subclass of
Workspacemodifyoperation.

thanks for your thought

Philipp
Re: Creation of IFIles to slow [message #325520 is a reply to message #325496] Wed, 20 February 2008 20:23 Go to previous message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Philipp Simon" <philipp_simon@web.de> wrote in message
news:bf443c668ea762b9681ecdd0185b7f5e$1@www.eclipse.org...
>I haven't tried debugging it there will do it. Though as far as i
>understood the mechanics wrapping the modifications in a
>Workspacemodifyoperation should delay those updates already. And that is
>what i do in the end. Using this method from a Subclass of
>Workspacemodifyoperation.

I agree - sorry, hadn't realized that from your earlier post.

I'd try debugging into it to see if there are any surprises behind the
curtain.
Previous Topic:Preferences for activeEditor Plugin
Next Topic:Table Viewer Layout !!
Goto Forum:
  


Current Time: Thu Nov 21 15:31:23 GMT 2024

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

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

Back to the top