diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties index 48faccac54a..07ba751561c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties @@ -542,6 +542,8 @@ StdProjectTypeHandler.2=Default StdProjectTypeHandler.3=creation Make project: IBuilder is null CDTConfigWizardPage.0=Select configurations +CDTCommonProjectWizard.0=Old project will be overridden +CDTCommonProjectWizard.1=Existing project settings will be overridden.\nImport feature can be used instead to preserve old settings.\nOK to override ? NewModelProjectWizard.0=CDT project NewModelProjectWizard.1=Create CDT project of selected type NewModelProjectWizard.2=C++ project 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 81805b7dbb6..b1b7cc1eadd 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 @@ -12,6 +12,7 @@ package org.eclipse.cdt.ui.wizards; +import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -30,6 +31,7 @@ import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; @@ -113,6 +115,22 @@ implements IExecutableExtension, IWizardWithMemory if (newProject != null && isChanged()) clearProject(); if (newProject == null) { + existingPath = false; + IPath p = fMainPage.getProjectLocation(); + if (p == null) p = ResourcesPlugin.getWorkspace().getRoot().getLocation(); + p = p.append(fMainPage.getProjectName()); + File f = p.toFile(); + if (f.exists() && f.isDirectory()) { + if (p.append(".project").toFile().exists()) { //$NON-NLS-1$ + if (! + MessageDialog.openConfirm(getShell(), + UIMessages.getString("CDTCommonProjectWizard.0"), //$NON-NLS-1$ + UIMessages.getString("CDTCommonProjectWizard.1")) //$NON-NLS-1$ + ) + return null; + } + existingPath = true; + } savedHandler = fMainPage.h_selected; savedHandler.saveState(); lastProjectName = fMainPage.getProjectName(); @@ -212,7 +230,6 @@ 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(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java index 8bb15ee5b7a..7bc7503a674 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java @@ -336,9 +336,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages; if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName())) bad = false; } - if (bad) { + if (bad) { // Sic !! Show message but allow creation. setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$ - return false; + return true; } } @@ -347,11 +347,13 @@ import org.eclipse.cdt.internal.ui.CPluginImages; if (p == null) p = ResourcesPlugin.getWorkspace().getRoot().getLocation(); File f = p.append(getProjectName()).toFile(); if (f.exists()) { - if (f.isDirectory()) - setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$ - else + if (f.isDirectory()) { setErrorMessage(UIMessages.getString("CMainWizardPage.7")); //$NON-NLS-1$ - return false; + return true; // Sic !! Show message but allow creation. + } else { + setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$ + return false; + } } }