1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Fix problems importing an executable into an existing project and having it recognized as a binary.

This commit is contained in:
Ken Ryall 2007-02-02 10:23:52 +00:00
parent e4e2222d0f
commit 8352714872

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Nokia and others. * Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -108,18 +108,17 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
* project receiving the executables * project receiving the executables
* @throws CoreException * @throws CoreException
*/ */
private void addExecutables(IProject project) throws CoreException { private void addExecutables(ICProject project) throws CoreException {
String[] executables = pageOne.getSelectedExecutables(); String[] executables = pageOne.getSelectedExecutables();
for (int i = 0; i < executables.length; i++) { for (int i = 0; i < executables.length; i++) {
IPath location = Path.fromOSString(executables[i]); IPath location = Path.fromOSString(executables[i]);
String executableName = location.toFile().getName(); String executableName = location.toFile().getName();
IFile exeFile = project.getFile(executableName); IFile exeFile = project.getProject().getFile(executableName);
if (!exeFile.exists()) if (!exeFile.exists())
exeFile.createLink(location, 0, null); exeFile.createLink(location, 0, null);
} }
} }
public void addPages() { public void addPages() {
@ -203,22 +202,16 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
ICProject targetProject = null; ICProject targetProject = null;
try { try {
if (pageTwo.isCreateNewProjectSelected()) { if (pageTwo.isCreateNewProjectSelected()) {
// Create a new project and add the executables and binary
// parsers.
IProject newProject = createCProjectForExecutable(pageTwo IProject newProject = createCProjectForExecutable(pageTwo
.getNewProjectName()); .getNewProjectName());
setupProject(newProject); setupProject(newProject);
addExecutables(newProject);
addBinaryParsers(newProject);
targetProject = CCorePlugin.getDefault().getCoreModel().create( targetProject = CCorePlugin.getDefault().getCoreModel().create(
newProject); newProject);
} else { } else {
// Assume the existing project already has binary parsers setup, targetProject = pageTwo.getExistingCProject();
// just add the executables.
ICProject existingProject = pageTwo.getExistingCProject();
addExecutables(existingProject.getProject());
targetProject = existingProject;
} }
addBinaryParsers(targetProject.getProject());
addExecutables(targetProject);
if (pageTwo.isCreateLaunchConfigurationSelected()) { if (pageTwo.isCreateLaunchConfigurationSelected()) {
createLaunchConfiguration(targetProject); createLaunchConfiguration(targetProject);
} }