Bug 11067: fix some issues with the PNP launch wizard
authorEd Swartz <ed.swartz@nokia.com>
Thu, 08 Apr 2010 15:03:50 -0500
changeset 1186 067198a8221d
parent 1185 02373fb1e121
child 1187 9842cb2130fd
Bug 11067: fix some issues with the PNP launch wizard 1) If Sys TRK is detected, and you select to install a package, a Sys TRK launch is created 2) Error message was confusing when Carbide chose to install a package but SIS configuration was not complete. 3) In an internal layout, assume Sys TRK is more likely than App TRK if we cannot tell from the connection.
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
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Thu Apr 08 14:41:29 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Thu Apr 08 15:03:50 2010 -0500
@@ -61,7 +61,9 @@
 		if (Path.EMPTY.equals(data.getExeSelectionPath()))
 			data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS);
 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject());
-		data.setInstallPackage(!data.isSysTRKConnection() && !data.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS));
+		data.setInstallPackage((data.isSysTRKConnection() == Boolean.FALSE  /* but NOT if unknown */
+								|| !data.isInternalLayout())
+				&& !data.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS));
 		if (cpi != null) {
 			ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
 			for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
@@ -103,7 +105,8 @@
 		}
 
 		if (data.isInstallPackage() && (data.getSisPath() == null || data.getSisPath().length() == 0))
-			status = error(Messages.getString("DebugRunProcessSection.MustInstallError")); //$NON-NLS-1$
+			status = error(Messages.getString("DebugRunProcessSection.MustInstallError"),
+					data.getModeLabel().toLowerCase()); //$NON-NLS-1$
 	}
 
 	@Override
@@ -118,10 +121,12 @@
 	
 			switch (data.getExeSelection()) {
 			case USE_PROJECT_EXECUTABLE:
-				runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), data.getExeSelectionPath().lastSegment()); //$NON-NLS-1$
+				runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), 
+						data.getExeSelectionPath().lastSegment()); //$NON-NLS-1$
 				break;
 			case USE_REMOTE_EXECUTABLE:
-				runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), PathUtils.convertPathToWindows(data.getExeSelectionPath())); //$NON-NLS-1$
+				runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), 
+						PathUtils.convertPathToWindows(data.getExeSelectionPath().toString())); //$NON-NLS-1$
 				break;
 			case ATTACH_TO_PROCESS:
 				runOrLaunchMsg = Messages.getString("DebugRunProcessSection.AttachMsg"); //$NON-NLS-1$
@@ -140,10 +145,10 @@
 	}
 
 	private String getCopyOrInstallMsg() {
-		if (data.isSysTRKConnection() || !data.isInstallPackage())
+		if (data.requiresInstallPackage())
+			return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), data.getSisPath()); //$NON-NLS-1$
+		else
 			return Messages.getString("DebugRunProcessSection.CopyMsg"); //$NON-NLS-1$
-		else
-			return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), data.getSisPath()); //$NON-NLS-1$
 	}
 
 }
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Thu Apr 08 14:41:29 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Thu Apr 08 15:03:50 2010 -0500
@@ -35,6 +35,7 @@
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.ui.IDebugUIConstants;
+import org.osgi.framework.Bundle;
 import org.osgi.service.prefs.Preferences;
 
 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
@@ -55,6 +56,13 @@
  */
 @SuppressWarnings("restriction")
 public class LaunchWizardData extends LaunchOptions {
+	/**
+	 * This plugin is only shipped in internal layouts and is used as a fallback
+	 * to determine whether Sys TRK is more likely to be available than App TRK 
+	 * if we cannot otherwise tell.
+	 */
+	private static final String COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT = "com.nokia.carbide.symsee.trk.support";
+
 	public interface IPathValidator {
 		/**
 		 * @param path IPath
@@ -315,7 +323,7 @@
 	 * @return
 	 */
 	public boolean requiresInstallPackage() {
-		return !isSysTRKConnection() || installPackage;
+		return isSysTRKConnection() == Boolean.FALSE /* but not if unknown */ || installPackage;
 	}
 
 	public void setConnection(IConnection connection) {
@@ -404,19 +412,37 @@
 		return null;
 	}
 	
-	public boolean isSysTRKConnection() {
+	/** Tell whether we can detect that the current connection is Sys TRK.
+	 * 
+	 * @return Boolean.TRUE if Sys TRK, Boolean.FALSE if App TRK, or <code>null</code> if unknown
+	 */
+	public Boolean isSysTRKConnection() {
 		IConnectedService connectedService = getConnectedService();
 		if (connectedService instanceof IConnectedService2) {
 			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
 			return Boolean.parseBoolean(value);
 		}
+		
+		return null;
+	}
+	
+	/**
+	 * Tell whether Carbide is running in an internal layout.
+	 * @return true if the installation includes known internal-only plugins
+	 */
+	public boolean isInternalLayout() {
+		Bundle bundle = Platform.getBundle(COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT);
+		if (bundle != null) {
+			// assume this is an internal build 
+			return true;
+		}
 		return false;
 	}
 
 	private String getApplicableLaunchTypeId() {
 		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
 			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
-		else if (!installPackage || isSysTRKConnection())
+		else if (!installPackage)
 			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
 		else
 			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties	Thu Apr 08 14:41:29 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties	Thu Apr 08 15:03:50 2010 -0500
@@ -36,12 +36,12 @@
 DebugRunProcessDialog.SISQueryTip=Specify which SIS file to install on the phone prior to launching
 DebugRunProcessDialog.Title=Select installation file
 DebugRunProcessSection.AttachMsg=attach to a process selected at launch time
-DebugRunProcessSection.ChangeMsg=Click the 'Change...' button to select another {0} method.
+DebugRunProcessSection.ChangeMsg=Click the 'Change...' button to modify the {0} method.
 DebugRunProcessSection.CopyMsg=copy files to the device
-DebugRunProcessSection.InstallMsg=install "{0}"
+DebugRunProcessSection.InstallMsg=install ''{0}''
 DebugRunProcessSection.LaunchFormat=launch ''{0}''
 DebugRunProcessSection.MainFormat=Carbide will {0} and {1}.
-DebugRunProcessSection.MustInstallError=Carbide must install a package to debug this project.
+DebugRunProcessSection.MustInstallError=Carbide must install a package to {0} but the settings are incomplete.
 DebugRunProcessSection.NoExesError=This project does not build any executables.
 DebugRunProcessSection.NoRemoteExeError=No remote executable is selected.
 DebugRunProcessSection.Title={0} process