1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Bug #184671: avoid old files deletion while creating project.

This commit is contained in:
Oleg Krasilnikov 2007-05-02 11:23:19 +00:00
parent bdf0836e41
commit 2b2e606049

View file

@ -55,6 +55,7 @@ implements IExecutableExtension, IWizardWithMemory
private String wz_title; private String wz_title;
private String wz_desc; private String wz_desc;
private boolean existingPath = false;
private String lastProjectName = null; private String lastProjectName = null;
private IPath lastProjectLocation = null; private IPath lastProjectLocation = null;
private CWizardHandler savedHandler = null; private CWizardHandler savedHandler = null;
@ -121,9 +122,11 @@ implements IExecutableExtension, IWizardWithMemory
*/ */
private void clearProject() { private void clearProject() {
if (lastProjectName == null) return; if (lastProjectName == null) return;
if (!existingPath) {
try { try {
ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(true, true, null); ResourcesPlugin.getWorkspace().getRoot().getProject(lastProjectName).delete(true, true, null);
} catch (CoreException ignore) {} } catch (CoreException ignore) {}
}
newProject = null; newProject = null;
lastProjectName = null; lastProjectName = null;
lastProjectLocation = null; lastProjectLocation = null;
@ -184,6 +187,7 @@ implements IExecutableExtension, IWizardWithMemory
*/ */
public IProject createIProject(final String name, final IPath location) throws CoreException{ public IProject createIProject(final String name, final IPath location) throws CoreException{
if (newProject != null) return newProject; if (newProject != null) return newProject;
existingPath = (location != null && location.toFile().exists());
IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot(); IWorkspaceRoot root = workspace.getRoot();