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