debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java
author Ed Swartz <ed.swartz@nokia.com>
Fri, 09 Apr 2010 07:45:47 -0500
branchRCL_2_4
changeset 1191 0523013ddf00
parent 1091 9ce8893d737f
child 1192 d1b481b25ae9
permissions -rw-r--r--
Merge commits 1174, 1175, 1176, 1184, 1185 from default: Fix issues not disposing listeners in PNP launch wizard Fix use of PathUtils: do not use new Path() on a Windows format path; this breaks in Linux. Bug 11067: fix some issues with the PNP launch wizard Connected service properties need to be propagated just as their statuses are
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
1091
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
    20
import java.util.ArrayList;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    21
import java.util.Collection;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    22
import java.util.List;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    23
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    24
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    25
import org.eclipse.core.resources.IProject;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    26
import org.eclipse.core.runtime.CoreException;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    27
import org.eclipse.core.runtime.IPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    28
import org.eclipse.core.runtime.IStatus;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    29
import org.eclipse.core.runtime.Path;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    30
import org.eclipse.core.runtime.Platform;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    31
import org.eclipse.core.runtime.Status;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    32
import org.eclipse.core.runtime.preferences.InstanceScope;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    33
import org.eclipse.debug.core.DebugPlugin;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    34
import org.eclipse.debug.core.ILaunchConfigurationType;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    35
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    36
import org.eclipse.debug.core.ILaunchManager;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    37
import org.eclipse.debug.ui.IDebugUIConstants;
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    38
import org.osgi.framework.Bundle;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    39
import org.osgi.service.prefs.Preferences;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    40
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    41
import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    42
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    43
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    44
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    45
import com.nokia.carbide.remoteconnections.interfaces.IService;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    46
import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    47
import com.nokia.carbide.remoteconnections.internal.registry.Registry;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    48
import com.nokia.cdt.debug.cw.symbian.SettingsData;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    49
import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    50
import com.nokia.cpp.internal.api.utils.core.TextUtils;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    51
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    52
import cwdbg.PreferenceConstants;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    53
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    54
/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    55
 * Data manipulated by the launch wizard and its dialogs.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    56
 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    57
@SuppressWarnings("restriction")
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    58
public class LaunchWizardData extends LaunchOptions {
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    59
	/**
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    60
	 * This plugin is only shipped in internal layouts and is used as a fallback
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    61
	 * to determine whether Sys TRK is more likely to be available than App TRK 
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    62
	 * if we cannot otherwise tell.
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    63
	 */
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    64
	private static final String COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT = "com.nokia.carbide.symsee.trk.support";
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
    65
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    66
	public interface IPathValidator {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    67
		/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    68
		 * @param path IPath
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    69
		 * @return Error string or <code>null</code> if is valid
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    70
		 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    71
		String isValidPath(IPath path);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    72
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    73
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    74
	private final IService service;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    75
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    76
	// overall target
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    77
	public static class LaunchType {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    78
		private final String launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    79
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    80
		public LaunchType(String launchId) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    81
			this.launchId = launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    82
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    83
		
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
    84
		public boolean isApplicable(LaunchWizardData data) {
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    85
			return true;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    86
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    87
		
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    88
		public String getLaunchId() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    89
			return launchId;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    90
		}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    91
	};
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    92
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    93
	public final static LaunchType APP_TRK = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    94
	public final static LaunchType SYS_TRK = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    95
	public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    96
	public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    97
	public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    98
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
    99
	// settings made in Debug/Run Process section
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   100
	enum EExeSelection {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   101
		USE_PROJECT_EXECUTABLE,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   102
		USE_REMOTE_EXECUTABLE,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   103
		ATTACH_TO_PROCESS,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   104
	};
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   105
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   106
	private EExeSelection exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   107
	private IPath exeSelectionPath = Path.EMPTY;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   108
	private EBuildBeforeLaunchOption buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   109
	private boolean installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   110
	private String sisPath;
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   111
	private IConnection connection;
1091
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   112
	private List<IPath> launchableExes;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   113
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   114
	// settings made in the Other Settings section
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   115
	enum EBuildBeforeLaunchOption {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   116
		ALWAYS,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   117
		NEVER,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   118
		USE_WORKSPACE_SETTING,
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   119
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   120
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   121
	public LaunchWizardData(LaunchOptions launchOptions, IService trkService) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   122
		this.mmps = launchOptions.mmps;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   123
		this.exes = launchOptions.exes;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   124
		this.defaultExecutable = launchOptions.defaultExecutable;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   125
		this.project = launchOptions.project;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   126
		this.configurationName = launchOptions.configurationName;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   127
		this.isEmulation = launchOptions.isEmulation;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   128
		this.emulatorOnly = launchOptions.emulatorOnly;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   129
		this.mode = launchOptions.mode;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   130
		this.service = trkService;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   131
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   132
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   133
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   134
	 * @return the service
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   135
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   136
	public IService getService() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   137
		return service;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   138
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   139
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   140
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   141
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   142
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   143
	public boolean isDebug() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   144
		return mode.equals(ILaunchManager.DEBUG_MODE);
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
	public String getModeLabel() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   148
		if (mode.equals(ILaunchManager.RUN_MODE))
966
15c9cbbf6707 externalize strings
dadubrow
parents: 953
diff changeset
   149
			return Messages.getString("LaunchWizardData.RunModeLabel"); //$NON-NLS-1$
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   150
		else if (mode.equals(ILaunchManager.DEBUG_MODE))
966
15c9cbbf6707 externalize strings
dadubrow
parents: 953
diff changeset
   151
			return Messages.getString("LaunchWizardData.DebugModeLabel"); //$NON-NLS-1$
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   152
		else
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   153
			return TextUtils.titleCase(mode);
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
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   157
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   158
	 * Validate the detected and/or configured data
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   159
	 * @return IStatus, never <code>null</code>
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   160
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   161
	public IStatus validate() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   162
		return Status.OK_STATUS;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   163
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   164
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   165
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   166
	 * @return 
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   167
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   168
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   169
	public List<IPath> getExes() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   170
		return exes;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   171
	}
1091
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   172
	
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   173
	public List<IPath> getLaunchableExes() {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   174
		if (launchableExes == null) {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   175
			launchableExes = new ArrayList<IPath>();
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   176
			for (IPath path : exes) {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   177
				if ("exe".equalsIgnoreCase(path.getFileExtension()))
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   178
					launchableExes.add(path);
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   179
			}
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   180
		}
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   181
		return launchableExes;
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   182
	}
911
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
	 * @return the defaultExecutable
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   186
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   187
	public IPath getDefaultExecutable() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   188
		return defaultExecutable;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   189
	}
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
	 * Set the executable selection mode
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   193
	 * @param selection
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   194
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   195
	public void setExeSelection(EExeSelection selection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   196
		this.exeSelection = selection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   197
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   198
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   199
	 * Set the path for the exe
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   200
	 * @param path or <code>null</code>
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   201
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   202
	public void setExeSelectionPath(IPath path) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   203
		this.exeSelectionPath = path != null ? path : Path.EMPTY;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   204
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   205
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   206
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   207
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   208
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   209
	public EExeSelection getExeSelection() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   210
		return exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   211
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   212
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   213
	public IPath getExeSelectionPath() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   214
		return exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   215
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   216
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   217
	public String getConnectionName() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   218
		IConnection connection = getConnection();
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   219
		if (connection == null)
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   220
			return null;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   221
		return connection.getDisplayName();
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   222
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   223
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   224
	public void setBuildBeforeLaunchOption(
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   225
			EBuildBeforeLaunchOption setting) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   226
		this.buildBeforeLaunch = setting;
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
	public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   230
		return buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   231
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   232
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   233
	/** Get current workspace setting */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   234
	public boolean isWorkspaceBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   235
		// here's how to get the prefs from a plugin's #getPreferenceStore() without violating access
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   236
		String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   237
		int idx = prefId.lastIndexOf('.');
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   238
		String plugin = prefId.substring(0, idx);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   239
		Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin);
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   240
		return node.getBoolean(prefId, true);
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
	/** Get actual launch-time setting */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   244
	public boolean isCurrentBuildBeforeLaunch() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   245
		if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   246
			return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   247
		return isWorkspaceBuildBeforeLaunch();
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 selection
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   252
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   253
	public void setInstallPackage(boolean selection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   254
		this.installPackage = selection;
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
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   258
	 * @return the installPackage
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   259
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   260
	public boolean isInstallPackage() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   261
		return installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   262
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   263
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   264
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   265
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   266
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   267
	public IProject getProject() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   268
		return project;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   269
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   270
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   271
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   272
	 * @param sisPath
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   273
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   274
	public void setSisPath(String sisPath) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   275
		this.sisPath = sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   276
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   277
	
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   278
	/**
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   279
	 * @return
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   280
	 */
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   281
	public String getSisPath() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   282
		return sisPath;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   283
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   284
	
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   285
	/**
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   286
	 * Copy the data, for use by a transient dialog.
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   287
	 * @return new copy of data
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   288
	 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   289
	public LaunchWizardData copy() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   290
		LaunchOptions launchOptions = new LaunchOptions();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   291
		launchOptions.mmps = mmps;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   292
		launchOptions.exes = exes;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   293
		launchOptions.defaultExecutable = defaultExecutable;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   294
		launchOptions.project = project;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   295
		launchOptions.configurationName = configurationName;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   296
		launchOptions.isEmulation = isEmulation;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   297
		launchOptions.emulatorOnly = emulatorOnly;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   298
		launchOptions.mode = mode;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   299
		LaunchWizardData d = new LaunchWizardData(launchOptions, service);
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   300
		d.exeSelection = exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   301
		d.exeSelectionPath = exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   302
		d.buildBeforeLaunch = buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   303
		d.installPackage = installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   304
		d.sisPath = sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   305
		d.connection = connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   306
		return d;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   307
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   308
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   309
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   310
	 * Apply the given data to the receiver (when a transient dialog is accepted) 
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   311
	 * @param dialogData
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   312
	 */
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   313
	public void apply(LaunchWizardData dialogData) {
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   314
		exeSelection = dialogData.exeSelection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   315
		exeSelectionPath = dialogData.exeSelectionPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   316
		buildBeforeLaunch = dialogData.buildBeforeLaunch;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   317
		installPackage = dialogData.installPackage;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   318
		sisPath = dialogData.sisPath;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   319
		connection = dialogData.connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   320
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   321
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   322
	/**
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   323
	 * @return
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   324
	 */
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   325
	public boolean requiresInstallPackage() {
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   326
		return isSysTRKConnection() == Boolean.FALSE /* but not if unknown */ || installPackage;
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   327
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   328
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   329
	public void setConnection(IConnection connection) {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   330
		this.connection = connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   331
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   332
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   333
	public IConnection getConnection() {
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   334
		return connection;
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   335
	}
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   336
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   337
	public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   338
		String launchTypeId = getApplicableLaunchTypeId();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   339
		ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   340
		ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   341
		initializeConfigSettings(launchTypeId, config);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   342
		
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   343
		return config;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   344
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   345
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   346
	private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   347
		IPath exePath = getExePath();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   348
		IPath mmpPath = getMmpPath(exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   349
		if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   350
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   351
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   352
		else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   353
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   354
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   355
		else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   356
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   357
		}
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   358
		if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE))
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   359
			SettingsData.setProcessToLaunch(config, exeSelectionPath);
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   360
		
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   361
		addBuildOptions(config);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   362
		// always set the current connection id
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   363
		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
   364
		if (installPackage) {
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   365
			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
   366
			// 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
   367
			if (exeSelection.equals(EExeSelection.USE_REMOTE_EXECUTABLE) && 
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   368
					exeSelectionPath.getDevice().equalsIgnoreCase("E:")) //$NON-NLS-1$
21b582a02214 10823 - if installing and launching from E:, install into E: also
dadubrow
parents: 1066
diff changeset
   369
				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
   370
		}
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   371
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   372
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   373
	private IPath getMmpPath(IPath exePath) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   374
		if (!mmps.isEmpty()) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   375
			for (int i = 0; i < exes.size(); i++) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   376
				IPath exe = exes.get(i);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   377
				if (exe.lastSegment().equals(exePath.lastSegment()))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   378
					return mmps.get(i);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   379
			}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   380
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   381
		return null;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   382
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   383
1066
4791b1e2e6ef 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1041
diff changeset
   384
	public IPath getExePath() {
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   385
		// if attach, doesn't matter so return first exe
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   386
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   387
			return exes.isEmpty() ? Path.EMPTY : exes.get(0);
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   388
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   389
		// 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
   390
		// 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
   391
		String filename = exeSelectionPath.lastSegment();
1091
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   392
		if (filename != null) {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   393
			for (IPath exePath : exes) {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   394
				if (filename.equalsIgnoreCase(exePath.lastSegment())) {
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   395
					return exePath;
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   396
				}
1041
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   397
			}
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   398
		}
7c4362faca1e bugs 10806 + 10807 fix problems with program to launch
dadubrow
parents: 966
diff changeset
   399
		// none could be found matching the selected path, so use the first in the list
1091
9ce8893d737f Fix 10861
dadubrow
parents: 1068
diff changeset
   400
		return getLaunchableExes().isEmpty() ? Path.EMPTY : getLaunchableExes().get(0);
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   401
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   402
	
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   403
	private IConnectedService getConnectedService() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   404
		if (connection != null) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   405
			Collection<IConnectedService> connectedServices = 
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   406
				RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   407
			for (IConnectedService connectedService : connectedServices) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   408
				if (connectedService.getService().getIdentifier().equals(service.getIdentifier()))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   409
					return connectedService;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   410
			}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   411
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   412
		return null;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   413
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   414
	
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   415
	/** Tell whether we can detect that the current connection is Sys TRK.
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   416
	 * 
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   417
	 * @return Boolean.TRUE if Sys TRK, Boolean.FALSE if App TRK, or <code>null</code> if unknown
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   418
	 */
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   419
	public Boolean isSysTRKConnection() {
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   420
		IConnectedService connectedService = getConnectedService();
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   421
		if (connectedService instanceof IConnectedService2) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   422
			String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   423
			return Boolean.parseBoolean(value);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   424
		}
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   425
		
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   426
		return null;
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   427
	}
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   428
	
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   429
	/**
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   430
	 * Tell whether Carbide is running in an internal layout.
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   431
	 * @return true if the installation includes known internal-only plugins
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   432
	 */
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   433
	public boolean isInternalLayout() {
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   434
		Bundle bundle = Platform.getBundle(COM_NOKIA_CARBIDE_SYMSEE_TRK_SUPPORT);
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   435
		if (bundle != null) {
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   436
			// assume this is an internal build 
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   437
			return true;
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   438
		}
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   439
		return false;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   440
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   441
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   442
	private String getApplicableLaunchTypeId() {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   443
		if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   444
			return SettingsData.ATTACH_LAUNCH_TYPE_ID;
1191
0523013ddf00 Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents: 1091
diff changeset
   445
		else if (!installPackage)
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   446
			return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   447
		else
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   448
			return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   449
	}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   450
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   451
	private void addBuildOptions(ILaunchConfigurationWorkingCopy config) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   452
		int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   453
		switch (buildBeforeLaunch) {
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   454
		case NEVER:
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   455
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   456
			break;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   457
		case ALWAYS:
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   458
			buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   459
			break;
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   460
		}
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   461
		config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   462
	}
911
81a2e70a37d7 new wizard initial commit
dadubrow
parents:
diff changeset
   463
}
953
68b6a294ab01 new launch wizard implementation
dadubrow
parents: 911
diff changeset
   464