From 2b2e606049deaf1b1097a901f5b918ed0b99f826 Mon Sep 17 00:00:00 2001 From: Oleg Krasilnikov Date: Wed, 2 May 2007 11:23:19 +0000 Subject: [PATCH] Bug #184671: avoid old files deletion while creating project. --- .../cdt/ui/wizards/CDTCommonProjectWizard.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java index b6c382cde95..7ae416c57fb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java @@ -55,6 +55,7 @@ implements IExecutableExtension, IWizardWithMemory private String wz_title; private String wz_desc; + private boolean existingPath = false; private String lastProjectName = null; private IPath lastProjectLocation = null; private CWizardHandler savedHandler = null; @@ -121,9 +122,11 @@ implements IExecutableExtension, IWizardWithMemory */ private void clearProject() { if (lastProjectName == null) return; - try { - ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(true, true, null); - } catch (CoreException ignore) {} + if (!existingPath) { + try { + ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(true, true, null); + } catch (CoreException ignore) {} + } newProject = null; lastProjectName = null; lastProjectLocation = null; @@ -184,7 +187,8 @@ implements IExecutableExtension, IWizardWithMemory */ public IProject createIProject(final String name, final IPath location) throws CoreException{ if (newProject != null) return newProject; - + existingPath = (location != null && location.toFile().exists()); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject newProjectHandle = root.getProject(name);