author | Ed Swartz <ed.swartz@nokia.com> |
Fri, 09 Apr 2010 07:45:47 -0500 | |
branch | RCL_2_4 |
changeset 1191 | 0523013ddf00 |
parent 1091 | 9ce8893d737f |
child 1192 | d1b481b25ae9 |
permissions | -rw-r--r-- |
911 | 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 |
||
1091 | 20 |
import java.util.ArrayList; |
953 | 21 |
import java.util.Collection; |
911 | 22 |
import java.util.List; |
23 |
||
953 | 24 |
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; |
911 | 25 |
import org.eclipse.core.resources.IProject; |
953 | 26 |
import org.eclipse.core.runtime.CoreException; |
911 | 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; |
|
953 | 33 |
import org.eclipse.debug.core.DebugPlugin; |
34 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
|
35 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
|
911 | 36 |
import org.eclipse.debug.core.ILaunchManager; |
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 | 39 |
import org.osgi.service.prefs.Preferences; |
40 |
||
953 | 41 |
import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; |
42 |
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
|
43 |
import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; |
|
911 | 44 |
import com.nokia.carbide.remoteconnections.interfaces.IConnection; |
45 |
import com.nokia.carbide.remoteconnections.interfaces.IService; |
|
953 | 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; |
|
911 | 50 |
import com.nokia.cpp.internal.api.utils.core.TextUtils; |
51 |
||
953 | 52 |
import cwdbg.PreferenceConstants; |
53 |
||
911 | 54 |
/** |
55 |
* Data manipulated by the launch wizard and its dialogs. |
|
56 |
*/ |
|
953 | 57 |
@SuppressWarnings("restriction") |
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 | 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 |
||
953 | 84 |
public boolean isApplicable(LaunchWizardData data) { |
911 | 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 |
public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null); |
|
97 |
public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null); |
|
98 |
||
99 |
// settings made in Debug/Run Process section |
|
100 |
enum EExeSelection { |
|
101 |
USE_PROJECT_EXECUTABLE, |
|
102 |
USE_REMOTE_EXECUTABLE, |
|
103 |
ATTACH_TO_PROCESS, |
|
104 |
}; |
|
105 |
||
106 |
private EExeSelection exeSelection; |
|
107 |
private IPath exeSelectionPath = Path.EMPTY; |
|
108 |
private EBuildBeforeLaunchOption buildBeforeLaunch; |
|
109 |
private boolean installPackage; |
|
110 |
private String sisPath; |
|
953 | 111 |
private IConnection connection; |
1091 | 112 |
private List<IPath> launchableExes; |
911 | 113 |
|
114 |
// settings made in the Other Settings section |
|
115 |
enum EBuildBeforeLaunchOption { |
|
116 |
ALWAYS, |
|
117 |
NEVER, |
|
118 |
USE_WORKSPACE_SETTING, |
|
119 |
} |
|
120 |
||
953 | 121 |
public LaunchWizardData(LaunchOptions launchOptions, IService trkService) { |
122 |
this.mmps = launchOptions.mmps; |
|
123 |
this.exes = launchOptions.exes; |
|
124 |
this.defaultExecutable = launchOptions.defaultExecutable; |
|
125 |
this.project = launchOptions.project; |
|
126 |
this.configurationName = launchOptions.configurationName; |
|
127 |
this.isEmulation = launchOptions.isEmulation; |
|
128 |
this.emulatorOnly = launchOptions.emulatorOnly; |
|
129 |
this.mode = launchOptions.mode; |
|
911 | 130 |
this.service = trkService; |
131 |
} |
|
132 |
||
133 |
/** |
|
134 |
* @return the service |
|
135 |
*/ |
|
136 |
public IService getService() { |
|
137 |
return service; |
|
138 |
} |
|
139 |
||
140 |
/** |
|
141 |
* @return |
|
142 |
*/ |
|
143 |
public boolean isDebug() { |
|
144 |
return mode.equals(ILaunchManager.DEBUG_MODE); |
|
145 |
} |
|
146 |
||
147 |
public String getModeLabel() { |
|
148 |
if (mode.equals(ILaunchManager.RUN_MODE)) |
|
966 | 149 |
return Messages.getString("LaunchWizardData.RunModeLabel"); //$NON-NLS-1$ |
911 | 150 |
else if (mode.equals(ILaunchManager.DEBUG_MODE)) |
966 | 151 |
return Messages.getString("LaunchWizardData.DebugModeLabel"); //$NON-NLS-1$ |
911 | 152 |
else |
153 |
return TextUtils.titleCase(mode); |
|
154 |
||
155 |
} |
|
156 |
||
157 |
/** |
|
158 |
* Validate the detected and/or configured data |
|
159 |
* @return IStatus, never <code>null</code> |
|
160 |
*/ |
|
161 |
public IStatus validate() { |
|
162 |
return Status.OK_STATUS; |
|
163 |
} |
|
164 |
||
165 |
/** |
|
166 |
* @return |
|
167 |
* @return |
|
168 |
*/ |
|
169 |
public List<IPath> getExes() { |
|
170 |
return exes; |
|
171 |
} |
|
1091 | 172 |
|
173 |
public List<IPath> getLaunchableExes() { |
|
174 |
if (launchableExes == null) { |
|
175 |
launchableExes = new ArrayList<IPath>(); |
|
176 |
for (IPath path : exes) { |
|
177 |
if ("exe".equalsIgnoreCase(path.getFileExtension())) |
|
178 |
launchableExes.add(path); |
|
179 |
} |
|
180 |
} |
|
181 |
return launchableExes; |
|
182 |
} |
|
911 | 183 |
|
184 |
/** |
|
185 |
* @return the defaultExecutable |
|
186 |
*/ |
|
187 |
public IPath getDefaultExecutable() { |
|
188 |
return defaultExecutable; |
|
189 |
} |
|
190 |
||
191 |
/** |
|
192 |
* Set the executable selection mode |
|
193 |
* @param selection |
|
194 |
*/ |
|
195 |
public void setExeSelection(EExeSelection selection) { |
|
196 |
this.exeSelection = selection; |
|
197 |
} |
|
198 |
/** |
|
199 |
* Set the path for the exe |
|
200 |
* @param path or <code>null</code> |
|
201 |
*/ |
|
202 |
public void setExeSelectionPath(IPath path) { |
|
203 |
this.exeSelectionPath = path != null ? path : Path.EMPTY; |
|
204 |
} |
|
205 |
||
206 |
/** |
|
207 |
* @return |
|
208 |
*/ |
|
209 |
public EExeSelection getExeSelection() { |
|
210 |
return exeSelection; |
|
211 |
} |
|
212 |
||
213 |
public IPath getExeSelectionPath() { |
|
214 |
return exeSelectionPath; |
|
215 |
} |
|
216 |
||
217 |
public String getConnectionName() { |
|
218 |
IConnection connection = getConnection(); |
|
219 |
if (connection == null) |
|
220 |
return null; |
|
221 |
return connection.getDisplayName(); |
|
222 |
} |
|
223 |
||
224 |
public void setBuildBeforeLaunchOption( |
|
225 |
EBuildBeforeLaunchOption setting) { |
|
226 |
this.buildBeforeLaunch = setting; |
|
227 |
} |
|
228 |
||
229 |
public EBuildBeforeLaunchOption getBuildBeforeLaunch() { |
|
230 |
return buildBeforeLaunch; |
|
231 |
} |
|
232 |
||
233 |
/** Get current workspace setting */ |
|
234 |
public boolean isWorkspaceBuildBeforeLaunch() { |
|
235 |
// here's how to get the prefs from a plugin's #getPreferenceStore() without violating access |
|
236 |
String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH; |
|
237 |
int idx = prefId.lastIndexOf('.'); |
|
238 |
String plugin = prefId.substring(0, idx); |
|
239 |
Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin); |
|
240 |
return node.getBoolean(prefId, true); |
|
241 |
} |
|
242 |
||
243 |
/** Get actual launch-time setting */ |
|
244 |
public boolean isCurrentBuildBeforeLaunch() { |
|
245 |
if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) |
|
246 |
return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS; |
|
247 |
return isWorkspaceBuildBeforeLaunch(); |
|
248 |
} |
|
249 |
||
250 |
/** |
|
251 |
* @param selection |
|
252 |
*/ |
|
253 |
public void setInstallPackage(boolean selection) { |
|
254 |
this.installPackage = selection; |
|
255 |
} |
|
256 |
||
257 |
/** |
|
258 |
* @return the installPackage |
|
259 |
*/ |
|
260 |
public boolean isInstallPackage() { |
|
261 |
return installPackage; |
|
262 |
} |
|
263 |
||
264 |
/** |
|
265 |
* @return |
|
266 |
*/ |
|
267 |
public IProject getProject() { |
|
268 |
return project; |
|
269 |
} |
|
270 |
||
271 |
/** |
|
272 |
* @param sisPath |
|
273 |
*/ |
|
274 |
public void setSisPath(String sisPath) { |
|
275 |
this.sisPath = sisPath; |
|
276 |
} |
|
277 |
||
278 |
/** |
|
953 | 279 |
* @return |
280 |
*/ |
|
281 |
public String getSisPath() { |
|
282 |
return sisPath; |
|
283 |
} |
|
284 |
||
285 |
/** |
|
911 | 286 |
* Copy the data, for use by a transient dialog. |
287 |
* @return new copy of data |
|
288 |
*/ |
|
953 | 289 |
public LaunchWizardData copy() { |
290 |
LaunchOptions launchOptions = new LaunchOptions(); |
|
291 |
launchOptions.mmps = mmps; |
|
292 |
launchOptions.exes = exes; |
|
293 |
launchOptions.defaultExecutable = defaultExecutable; |
|
294 |
launchOptions.project = project; |
|
295 |
launchOptions.configurationName = configurationName; |
|
296 |
launchOptions.isEmulation = isEmulation; |
|
297 |
launchOptions.emulatorOnly = emulatorOnly; |
|
298 |
launchOptions.mode = mode; |
|
299 |
LaunchWizardData d = new LaunchWizardData(launchOptions, service); |
|
911 | 300 |
d.exeSelection = exeSelection; |
301 |
d.exeSelectionPath = exeSelectionPath; |
|
302 |
d.buildBeforeLaunch = buildBeforeLaunch; |
|
303 |
d.installPackage = installPackage; |
|
304 |
d.sisPath = sisPath; |
|
305 |
d.connection = connection; |
|
306 |
return d; |
|
307 |
} |
|
308 |
||
309 |
/** |
|
310 |
* Apply the given data to the receiver (when a transient dialog is accepted) |
|
311 |
* @param dialogData |
|
312 |
*/ |
|
953 | 313 |
public void apply(LaunchWizardData dialogData) { |
911 | 314 |
exeSelection = dialogData.exeSelection; |
315 |
exeSelectionPath = dialogData.exeSelectionPath; |
|
316 |
buildBeforeLaunch = dialogData.buildBeforeLaunch; |
|
317 |
installPackage = dialogData.installPackage; |
|
318 |
sisPath = dialogData.sisPath; |
|
319 |
connection = dialogData.connection; |
|
320 |
} |
|
321 |
||
322 |
/** |
|
323 |
* @return |
|
324 |
*/ |
|
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 | 327 |
} |
328 |
||
329 |
public void setConnection(IConnection connection) { |
|
330 |
this.connection = connection; |
|
331 |
} |
|
332 |
||
333 |
public IConnection getConnection() { |
|
334 |
return connection; |
|
335 |
} |
|
336 |
||
953 | 337 |
public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException { |
338 |
String launchTypeId = getApplicableLaunchTypeId(); |
|
339 |
ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId); |
|
340 |
ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName); |
|
341 |
initializeConfigSettings(launchTypeId, config); |
|
342 |
||
343 |
return config; |
|
344 |
} |
|
345 |
||
346 |
private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) { |
|
347 |
IPath exePath = getExePath(); |
|
348 |
IPath mmpPath = getMmpPath(exePath); |
|
349 |
if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) { |
|
350 |
SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath); |
|
351 |
} |
|
352 |
else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) { |
|
353 |
SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath); |
|
354 |
} |
|
355 |
else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) { |
|
356 |
SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath); |
|
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 | 361 |
addBuildOptions(config); |
362 |
// always set the current connection id |
|
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 | 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 | 371 |
} |
372 |
||
373 |
private IPath getMmpPath(IPath exePath) { |
|
374 |
if (!mmps.isEmpty()) { |
|
375 |
for (int i = 0; i < exes.size(); i++) { |
|
376 |
IPath exe = exes.get(i); |
|
377 |
if (exe.lastSegment().equals(exePath.lastSegment())) |
|
378 |
return mmps.get(i); |
|
379 |
} |
|
380 |
} |
|
381 |
return null; |
|
382 |
} |
|
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 | 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 | 392 |
if (filename != null) { |
393 |
for (IPath exePath : exes) { |
|
394 |
if (filename.equalsIgnoreCase(exePath.lastSegment())) { |
|
395 |
return exePath; |
|
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 | 400 |
return getLaunchableExes().isEmpty() ? Path.EMPTY : getLaunchableExes().get(0); |
953 | 401 |
} |
402 |
||
403 |
private IConnectedService getConnectedService() { |
|
404 |
if (connection != null) { |
|
405 |
Collection<IConnectedService> connectedServices = |
|
406 |
RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection); |
|
407 |
for (IConnectedService connectedService : connectedServices) { |
|
408 |
if (connectedService.getService().getIdentifier().equals(service.getIdentifier())) |
|
409 |
return connectedService; |
|
410 |
} |
|
411 |
} |
|
412 |
return null; |
|
413 |
} |
|
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 | 420 |
IConnectedService connectedService = getConnectedService(); |
421 |
if (connectedService instanceof IConnectedService2) { |
|
422 |
String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$ |
|
423 |
return Boolean.parseBoolean(value); |
|
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 | 439 |
return false; |
440 |
} |
|
441 |
||
442 |
private String getApplicableLaunchTypeId() { |
|
443 |
if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS)) |
|
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 | 446 |
return SettingsData.SYS_TRK_LAUNCH_TYPE_ID; |
447 |
else |
|
448 |
return SettingsData.APP_TRK_LAUNCH_TYPE_ID; |
|
449 |
} |
|
450 |
||
451 |
private void addBuildOptions(ILaunchConfigurationWorkingCopy config) { |
|
452 |
int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING; |
|
453 |
switch (buildBeforeLaunch) { |
|
454 |
case NEVER: |
|
455 |
buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED; |
|
456 |
break; |
|
457 |
case ALWAYS: |
|
458 |
buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED; |
|
459 |
break; |
|
460 |
} |
|
461 |
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue); |
|
462 |
} |
|
911 | 463 |
} |
953 | 464 |