From: Christopher O. <chr...@fu...> - 2009-12-02 09:59:14
|
Hi, just by giving it a quick look: Could the recursion be put inside the workspace runnable please? By calling #create() recursively another WorkspaceRunnable needs to be created and dispatched with the IWorkspace. IWorkspaceRunnable createFolderProcedure = new IWorkspaceRunnable() { public void createRecursive(IFolder toCreate){ if (toCreate == null || toCreate.exists()) return; // End of recursion createRecursive(getParentFolder(folder)); folder.create(IResource.NONE, true, monitor); } public void run(IProgressMonitor monitor) throws CoreException { createRecursive(folder); if (monitor.isCanceled()) { log.warn("Creating folder failed: " + folder); } } }; Cheers, Christopher On Tue, 01 Dec 2009 13:05:13 +0100, Henning Staib <hen...@fu...> wrote: > Hi, > > there is no need for a log message because if #create() is called it > already logs if the folder that should be created already exists. > the only case where the parent folder is null is if the parent folder > is the project root. > > I changed the comment in this patch to make clear why #create() is > called recursively. > > #create is also used by #mkdirs() and thats why it may have to create > parent folders. > > Regards, > Henning > -- Christopher Oezbek | Freie Universität Berlin | Takustr. 9, 14195 Berlin http://www.inf.fu-berlin.de/~oezbek/ | +49 30 838 75242 | Raum 008 |