Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorKen Ryall2007-07-04 19:59:15 +0000
committerKen Ryall2007-07-04 19:59:15 +0000
commit0d758fd9818ccc98b69cb38d7d92c514b9cac46f (patch)
treeb2a17ff69c6263add1d872b5e6bb211f700d462a /launch
parentea5018aece2b90f8b5ac57c1da054ef0cb56ad13 (diff)
downloadorg.eclipse.cdt-0d758fd9818ccc98b69cb38d7d92c514b9cac46f.tar.gz
org.eclipse.cdt-0d758fd9818ccc98b69cb38d7d92c514b9cac46f.tar.xz
org.eclipse.cdt-0d758fd9818ccc98b69cb38d7d92c514b9cac46f.zip
Bug 178731, launch configs know which build configuration to use. Also use the build config name in the default launch config name.
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java30
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java13
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java9
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java53
4 files changed, 94 insertions, 11 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
index 031f4233d2e..613dc9b6c3a 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 QNX Software Systems and others.
+ * Copyright (c) 2005, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - initial API and implementation
* Andrew Ferguson (andrew.ferguson@arm.com) - bug 123997
+ * Ken Ryall (Nokia) - bug 178731
*******************************************************************************/
package org.eclipse.cdt.launch;
@@ -33,12 +34,15 @@ import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.ui.newui.CDTPropertyManager;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -534,6 +538,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.building") + project.getName()); //$NON-NLS-1$
+ setBuildConfiguration(configuration, project);
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(monitor, scale));
} finally {
monitor.done();
@@ -543,6 +548,29 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
}
/**
+ * Sets up a project for building by making sure the active configuration is the one used
+ * when the launch was created.
+ * @param configuration
+ * @param buildProject
+ */
+ private void setBuildConfiguration(ILaunchConfiguration configuration, IProject buildProject) {
+
+ try {
+ String buildConfigID = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
+ ICProjectDescription projDes = CDTPropertyManager.getProjectDescription(buildProject);
+
+ if (buildConfigID.length() > 0 && projDes != null)
+ {
+ ICConfigurationDescription buildConfiguration = projDes.getConfigurationById(buildConfigID);
+ buildConfiguration.setActive();
+ CDTPropertyManager.performOk(null);
+ //AbstractPage.updateViews(buildProject);
+ }
+
+ } catch (CoreException e) {}
+ }
+
+ /**
* Searches for compile errors in the current project and any of its
* prerequisite projects. If any compile errors, give the user a chance to
* abort the launch and correct the errors.
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
index 69b7d2fcb23..3c719764a28 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Ken Ryall (Nokia) - bug 178731
*******************************************************************************/
package org.eclipse.cdt.launch.internal;
@@ -15,6 +16,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
@@ -189,7 +191,14 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, debugConfig.getID());
-
+
+ ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(bin.getCProject().getProject());
+ if (projDes != null)
+ {
+ String buildConfigID = projDes.getActiveConfiguration().getId();
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID);
+ }
+
// Load up the debugger page to set the defaults. There should probably be a separate
// extension point for this.
ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
@@ -419,7 +428,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
return;
}
int count = results.size();
- if (count == 0) {
+ if (count == 0) {
MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), LaunchMessages.getString("CApplicationLaunchShortcut.Launch_failed_no_binaries")); //$NON-NLS-1$ //$NON-NLS-2$
} else if (count > 1) {
bin = chooseBinary(results, mode);
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
index b7e48d6289d..721048eb316 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 QNX Software Systems and others.
+ * Copyright (c) 2005, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Ken Ryall (Nokia) - bug 178731
*******************************************************************************/
package org.eclipse.cdt.launch.ui;
@@ -15,6 +16,7 @@ import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.resources.IProject;
@@ -124,6 +126,11 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (cProject != null && cProject.exists()) {
name = cProject.getElementName();
config.setMappedResources(new IResource[] {cProject.getProject()});
+
+ ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(cProject.getProject());
+ String buildConfigID = projDes.getActiveConfiguration().getId();
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID);
+
}
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, name);
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index e653c998c87..80cbc574831 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * Ken Ryall (Nokia) - bug 178731
*******************************************************************************/
package org.eclipse.cdt.launch.ui;
@@ -22,6 +23,7 @@ import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
@@ -286,7 +288,15 @@ public class CMainTab extends CLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy config) {
ICProject cProject = this.getCProject();
if (cProject != null)
+ {
config.setMappedResources(new IResource[] { cProject.getProject() });
+ ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(cProject.getProject());
+ if (projDes != null)
+ {
+ String buildConfigID = projDes.getActiveConfiguration().getId();
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID);
+ }
+ }
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
if (fTerminalButton != null) {
@@ -617,6 +627,28 @@ public class CMainTab extends CLaunchConfigurationTab {
* Set the program name attributes on the working copy based on the ICElement
*/
protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
+
+ boolean renamed = false;
+
+ if (!(cElement instanceof IBinary))
+ {
+ cElement = cElement.getCProject();
+ }
+
+ if (cElement instanceof ICProject) {
+
+ IProject project = cElement.getCProject().getProject();
+ String name = project.getName();
+ ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
+ if (projDes != null) {
+ String buildConfigName = projDes.getActiveConfiguration().getName();
+ name = name + " " + buildConfigName; //$NON-NLS-1$
+ }
+ name = getLaunchConfigurationDialog().generateName(name);
+ config.rename(name);
+ renamed = true;
+ }
+
IBinary binary = null;
if (cElement instanceof ICProject) {
IBinary[] bins = getBinaryFiles((ICProject)cElement);
@@ -631,14 +663,21 @@ public class CMainTab extends CLaunchConfigurationTab {
String path;
path = binary.getResource().getProjectRelativePath().toOSString();
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, path);
- String name = binary.getElementName();
- int index = name.lastIndexOf('.');
- if (index > 0) {
- name = name.substring(0, index);
+ if (!renamed)
+ {
+ String name = binary.getElementName();
+ int index = name.lastIndexOf('.');
+ if (index > 0) {
+ name = name.substring(0, index);
+ }
+ name = getLaunchConfigurationDialog().generateName(name);
+ config.rename(name);
+ renamed = true;
}
- name = getLaunchConfigurationDialog().generateName(name);
- config.rename(name);
- } else {
+ }
+
+ if (!renamed)
+ {
String name = getLaunchConfigurationDialog().generateName(cElement.getCProject().getElementName());
config.rename(name);
}

Back to the top