debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
changeset 1186 067198a8221d
parent 1090 02cf64aef519
child 1189 9efa81cf79bf
--- 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;