debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java
changeset 229 ba58b2ff6c3e
parent 214 a32fb2f6b065
child 245 0575745dfefb
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java	Mon Jun 08 14:26:06 2009 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/ExecutablesTab.java	Thu Jun 11 16:14:53 2009 -0500
@@ -271,20 +271,27 @@
 				programName = AbstractCLaunchDelegate.getProgramName(configuration);
 			} catch (CoreException e) {
 			}
-			boolean resetProgramName = true;
-			// check to see if the current program name is one of the executables to target
-			for (ExeFileToDebug exeFileToDebug : executablesToTarget) {
-				if (exeFileToDebug.getExePath().equalsIgnoreCase(programName)) {
-					resetProgramName = false;
-					break;
+			
+			// only do this when the current program name is not empty.  if it is, we'll be changing it
+			// which causes the apply button to become enabled which is not expected behavior.  this will
+			// be called later if/when they do specify the main program, so we'll make sure then that it's
+			// actually being targeted.
+			if (programName.length() > 0) {
+				boolean resetProgramName = true;
+				// check to see if the current program name is one of the executables to target
+				for (ExeFileToDebug exeFileToDebug : executablesToTarget) {
+					if (exeFileToDebug.getExePath().equalsIgnoreCase(programName)) {
+						resetProgramName = false;
+						break;
+					}
 				}
-			}
-			if (resetProgramName) {
-				// ensure one of the enabled files to target is set as the program name
-				for (ExeFileToDebug exeFileToDebug : executablesToTarget) {
-					if (exeFileToDebug.getEnabled()) {
-						configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, exeFileToDebug.getExePath());
-						break;
+				if (resetProgramName) {
+					// ensure one of the enabled files to target is set as the program name
+					for (ExeFileToDebug exeFileToDebug : executablesToTarget) {
+						if (exeFileToDebug.getEnabled()) {
+							configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, exeFileToDebug.getExePath());
+							break;
+						}
 					}
 				}
 			}