debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
author dadubrow
Wed, 20 Oct 2010 09:35:54 -0500
changeset 2163 f0a9f2d04d4a
parent 2160 3a82092877ea
permissions -rw-r--r--
Refactor data model for new launch wizard
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     1
/*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     3
* All rights reserved.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     8
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     9
* Initial Contributors:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    11
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    12
* Contributors:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    13
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    14
* Description: 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    15
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    16
*/
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    17
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    18
package com.nokia.cdt.internal.debug.launch.newwizard;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    19
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
    20
import java.util.ArrayList;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    21
import java.util.Collection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    22
import java.util.List;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    23
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    24
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    25
import org.eclipse.core.resources.IProject;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    26
import org.eclipse.core.runtime.CoreException;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    27
import org.eclipse.core.runtime.IPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    28
import org.eclipse.core.runtime.IStatus;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    29
import org.eclipse.core.runtime.Path;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    30
import org.eclipse.core.runtime.Platform;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    31
import org.eclipse.core.runtime.Status;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    32
import org.eclipse.debug.core.DebugPlugin;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    33
import org.eclipse.debug.core.ILaunchConfigurationType;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    34
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    35
import org.eclipse.debug.core.ILaunchManager;
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    36
import org.osgi.framework.Bundle;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    37
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    38
import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    39
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    40
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    41
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    42
import com.nokia.carbide.remoteconnections.interfaces.IService;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    43
import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    44
import com.nokia.carbide.remoteconnections.internal.registry.Registry;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    45
import com.nokia.cdt.debug.cw.symbian.SettingsData;
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    46
import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    47
import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    48
import com.nokia.cpp.internal.api.utils.core.TextUtils;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    49
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    50
import cwdbg.PreferenceConstants;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    51
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    52
/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    53
 * Data manipulated by the launch wizard and its dialogs.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    54
 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    55
@SuppressWarnings("restriction")
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    56
public class LaunchWizardData extends LaunchOptions implements 
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    57
		IWizardData, 
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    58
		IConnectionWizardData,
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    59
		IDebugRunProcessWizardData,
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    60
		IOtherSettingsWizardData {
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    61
	/**
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    62
	 * This plugin is only shipped in internal layouts and is used as a fallback
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    63
	 * to determine whether Sys TRK is more likely to be available than App TRK 
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    64
	 * if we cannot otherwise tell.
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    65
	 */
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    66
	private static final String COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT = "com.nokia.carbide.symsee.trk.support";
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
    67
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    68
	public interface IPathValidator {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    69
		/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    70
		 * @param path IPath
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    71
		 * @return Error string or <code>null</code> if is valid
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    72
		 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    73
		String isValidPath(IPath path);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    74
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    75
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    76
	private IService service;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    77
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    78
	// overall target
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    79
	public static class LaunchType {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    80
		private final String launchId;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    81
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    82
		public LaunchType(String launchId) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    83
			this.launchId = launchId;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    84
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    85
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    86
		public boolean isApplicable(LaunchWizardData data) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    87
			return true;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    88
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    89
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    90
		public String getLaunchId() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    91
			return launchId;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    92
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    93
	};
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    94
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    95
	public final static LaunchType APP_TRK = new LaunchType(null);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    96
	public final static LaunchType SYS_TRK = new LaunchType(null);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    97
	public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    98
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    99
	private EExeSelection exeSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   100
	private IPath exeSelectionPath = Path.EMPTY;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   101
	private EBuildBeforeLaunchOption buildBeforeLaunch;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   102
	private boolean installPackage;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   103
	private String sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   104
	private IConnection connection;
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   105
	private List<IPath> launchableExes;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   106
	
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   107
	public LaunchWizardData() {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   108
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   109
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   110
	public void initialize(LaunchOptions launchOptions) {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   111
		this.mmps = launchOptions.mmps;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   112
		this.exes = launchOptions.exes;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   113
		this.defaultExecutable = launchOptions.defaultExecutable;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   114
		this.project = launchOptions.project;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   115
		this.configurationName = launchOptions.configurationName;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   116
		this.isEmulation = launchOptions.isEmulation;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   117
		this.emulatorOnly = launchOptions.emulatorOnly;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   118
		this.mode = launchOptions.mode;
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   119
		service = LaunchPlugin.getRunModeDebugService();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   120
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   121
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   122
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   123
	 * @return the service
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   124
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   125
	public IService getService() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   126
		return service;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   127
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   128
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   129
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   130
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   131
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   132
	public boolean isDebug() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   133
		return mode.equals(ILaunchManager.DEBUG_MODE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   134
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   135
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   136
	public String getModeLabel() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   137
		if (mode.equals(ILaunchManager.RUN_MODE))
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   138
			return Messages.getString("LaunchWizardData.RunModeLabel"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   139
		else if (mode.equals(ILaunchManager.DEBUG_MODE))
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   140
			return Messages.getString("LaunchWizardData.DebugModeLabel"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   141
		else
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   142
			return TextUtils.titleCase(mode);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   143
			
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   144
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   145
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   146
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   147
	 * Validate the detected and/or configured data
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   148
	 * @return IStatus, never <code>null</code>
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   149
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   150
	public IStatus validate() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   151
		return Status.OK_STATUS;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   152
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   153
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   154
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   155
	 * @return 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   156
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   157
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   158
	public List<IPath> getExes() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   159
		return exes;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   160
	}
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   161
	
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   162
	public List<IPath> getLaunchableExes() {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   163
		if (launchableExes == null) {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   164
			launchableExes = new ArrayList<IPath>();
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   165
			for (IPath path : exes) {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   166
				if ("exe".equalsIgnoreCase(path.getFileExtension()))
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   167
					launchableExes.add(path);
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   168
			}
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   169
		}
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   170
		return launchableExes;
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   171
	}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   172
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   173
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   174
	 * @return the defaultExecutable
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   175
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   176
	public IPath getDefaultExecutable() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   177
		return defaultExecutable;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   178
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   179
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   180
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   181
	 * Set the executable selection mode
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   182
	 * @param selection
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   183
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   184
	public void setExeSelection(EExeSelection selection) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   185
		this.exeSelection = selection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   186
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   187
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   188
	 * Set the path for the exe
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   189
	 * @param path or <code>null</code>
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   190
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   191
	public void setExeSelectionPath(IPath path) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   192
		this.exeSelectionPath = path != null ? path : Path.EMPTY;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   193
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   194
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   195
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   196
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   197
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   198
	public EExeSelection getExeSelection() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   199
		return exeSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   200
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   201
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   202
	public IPath getExeSelectionPath() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   203
		return exeSelectionPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   204
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   205
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   206
	public String getConnectionName() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   207
		IConnection connection = getConnection();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   208
		if (connection == null)
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   209
			return null;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   210
		return connection.getDisplayName();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   211
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   212
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   213
	public void setBuildBeforeLaunchOption(
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   214
			EBuildBeforeLaunchOption setting) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   215
		this.buildBeforeLaunch = setting;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   216
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   217
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   218
	public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   219
		return buildBeforeLaunch;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   220
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   221
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   222
	/** Get current workspace setting */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   223
	public boolean isWorkspaceBuildBeforeLaunch() {
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   224
		return WizardDataUtils.isWorkspaceBuildBeforeLaunch();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   225
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   226
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   227
	/** Get actual launch-time setting */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   228
	public boolean isCurrentBuildBeforeLaunch() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   229
		if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   230
			return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   231
		return isWorkspaceBuildBeforeLaunch();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   232
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   233
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   234
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   235
	 * @param selection
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   236
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   237
	public void setInstallPackage(boolean selection) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   238
		this.installPackage = selection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   239
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   240
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   241
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   242
	 * @return the installPackage
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   243
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   244
	public boolean isInstallPackage() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   245
		return installPackage;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   246
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   247
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   248
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   249
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   250
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   251
	public IProject getProject() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   252
		return project;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   253
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   254
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   255
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   256
	 * @param sisPath
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   257
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   258
	public void setSisPath(String sisPath) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   259
		this.sisPath = sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   260
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   261
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   262
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   263
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   264
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   265
	public String getSisPath() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   266
		return sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   267
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   268
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   269
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   270
	 * Copy the data, for use by a transient dialog.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   271
	 * @return new copy of data
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   272
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   273
	public LaunchWizardData copy() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   274
		LaunchOptions launchOptions = new LaunchOptions();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   275
		launchOptions.mmps = mmps;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   276
		launchOptions.exes = exes;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   277
		launchOptions.defaultExecutable = defaultExecutable;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   278
		launchOptions.project = project;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   279
		launchOptions.configurationName = configurationName;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   280
		launchOptions.isEmulation = isEmulation;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   281
		launchOptions.emulatorOnly = emulatorOnly;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   282
		launchOptions.mode = mode;
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   283
		LaunchWizardData d = new LaunchWizardData();
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   284
		d.initialize(launchOptions);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   285
		d.exeSelection = exeSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   286
		d.exeSelectionPath = exeSelectionPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   287
		d.buildBeforeLaunch = buildBeforeLaunch;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   288
		d.installPackage = installPackage;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   289
		d.sisPath = sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   290
		d.connection = connection;
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   291
		d.service = service;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   292
		return d;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   293
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   294
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   295
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   296
	 * Apply the given data to the receiver (when a transient dialog is accepted) 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   297
	 * @param dialogData
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   298
	 */
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   299
	public void apply(IWizardData launchWizardData) {
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   300
		LaunchWizardData dialogData = (LaunchWizardData) launchWizardData;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   301
		exeSelection = dialogData.exeSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   302
		exeSelectionPath = dialogData.exeSelectionPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   303
		buildBeforeLaunch = dialogData.buildBeforeLaunch;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   304
		installPackage = dialogData.installPackage;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   305
		sisPath = dialogData.sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   306
		connection = dialogData.connection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   307
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   308
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   309
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   310
	 * @return
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   311
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   312
	public boolean requiresInstallPackage() {
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   313
		return isSysTRKConnection() == Boolean.FALSE /* but not if unknown */ || installPackage;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   314
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   315
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   316
	public void setConnection(IConnection connection) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   317
		this.connection = connection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   318
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   319
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   320
	public IConnection getConnection() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   321
		return connection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   322
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   323
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   324
	public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   325
		String launchTypeId = getApplicableLaunchTypeId();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   326
		ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   327
		ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   328
		initializeConfigSettings(launchTypeId, config);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   329
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   330
		return config;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   331
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   332
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   333
	private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   334
		IPath exePath = getExePath();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   335
		IPath mmpPath = getMmpPath(exePath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   336
		if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   337
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   338
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   339
		else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   340
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   341
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   342
		else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   343
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   344
		}
1042
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   345
		if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE))
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   346
			SettingsData.setProcessToLaunch(config, exeSelectionPath);
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   347
		
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   348
		addBuildOptions(config);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   349
		// always set the current connection id
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   350
		config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID);
1069
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   351
		if (installPackage) {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   352
			config.setAttribute(PreferenceConstants.J_PN_SisFileHostPath, sisPath);
1069
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   353
			// special case handling for running out of E: drive - install into E: drive
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   354
			if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE) && 
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   355
					exeSelectionPath.getDevice().equalsIgnoreCase("E:")) //$NON-NLS-1$
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   356
				config.setAttribute(PreferenceConstants.J_PN_InstallToDrive, 4); // index 4 == E: drive
16060a6479b9 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1067
diff changeset
   357
		}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   358
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   359
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   360
	private IPath getMmpPath(IPath exePath) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   361
		if (!mmps.isEmpty()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   362
			for (int i = 0; i < exes.size(); i++) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   363
				IPath exe = exes.get(i);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   364
				if (exe.lastSegment().equals(exePath.lastSegment()))
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   365
					return mmps.get(i);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   366
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   367
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   368
		return null;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   369
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   370
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1042
diff changeset
   371
	public IPath getExePath() {
1042
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   372
		// if attach, doesn't matter so return first exe
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   373
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
1042
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   374
			return exes.isEmpty() ? Path.EMPTY : exes.get(0);
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   375
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   376
		// otherwise, see if we can use the selected path - process to launch string
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   377
		// by checking if the file name matches any of the ones in our list of exes
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   378
		String filename = exeSelectionPath.lastSegment();
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   379
		if (filename != null) {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   380
			for (IPath exePath : exes) {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   381
				if (filename.equalsIgnoreCase(exePath.lastSegment())) {
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   382
					return exePath;
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   383
				}
1042
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   384
			}
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   385
		}
a1a443e77261 bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 969
diff changeset
   386
		// none could be found matching the selected path, so use the first in the list
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1069
diff changeset
   387
		return getLaunchableExes().isEmpty() ? Path.EMPTY : getLaunchableExes().get(0);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   388
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   389
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   390
	private IConnectedService getConnectedService() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   391
		if (connection != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   392
			Collection<IConnectedService> connectedServices = 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   393
				RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   394
			for (IConnectedService connectedService : connectedServices) {
1968
3482df86a51d Remove TRK service and replace with TCF TRK service. Remove wildcard service check used as an interim when TCF TRK and TRK were both options.
Ed Swartz <ed.swartz@nokia.com>
parents: 1780
diff changeset
   395
				if (service != null && connectedService.getService().getIdentifier().equals(service.getIdentifier()))
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   396
					return connectedService;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   397
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   398
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   399
		return null;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   400
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   401
	
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   402
	/** Tell whether we can detect that the current connection is Sys TRK.
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   403
	 * 
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   404
	 * @return Boolean.TRUE if Sys TRK, Boolean.FALSE if App TRK, or <code>null</code> if unknown
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   405
	 */
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   406
	public Boolean isSysTRKConnection() {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   407
		IConnectedService connectedService = getConnectedService();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   408
		if (connectedService instanceof IConnectedService2) {
2023
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   409
			// C3TRK: old name
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   410
			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
1189
9efa81cf79bf Don't assume App TRK if service has no value at all for 'is-sys-trk' property
Ed Swartz <ed.swartz@nokia.com>
parents: 1186
diff changeset
   411
			if (value != null) {
9efa81cf79bf Don't assume App TRK if service has no value at all for 'is-sys-trk' property
Ed Swartz <ed.swartz@nokia.com>
parents: 1186
diff changeset
   412
				return Boolean.parseBoolean(value);
9efa81cf79bf Don't assume App TRK if service has no value at all for 'is-sys-trk' property
Ed Swartz <ed.swartz@nokia.com>
parents: 1186
diff changeset
   413
			}
2023
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   414
			
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   415
			// new name
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   416
			value = ((IConnectedService2) connectedService).getProperties().get("is-system-debugger"); //$NON-NLS-1$
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   417
			if (value != null) {
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   418
				return Boolean.parseBoolean(value);
54aa500f40cd Add check for CODA sys/app property
Ed Swartz <ed.swartz@nokia.com>
parents: 1968
diff changeset
   419
			}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   420
		}
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   421
		
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   422
		return null;
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   423
	}
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   424
	
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   425
	/**
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   426
	 * Tell whether Carbide is running in an internal layout.
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   427
	 * @return true if the installation includes known internal-only plugins
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   428
	 */
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   429
	public boolean isInternalLayout() {
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   430
		Bundle bundle = Platform.getBundle(COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT);
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   431
		if (bundle != null) {
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   432
			// assume this is an internal build 
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   433
			return true;
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   434
		}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   435
		return false;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   436
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   437
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   438
	private String getApplicableLaunchTypeId() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   439
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   440
			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
1186
067198a8221d Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   441
		else if (!installPackage)
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   442
			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   443
		else
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   444
			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   445
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   446
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   447
	private void addBuildOptions(ILaunchConfigurationWorkingCopy config) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   448
		int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   449
		switch (buildBeforeLaunch) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   450
		case NEVER:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   451
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   452
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   453
		case ALWAYS:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   454
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   455
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   456
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   457
		config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   458
	}
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
   459
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   460
}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   461