debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
branchRCL_2_4
changeset 1091 9ce8893d737f
parent 1068 21b582a02214
child 1191 0523013ddf00
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Wed Mar 10 08:43:57 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Wed Mar 10 15:28:22 2010 -0600
@@ -17,6 +17,7 @@
 
 package com.nokia.cdt.internal.debug.launch.newwizard;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
@@ -100,6 +101,7 @@
 	private boolean installPackage;
 	private String sisPath;
 	private IConnection connection;
+	private List<IPath> launchableExes;
 	
 	// settings made in the Other Settings section
 	enum EBuildBeforeLaunchOption {
@@ -159,6 +161,17 @@
 	public List<IPath> getExes() {
 		return exes;
 	}
+	
+	public List<IPath> getLaunchableExes() {
+		if (launchableExes == null) {
+			launchableExes = new ArrayList<IPath>();
+			for (IPath path : exes) {
+				if ("exe".equalsIgnoreCase(path.getFileExtension()))
+					launchableExes.add(path);
+			}
+		}
+		return launchableExes;
+	}
 
 	/**
 	 * @return the defaultExecutable
@@ -368,13 +381,15 @@
 		// otherwise, see if we can use the selected path - process to launch string
 		// by checking if the file name matches any of the ones in our list of exes
 		String filename = exeSelectionPath.lastSegment();
-		for (IPath exePath : exes) {
-			if (filename.equalsIgnoreCase(exePath.lastSegment())) {
-				return exePath;
+		if (filename != null) {
+			for (IPath exePath : exes) {
+				if (filename.equalsIgnoreCase(exePath.lastSegment())) {
+					return exePath;
+				}
 			}
 		}
 		// none could be found matching the selected path, so use the first in the list
-		return exes.isEmpty() ? Path.EMPTY : exes.get(0);
+		return getLaunchableExes().isEmpty() ? Path.EMPTY : getLaunchableExes().get(0);
 	}
 	
 	private IConnectedService getConnectedService() {