Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] launch fix

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- ChangeLog	4 Nov 2002 20:05:14 -0000	1.4
+++ ChangeLog	6 Nov 2002 16:56:36 -0000
@@ -1,3 +1,8 @@
+2002-11-06 David Inglis
+	* src/.../launch/ui/CMainTab.java
+	* src/.../launch/ui/ClaunchCOnfigurationTAb.java
+	fixed problem with preselection of project/program for new configurations
+	
 2002-11-04 David Inglis
 	* src/.../launch/ui/CDebuggerTab.java
 	* src/.../launch/ui/CMainTab.java
Index: src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java,v
retrieving revision 1.1
diff -u -r1.1 CLaunchConfigurationTab.java
--- src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java	23 Sep 2002 17:16:19 -0000	1.1
+++ src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java	6 Nov 2002 16:56:36 -0000
@@ -77,7 +77,8 @@
 				catch (CoreException e) {
 					return null;
 				}
-				if (descriptor.getPlatform().equals(platform)) {
+				String projectPlatform = descriptor.getPlatform();
+				if (projectPlatform.equals(platform) || projectPlatform.equals("*")) {
 					return (ICElement) obj;
 				}
 			}
Index: src/org/eclipse/cdt/launch/ui/CMainTab.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java,v
retrieving revision 1.10
diff -u -r1.10 CMainTab.java
--- src/org/eclipse/cdt/launch/ui/CMainTab.java	4 Nov 2002 20:05:14 -0000	1.10
+++ src/org/eclipse/cdt/launch/ui/CMainTab.java	6 Nov 2002 16:56:36 -0000
@@ -354,28 +354,33 @@
 	 * Set the program name attributes on the working copy based on the ICElement
 	 */
 	protected void initializeProgramName(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
-		String name = null;
+		IBinary binary = null;
 		if (cElement instanceof ICProject) {
 			IBinaryContainer bc = ((ICProject) cElement).getBinaryContainer();
 			IBinary[] bins = bc.getBinaries();
 			if (bins.length == 1) {
-				name = bins[0].getElementName();
+				binary = bins[0];
 			}
 		}
-		if (name == null) {
-			name = EMPTY_STRING;
-		}
-		config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, name);
-		if (name.length() > 0) {
-			int index = name.lastIndexOf('.');
-			if (index > 0) {
-				name = name.substring(index + 1);
+
+		if (binary != null) {
+			String path;
+			try {
+				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(index + 1);
+				}
+				name = getLaunchConfigurationDialog().generateName(name);
+				config.rename(name);
+			}
+			catch (CModelException e) {
 			}
-			name = getLaunchConfigurationDialog().generateName(name);
-			config.rename(name);
+
 		}
 	}
-
 	/**
 	 * @see ILaunchConfigurationTab#getName()
 	 */



Back to the top