mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
bug 322169: New Makefile Project with Existing Code wizard silently fails
This commit is contained in:
parent
59d692e064
commit
e2a392976f
1 changed files with 44 additions and 34 deletions
|
@ -26,11 +26,13 @@ import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
@ -63,7 +65,7 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
@Override
|
@Override
|
||||||
public boolean performFinish() {
|
public boolean performFinish() {
|
||||||
final String projectName = page.getProjectName();
|
final String projectName = page.getProjectName();
|
||||||
final String location = page.getLocation();
|
final String locationStr = page.getLocation();
|
||||||
final boolean isCPP = page.isCPP();
|
final boolean isCPP = page.isCPP();
|
||||||
final IToolChain toolChain = page.getToolChain();
|
final IToolChain toolChain = page.getToolChain();
|
||||||
|
|
||||||
|
@ -74,12 +76,18 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
monitor.beginTask(Messages.NewMakeProjFromExisting_1, 10);
|
monitor.beginTask(Messages.NewMakeProjFromExisting_1, 10);
|
||||||
|
|
||||||
// Create Project
|
// Create Project
|
||||||
|
try {
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
IProject project = workspace.getRoot().getProject(projectName);
|
IProject project = workspace.getRoot().getProject(projectName);
|
||||||
|
|
||||||
// TODO handle the case where a .project file was already there
|
// TODO handle the case where a .project file was already there
|
||||||
IProjectDescription description = workspace.newProjectDescription(project.getName());
|
|
||||||
description.setLocation(new Path(location));
|
IProjectDescription description = workspace.newProjectDescription(projectName);
|
||||||
|
IPath defaultLocation = workspace.getRoot().getLocation().append(projectName);
|
||||||
|
Path location = new Path(locationStr);
|
||||||
|
if (!location.isEmpty() && !location.equals(defaultLocation)) {
|
||||||
|
description.setLocation(location);
|
||||||
|
}
|
||||||
|
|
||||||
CCorePlugin.getDefault().createCDTProject(description, project, monitor);
|
CCorePlugin.getDefault().createCDTProject(description, project, monitor);
|
||||||
|
|
||||||
|
@ -105,7 +113,9 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
|
|
||||||
pdMgr.setProjectDescription(project, projDesc);
|
pdMgr.setProjectDescription(project, projDesc);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
ManagedBuilderUIPlugin.log(e);
|
||||||
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue