mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 21:35:40 +02:00
Bug #43020 : allow creation project on a basis of existing one.
This commit is contained in:
parent
f65ab9e7f1
commit
9e61b19314
3 changed files with 28 additions and 7 deletions
|
@ -542,6 +542,8 @@ StdProjectTypeHandler.2=Default
|
||||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
|
|
||||||
CDTConfigWizardPage.0=Select configurations
|
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.0=CDT project
|
||||||
NewModelProjectWizard.1=Create CDT project of selected type
|
NewModelProjectWizard.1=Create CDT project of selected type
|
||||||
NewModelProjectWizard.2=C++ project
|
NewModelProjectWizard.2=C++ project
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||||
|
@ -113,6 +115,22 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
if (newProject != null && isChanged())
|
if (newProject != null && isChanged())
|
||||||
clearProject();
|
clearProject();
|
||||||
if (newProject == null) {
|
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 = fMainPage.h_selected;
|
||||||
savedHandler.saveState();
|
savedHandler.saveState();
|
||||||
lastProjectName = fMainPage.getProjectName();
|
lastProjectName = fMainPage.getProjectName();
|
||||||
|
@ -212,7 +230,6 @@ 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();
|
||||||
|
|
|
@ -336,9 +336,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName()))
|
if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName()))
|
||||||
bad = false;
|
bad = false;
|
||||||
}
|
}
|
||||||
if (bad) {
|
if (bad) { // Sic !! Show message but allow creation.
|
||||||
setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$
|
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();
|
if (p == null) p = ResourcesPlugin.getWorkspace().getRoot().getLocation();
|
||||||
File f = p.append(getProjectName()).toFile();
|
File f = p.append(getProjectName()).toFile();
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
if (f.isDirectory())
|
if (f.isDirectory()) {
|
||||||
setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
|
||||||
else
|
|
||||||
setErrorMessage(UIMessages.getString("CMainWizardPage.7")); //$NON-NLS-1$
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue