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
equal deleted inserted replaced
1185:02373fb1e121 1186:067198a8221d
    33 import org.eclipse.debug.core.DebugPlugin;
    33 import org.eclipse.debug.core.DebugPlugin;
    34 import org.eclipse.debug.core.ILaunchConfigurationType;
    34 import org.eclipse.debug.core.ILaunchConfigurationType;
    35 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
    35 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
    36 import org.eclipse.debug.core.ILaunchManager;
    36 import org.eclipse.debug.core.ILaunchManager;
    37 import org.eclipse.debug.ui.IDebugUIConstants;
    37 import org.eclipse.debug.ui.IDebugUIConstants;
       
    38 import org.osgi.framework.Bundle;
    38 import org.osgi.service.prefs.Preferences;
    39 import org.osgi.service.prefs.Preferences;
    39 
    40 
    40 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
    41 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
    41 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    42 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    42 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
    43 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
    53 /**
    54 /**
    54  * Data manipulated by the launch wizard and its dialogs.
    55  * Data manipulated by the launch wizard and its dialogs.
    55  */
    56  */
    56 @SuppressWarnings("restriction")
    57 @SuppressWarnings("restriction")
    57 public class LaunchWizardData extends LaunchOptions {
    58 public class LaunchWizardData extends LaunchOptions {
       
    59 	/**
       
    60 	 * This plugin is only shipped in internal layouts and is used as a fallback
       
    61 	 * to determine whether Sys TRK is more likely to be available than App TRK 
       
    62 	 * if we cannot otherwise tell.
       
    63 	 */
       
    64 	private static final String COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT = "com.nokia.carbide.symsee.trk.support";
       
    65 
    58 	public interface IPathValidator {
    66 	public interface IPathValidator {
    59 		/**
    67 		/**
    60 		 * @param path IPath
    68 		 * @param path IPath
    61 		 * @return Error string or <code>null</code> if is valid
    69 		 * @return Error string or <code>null</code> if is valid
    62 		 */
    70 		 */
   313 
   321 
   314 	/**
   322 	/**
   315 	 * @return
   323 	 * @return
   316 	 */
   324 	 */
   317 	public boolean requiresInstallPackage() {
   325 	public boolean requiresInstallPackage() {
   318 		return !isSysTRKConnection() || installPackage;
   326 		return isSysTRKConnection() == Boolean.FALSE /* but not if unknown */ || installPackage;
   319 	}
   327 	}
   320 
   328 
   321 	public void setConnection(IConnection connection) {
   329 	public void setConnection(IConnection connection) {
   322 		this.connection = connection;
   330 		this.connection = connection;
   323 	}
   331 	}
   402 			}
   410 			}
   403 		}
   411 		}
   404 		return null;
   412 		return null;
   405 	}
   413 	}
   406 	
   414 	
   407 	public boolean isSysTRKConnection() {
   415 	/** Tell whether we can detect that the current connection is Sys TRK.
       
   416 	 * 
       
   417 	 * @return Boolean.TRUE if Sys TRK, Boolean.FALSE if App TRK, or <code>null</code> if unknown
       
   418 	 */
       
   419 	public Boolean isSysTRKConnection() {
   408 		IConnectedService connectedService = getConnectedService();
   420 		IConnectedService connectedService = getConnectedService();
   409 		if (connectedService instanceof IConnectedService2) {
   421 		if (connectedService instanceof IConnectedService2) {
   410 			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
   422 			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
   411 			return Boolean.parseBoolean(value);
   423 			return Boolean.parseBoolean(value);
   412 		}
   424 		}
       
   425 		
       
   426 		return null;
       
   427 	}
       
   428 	
       
   429 	/**
       
   430 	 * Tell whether Carbide is running in an internal layout.
       
   431 	 * @return true if the installation includes known internal-only plugins
       
   432 	 */
       
   433 	public boolean isInternalLayout() {
       
   434 		Bundle bundle = Platform.getBundle(COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT);
       
   435 		if (bundle != null) {
       
   436 			// assume this is an internal build 
       
   437 			return true;
       
   438 		}
   413 		return false;
   439 		return false;
   414 	}
   440 	}
   415 
   441 
   416 	private String getApplicableLaunchTypeId() {
   442 	private String getApplicableLaunchTypeId() {
   417 		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
   443 		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
   418 			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
   444 			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
   419 		else if (!installPackage || isSysTRKConnection())
   445 		else if (!installPackage)
   420 			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
   446 			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
   421 		else
   447 		else
   422 			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
   448 			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
   423 	}
   449 	}
   424 
   450