Merge commits 1174, 1175, 1176, 1184, 1185 from default: RCL_2_4
authorEd Swartz <ed.swartz@nokia.com>
Fri, 09 Apr 2010 07:45:47 -0500
branchRCL_2_4
changeset 1191 0523013ddf00
parent 1182 090abdc9b9ee
child 1192 d1b481b25ae9
Merge commits 1174, 1175, 1176, 1184, 1185 from default: Fix issues not disposing listeners in PNP launch wizard Fix use of PathUtils: do not use new Path() on a Windows format path; this breaks in Linux. Bug 11067: fix some issues with the PNP launch wizard Connected service properties need to be propagated just as their statuses are
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ServiceTester.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java
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
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ServiceTester.java	Thu Apr 08 15:47:15 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ServiceTester.java	Fri Apr 09 07:45:47 2010 -0500
@@ -42,7 +42,7 @@
 		@Override
 		public void run() {
 			for (Set<AbstractConnectedService2> connectedServices : connectedServicesSets) {
-				// test first in the set and set status for others
+				// test first in the set and set status and properties for others
 				Iterator<AbstractConnectedService2> iterator = connectedServices.iterator();
 				AbstractConnectedService2 toTest = iterator.next();
 				toTest.testStatus();
@@ -50,6 +50,7 @@
 				while (iterator.hasNext()) {
 					AbstractConnectedService2 next = iterator.next();
 					next.setStatus((Status) status);
+					next.getProperties().putAll(toTest.getProperties());
 				}
 			}
 			unregisterThread(this);
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Thu Apr 08 15:47:15 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Fri Apr 09 07:45:47 2010 -0500
@@ -41,6 +41,8 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ControlAdapter;
 import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.FontMetrics;
@@ -118,6 +120,15 @@
 			}
 		});
 		manager.addConnectionListener(this);
+
+		parent.addDisposeListener(new DisposeListener() {
+			public void widgetDisposed(DisposeEvent e) {
+				manager.removeConnectionListener(ConnectToDeviceDialog.this);
+				
+				if (currentServiceListener != null)
+					currentServiceListener.removeStatusChangedListener(ConnectToDeviceDialog.this);
+			}
+		});
 		
 		final Composite buttonGroup = new Composite(viewerGroup, SWT.NONE);
 		int w = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN);
@@ -323,12 +334,5 @@
 			}
 		});
 	}
-	
-	@Override
-	public boolean close() {
-		manager.addConnectionListener(this);
-		return super.close();
-	}
-
 }
 
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java	Thu Apr 08 15:47:15 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java	Fri Apr 09 07:45:47 2010 -0500
@@ -452,8 +452,7 @@
 			data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE);
 			IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement();
 			if (selectedPath != null) {
-				String symbianPath = PathUtils.convertPathToWindows(selectedPath);
-				data.setExeSelectionPath(new Path(symbianPath));
+				data.setExeSelectionPath(selectedPath);
 			}
 			validate();
 		} else {
@@ -498,8 +497,8 @@
 		if (remoteExecutableRadioButton.getSelection()) {
 			remoteProgramEntry.setEnabled(true);
 			data.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE);
-			String symbianPath = PathUtils.convertPathToWindows(remoteProgramEntry.getText());
-			data.setExeSelectionPath(new Path(symbianPath));
+			IPath path = PathUtils.createPath(remoteProgramEntry.getText());
+			data.setExeSelectionPath(path);
 			validate();
 		} else {
 			remoteProgramEntry.setEnabled(false);
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Thu Apr 08 15:47:15 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java	Fri Apr 09 07:45:47 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 15:47:15 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java	Fri Apr 09 07:45:47 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 15:47:15 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/messages.properties	Fri Apr 09 07:45:47 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