Creation of IFIles to slow [message #325473] |
Tue, 19 February 2008 11:46  |
Eclipse User |
|
|
|
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] |
Tue, 19 February 2008 20:43   |
Eclipse User |
|
|
|
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 04:31   |
Eclipse User |
|
|
|
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 15:23  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02957 seconds