Fix 10861
authordadubrow
Wed, 10 Mar 2010 15:25:49 -0600
changeset 1090 02cf64aef519
parent 1089 c18e25401dcf
child 1096 96e5879cd42d
Fix 10861
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java	Wed Mar 10 14:08:04 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java	Wed Mar 10 15:25:49 2010 -0600
@@ -361,15 +361,17 @@
 	}
 	
 	protected void initUI() {
-		List<IPath> exes = data.getExes();
+		List<IPath> exes = data.getLaunchableExes();
 		projectExecutableViewer.setInput(exes);
 		IPath exeSelectionPath = data.getExeSelectionPath();
 		if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty())
 			exeSelectionPath = exes.get(0);
-		projectExecutableViewer.setSelection(new StructuredSelection(exeSelectionPath));
-		IPath remotePath = createSuggestedRemotePath(exeSelectionPath);
-		remoteProgramEntry.setText(PathUtils.convertPathToWindows(remotePath));
-
+		if (!Path.EMPTY.equals(exeSelectionPath)) {
+			projectExecutableViewer.setSelection(new StructuredSelection(exeSelectionPath));
+			IPath remotePath = createSuggestedRemotePath(exeSelectionPath);
+			remoteProgramEntry.setText(PathUtils.convertPathToWindows(remotePath));
+		}
+		
 		if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) {
 			projectExecutableRadioButton.forceFocus();
 		}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Wed Mar 10 14:08:04 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Wed Mar 10 15:25:49 2010 -0600
@@ -20,6 +20,7 @@
 import java.text.MessageFormat;
 
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Shell;
@@ -53,12 +54,14 @@
 	@Override
 	public void initializeSettings() {
 		data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE);
-		if (data.getExes().size() > 0)
-			data.setExeSelectionPath(data.getExes().get(0));
+		if (data.getLaunchableExes().size() > 0)
+			data.setExeSelectionPath(data.getLaunchableExes().get(0));
 		else if (data.getDefaultExecutable() != null)
 			data.setExeSelectionPath(data.getDefaultExecutable());
+		if (Path.EMPTY.equals(data.getExeSelectionPath()))
+			data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS);
 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject());
-		data.setInstallPackage(!data.isSysTRKConnection());
+		data.setInstallPackage(!data.isSysTRKConnection() && !data.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS));
 		if (cpi != null) {
 			ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
 			for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Wed Mar 10 14:08:04 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Wed Mar 10 15:25:49 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() {