debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
author dadubrow
Wed, 03 Mar 2010 08:42:58 -0600
branchRCL_2_4
changeset 1068 21b582a02214
parent 1066 4791b1e2e6ef
child 1091 9ce8893d737f
permissions -rw-r--r--
10823 - if installing and launching from E:, install into E: also
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     1
/*
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     3
* All rights reserved.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     4
* This component and the accompanying materials are made available
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     6
* which accompanies this distribution, and is available
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     8
*
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
     9
* Initial Contributors:
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    11
*
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    12
* Contributors:
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    13
*
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    14
* Description: 
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    15
*
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    16
*/
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    17
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    18
package com.nokia.cdt.internal.debug.launch.newwizard;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    19
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    20
import java.util.Collection;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    21
import java.util.List;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    22
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    23
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    24
import org.eclipse.core.resources.IProject;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    25
import org.eclipse.core.runtime.CoreException;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    26
import org.eclipse.core.runtime.IPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    27
import org.eclipse.core.runtime.IStatus;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    28
import org.eclipse.core.runtime.Path;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    29
import org.eclipse.core.runtime.Platform;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    30
import org.eclipse.core.runtime.Status;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    31
import org.eclipse.core.runtime.preferences.InstanceScope;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    32
import org.eclipse.debug.core.DebugPlugin;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    33
import org.eclipse.debug.core.ILaunchConfigurationType;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    34
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    35
import org.eclipse.debug.core.ILaunchManager;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    36
import org.eclipse.debug.ui.IDebugUIConstants;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    37
import org.osgi.service.prefs.Preferences;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    38
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    39
import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    40
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    41
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    42
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    43
import com.nokia.carbide.remoteconnections.interfaces.IService;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    44
import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    45
import com.nokia.carbide.remoteconnections.internal.registry.Registry;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    46
import com.nokia.cdt.debug.cw.symbian.SettingsData;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    47
import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    48
import com.nokia.cpp.internal.api.utils.core.TextUtils;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    49
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    50
import cwdbg.PreferenceConstants;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    51
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    52
/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    53
 * Data manipulated by the launch wizard and its dialogs.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    54
 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    55
@SuppressWarnings("restriction")
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    56
public class LaunchWizardData extends LaunchOptions {
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    57
	public interface IPathValidator {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    58
		/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    59
		 * @param path IPath
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    60
		 * @return Error string or <code>null</code> if is valid
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    61
		 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    62
		String isValidPath(IPath path);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    63
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    64
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    65
	private final IService service;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    66
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    67
	// overall target
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    68
	public static class LaunchType {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    69
		private final String launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    70
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    71
		public LaunchType(String launchId) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    72
			this.launchId = launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    73
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    74
		
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    75
		public boolean isApplicable(LaunchWizardData data) {
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    76
			return true;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    77
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    78
		
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    79
		public String getLaunchId() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    80
			return launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    81
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    82
	};
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    83
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    84
	public final static LaunchType APP_TRK = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    85
	public final static LaunchType SYS_TRK = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    86
	public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    87
	public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    88
	public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    89
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    90
	// settings made in Debug/Run Process section
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    91
	enum EExeSelection {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    92
		USE_PROJECT_EXECUTABLE,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    93
		USE_REMOTE_EXECUTABLE,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    94
		ATTACH_TO_PROCESS,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    95
	};
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    96
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    97
	private EExeSelection exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    98
	private IPath exeSelectionPath = Path.EMPTY;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    99
	private EBuildBeforeLaunchOption buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   100
	private boolean installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   101
	private String sisPath;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   102
	private IConnection connection;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   103
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   104
	// settings made in the Other Settings section
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   105
	enum EBuildBeforeLaunchOption {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   106
		ALWAYS,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   107
		NEVER,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   108
		USE_WORKSPACE_SETTING,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   109
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   110
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   111
	public LaunchWizardData(LaunchOptions launchOptions, IService trkService) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   112
		this.mmps = launchOptions.mmps;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   113
		this.exes = launchOptions.exes;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   114
		this.defaultExecutable = launchOptions.defaultExecutable;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   115
		this.project = launchOptions.project;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   116
		this.configurationName = launchOptions.configurationName;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   117
		this.isEmulation = launchOptions.isEmulation;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   118
		this.emulatorOnly = launchOptions.emulatorOnly;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   119
		this.mode = launchOptions.mode;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   120
		this.service = trkService;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   121
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   122
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   123
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   124
	 * @return the service
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   125
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   126
	public IService getService() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   127
		return service;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   128
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   129
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   130
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   131
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   132
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   133
	public boolean isDebug() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   134
		return mode.equals(ILaunchManager.DEBUG_MODE);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   135
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   136
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   137
	public String getModeLabel() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   138
		if (mode.equals(ILaunchManager.RUN_MODE))
966
15c9cbbf6707 externalize strings
dadubrow
parents: 953
diff changeset
   139
			return Messages.getString("LaunchWizardData.RunModeLabel"); //$NON-NLS-1$
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   140
		else if (mode.equals(ILaunchManager.DEBUG_MODE))
966
15c9cbbf6707 externalize strings
dadubrow
parents: 953
diff changeset
   141
			return Messages.getString("LaunchWizardData.DebugModeLabel"); //$NON-NLS-1$
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   142
		else
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   143
			return TextUtils.titleCase(mode);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   144
			
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   145
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   146
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   147
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   148
	 * Validate the detected and/or configured data
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   149
	 * @return IStatus, never <code>null</code>
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   150
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   151
	public IStatus validate() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   152
		return Status.OK_STATUS;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   153
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   154
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   155
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   156
	 * @return 
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   157
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   158
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   159
	public List<IPath> getExes() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   160
		return exes;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   161
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   162
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   163
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   164
	 * @return the defaultExecutable
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   165
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   166
	public IPath getDefaultExecutable() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   167
		return defaultExecutable;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   168
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   169
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   170
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   171
	 * Set the executable selection mode
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   172
	 * @param selection
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   173
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   174
	public void setExeSelection(EExeSelection selection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   175
		this.exeSelection = selection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   176
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   177
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   178
	 * Set the path for the exe
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   179
	 * @param path or <code>null</code>
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   180
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   181
	public void setExeSelectionPath(IPath path) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   182
		this.exeSelectionPath = path != null ? path : Path.EMPTY;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   183
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   184
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   185
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   186
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   187
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   188
	public EExeSelection getExeSelection() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   189
		return exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   190
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   191
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   192
	public IPath getExeSelectionPath() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   193
		return exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   194
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   195
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   196
	public String getConnectionName() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   197
		IConnection connection = getConnection();
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   198
		if (connection == null)
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   199
			return null;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   200
		return connection.getDisplayName();
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   201
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   202
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   203
	public void setBuildBeforeLaunchOption(
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   204
			EBuildBeforeLaunchOption setting) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   205
		this.buildBeforeLaunch = setting;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   206
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   207
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   208
	public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   209
		return buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   210
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   211
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   212
	/** Get current workspace setting */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   213
	public boolean isWorkspaceBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   214
		// here's how to get the prefs from a plugin's #getPreferenceStore() without violating access
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   215
		String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   216
		int idx = prefId.lastIndexOf('.');
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   217
		String plugin = prefId.substring(0, idx);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   218
		Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   219
		return node.getBoolean(prefId, true);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   220
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   221
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   222
	/** Get actual launch-time setting */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   223
	public boolean isCurrentBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   224
		if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   225
			return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   226
		return isWorkspaceBuildBeforeLaunch();
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   227
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   228
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   229
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   230
	 * @param selection
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   231
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   232
	public void setInstallPackage(boolean selection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   233
		this.installPackage = selection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   234
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   235
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   236
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   237
	 * @return the installPackage
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   238
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   239
	public boolean isInstallPackage() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   240
		return installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   241
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   242
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   243
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   244
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   245
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   246
	public IProject getProject() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   247
		return project;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   248
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   249
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   250
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   251
	 * @param sisPath
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   252
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   253
	public void setSisPath(String sisPath) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   254
		this.sisPath = sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   255
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   256
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   257
	/**
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   258
	 * @return
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   259
	 */
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   260
	public String getSisPath() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   261
		return sisPath;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   262
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   263
	
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   264
	/**
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   265
	 * Copy the data, for use by a transient dialog.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   266
	 * @return new copy of data
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   267
	 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   268
	public LaunchWizardData copy() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   269
		LaunchOptions launchOptions = new LaunchOptions();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   270
		launchOptions.mmps = mmps;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   271
		launchOptions.exes = exes;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   272
		launchOptions.defaultExecutable = defaultExecutable;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   273
		launchOptions.project = project;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   274
		launchOptions.configurationName = configurationName;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   275
		launchOptions.isEmulation = isEmulation;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   276
		launchOptions.emulatorOnly = emulatorOnly;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   277
		launchOptions.mode = mode;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   278
		LaunchWizardData d = new LaunchWizardData(launchOptions, service);
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   279
		d.exeSelection = exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   280
		d.exeSelectionPath = exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   281
		d.buildBeforeLaunch = buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   282
		d.installPackage = installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   283
		d.sisPath = sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   284
		d.connection = connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   285
		return d;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   286
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   287
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   288
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   289
	 * Apply the given data to the receiver (when a transient dialog is accepted) 
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   290
	 * @param dialogData
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   291
	 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   292
	public void apply(LaunchWizardData dialogData) {
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   293
		exeSelection = dialogData.exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   294
		exeSelectionPath = dialogData.exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   295
		buildBeforeLaunch = dialogData.buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   296
		installPackage = dialogData.installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   297
		sisPath = dialogData.sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   298
		connection = dialogData.connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   299
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   300
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   301
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   302
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   303
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   304
	public boolean requiresInstallPackage() {
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   305
		return !isSysTRKConnection() || installPackage;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   306
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   307
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   308
	public void setConnection(IConnection connection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   309
		this.connection = connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   310
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   311
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   312
	public IConnection getConnection() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   313
		return connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   314
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   315
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   316
	public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   317
		String launchTypeId = getApplicableLaunchTypeId();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   318
		ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   319
		ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   320
		initializeConfigSettings(launchTypeId, config);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   321
		
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   322
		return config;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   323
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   324
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   325
	private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   326
		IPath exePath = getExePath();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   327
		IPath mmpPath = getMmpPath(exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   328
		if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   329
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   330
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   331
		else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   332
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   333
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   334
		else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   335
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   336
		}
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   337
		if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE))
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   338
			SettingsData.setProcessToLaunch(config, exeSelectionPath);
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   339
		
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   340
		addBuildOptions(config);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   341
		// always set the current connection id
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   342
		config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID);
1068
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   343
		if (installPackage) {
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   344
			config.setAttribute(PreferenceConstants.J_PN_SisFileHostPath, sisPath);
1068
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   345
			// special case handling for running out of E: drive - install into E: drive
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   346
			if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE) && 
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   347
					exeSelectionPath.getDevice().equalsIgnoreCase("E:")) //$NON-NLS-1$
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   348
				config.setAttribute(PreferenceConstants.J_PN_InstallToDrive, 4); // index 4 == E: drive
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   349
		}
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   350
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   351
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   352
	private IPath getMmpPath(IPath exePath) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   353
		if (!mmps.isEmpty()) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   354
			for (int i = 0; i < exes.size(); i++) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   355
				IPath exe = exes.get(i);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   356
				if (exe.lastSegment().equals(exePath.lastSegment()))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   357
					return mmps.get(i);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   358
			}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   359
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   360
		return null;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   361
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   362
1066
4791b1e2e6ef 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1041
diff changeset
   363
	public IPath getExePath() {
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   364
		// if attach, doesn't matter so return first exe
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   365
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   366
			return exes.isEmpty() ? Path.EMPTY : exes.get(0);
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   367
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   368
		// otherwise, see if we can use the selected path - process to launch string
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   369
		// by checking if the file name matches any of the ones in our list of exes
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   370
		String filename = exeSelectionPath.lastSegment();
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   371
		for (IPath exePath : exes) {
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   372
			if (filename.equalsIgnoreCase(exePath.lastSegment())) {
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   373
				return exePath;
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   374
			}
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   375
		}
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   376
		// none could be found matching the selected path, so use the first in the list
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   377
		return exes.isEmpty() ? Path.EMPTY : exes.get(0);
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   378
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   379
	
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   380
	private IConnectedService getConnectedService() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   381
		if (connection != null) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   382
			Collection<IConnectedService> connectedServices = 
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   383
				RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   384
			for (IConnectedService connectedService : connectedServices) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   385
				if (connectedService.getService().getIdentifier().equals(service.getIdentifier()))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   386
					return connectedService;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   387
			}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   388
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   389
		return null;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   390
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   391
	
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   392
	public boolean isSysTRKConnection() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   393
		IConnectedService connectedService = getConnectedService();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   394
		if (connectedService instanceof IConnectedService2) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   395
			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   396
			return Boolean.parseBoolean(value);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   397
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   398
		return false;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   399
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   400
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   401
	private String getApplicableLaunchTypeId() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   402
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   403
			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   404
		else if (!installPackage || isSysTRKConnection())
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   405
			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   406
		else
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   407
			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   408
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   409
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   410
	private void addBuildOptions(ILaunchConfigurationWorkingCopy config) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   411
		int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   412
		switch (buildBeforeLaunch) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   413
		case NEVER:
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   414
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   415
			break;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   416
		case ALWAYS:
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   417
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   418
			break;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   419
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   420
		config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   421
	}
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   422
}
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   423