27 import org.eclipse.core.runtime.IPath; |
27 import org.eclipse.core.runtime.IPath; |
28 import org.eclipse.core.runtime.IStatus; |
28 import org.eclipse.core.runtime.IStatus; |
29 import org.eclipse.core.runtime.Path; |
29 import org.eclipse.core.runtime.Path; |
30 import org.eclipse.core.runtime.Platform; |
30 import org.eclipse.core.runtime.Platform; |
31 import org.eclipse.core.runtime.Status; |
31 import org.eclipse.core.runtime.Status; |
32 import org.eclipse.core.runtime.preferences.InstanceScope; |
|
33 import org.eclipse.debug.core.DebugPlugin; |
32 import org.eclipse.debug.core.DebugPlugin; |
34 import org.eclipse.debug.core.ILaunchConfigurationType; |
33 import org.eclipse.debug.core.ILaunchConfigurationType; |
35 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
34 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
36 import org.eclipse.debug.core.ILaunchManager; |
35 import org.eclipse.debug.core.ILaunchManager; |
37 import org.eclipse.debug.ui.IDebugUIConstants; |
|
38 import org.osgi.framework.Bundle; |
36 import org.osgi.framework.Bundle; |
39 import org.osgi.service.prefs.Preferences; |
|
40 |
37 |
41 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; |
38 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; |
42 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
39 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
43 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; |
40 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService; |
44 import com.nokia.carbide.remoteconnections.interfaces.IConnection; |
41 import com.nokia.carbide.remoteconnections.interfaces.IConnection; |
45 import com.nokia.carbide.remoteconnections.interfaces.IService; |
42 import com.nokia.carbide.remoteconnections.interfaces.IService; |
46 import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2; |
43 import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2; |
47 import com.nokia.carbide.remoteconnections.internal.registry.Registry; |
44 import com.nokia.carbide.remoteconnections.internal.registry.Registry; |
48 import com.nokia.cdt.debug.cw.symbian.SettingsData; |
45 import com.nokia.cdt.debug.cw.symbian.SettingsData; |
|
46 import com.nokia.cdt.internal.debug.launch.LaunchPlugin; |
49 import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; |
47 import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions; |
50 import com.nokia.cpp.internal.api.utils.core.TextUtils; |
48 import com.nokia.cpp.internal.api.utils.core.TextUtils; |
51 |
49 |
52 import cwdbg.PreferenceConstants; |
50 import cwdbg.PreferenceConstants; |
53 |
51 |
54 /** |
52 /** |
55 * Data manipulated by the launch wizard and its dialogs. |
53 * Data manipulated by the launch wizard and its dialogs. |
56 */ |
54 */ |
57 @SuppressWarnings("restriction") |
55 @SuppressWarnings("restriction") |
58 public class LaunchWizardData extends LaunchOptions { |
56 public class LaunchWizardData extends LaunchOptions implements |
|
57 IWizardData, |
|
58 IConnectionWizardData, |
|
59 IDebugRunProcessWizardData, |
|
60 IOtherSettingsWizardData { |
59 /** |
61 /** |
60 * This plugin is only shipped in internal layouts and is used as a fallback |
62 * This plugin is only shipped in internal layouts and is used as a fallback |
61 * to determine whether Sys TRK is more likely to be available than App TRK |
63 * to determine whether Sys TRK is more likely to be available than App TRK |
62 * if we cannot otherwise tell. |
64 * if we cannot otherwise tell. |
63 */ |
65 */ |
91 }; |
93 }; |
92 |
94 |
93 public final static LaunchType APP_TRK = new LaunchType(null); |
95 public final static LaunchType APP_TRK = new LaunchType(null); |
94 public final static LaunchType SYS_TRK = new LaunchType(null); |
96 public final static LaunchType SYS_TRK = new LaunchType(null); |
95 public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null); |
97 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 |
98 |
104 private EExeSelection exeSelection; |
99 private EExeSelection exeSelection; |
105 private IPath exeSelectionPath = Path.EMPTY; |
100 private IPath exeSelectionPath = Path.EMPTY; |
106 private EBuildBeforeLaunchOption buildBeforeLaunch; |
101 private EBuildBeforeLaunchOption buildBeforeLaunch; |
107 private boolean installPackage; |
102 private boolean installPackage; |
108 private String sisPath; |
103 private String sisPath; |
109 private IConnection connection; |
104 private IConnection connection; |
110 private List<IPath> launchableExes; |
105 private List<IPath> launchableExes; |
111 |
106 |
112 // settings made in the Other Settings section |
107 public LaunchWizardData() { |
113 enum EBuildBeforeLaunchOption { |
108 } |
114 ALWAYS, |
109 |
115 NEVER, |
110 public void initialize(LaunchOptions launchOptions) { |
116 USE_WORKSPACE_SETTING, |
|
117 } |
|
118 |
|
119 public LaunchWizardData(LaunchOptions launchOptions, IService dbgService) { |
|
120 this.mmps = launchOptions.mmps; |
111 this.mmps = launchOptions.mmps; |
121 this.exes = launchOptions.exes; |
112 this.exes = launchOptions.exes; |
122 this.defaultExecutable = launchOptions.defaultExecutable; |
113 this.defaultExecutable = launchOptions.defaultExecutable; |
123 this.project = launchOptions.project; |
114 this.project = launchOptions.project; |
124 this.configurationName = launchOptions.configurationName; |
115 this.configurationName = launchOptions.configurationName; |
125 this.isEmulation = launchOptions.isEmulation; |
116 this.isEmulation = launchOptions.isEmulation; |
126 this.emulatorOnly = launchOptions.emulatorOnly; |
117 this.emulatorOnly = launchOptions.emulatorOnly; |
127 this.mode = launchOptions.mode; |
118 this.mode = launchOptions.mode; |
128 this.service = dbgService; |
119 service = LaunchPlugin.getRunModeDebugService(); |
129 } |
120 } |
130 |
121 |
131 /** |
122 /** |
132 * @return the service |
123 * @return the service |
133 */ |
124 */ |
228 return buildBeforeLaunch; |
219 return buildBeforeLaunch; |
229 } |
220 } |
230 |
221 |
231 /** Get current workspace setting */ |
222 /** Get current workspace setting */ |
232 public boolean isWorkspaceBuildBeforeLaunch() { |
223 public boolean isWorkspaceBuildBeforeLaunch() { |
233 // here's how to get the prefs from a plugin's #getPreferenceStore() without violating access |
224 return WizardDataUtils.isWorkspaceBuildBeforeLaunch(); |
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 } |
225 } |
240 |
226 |
241 /** Get actual launch-time setting */ |
227 /** Get actual launch-time setting */ |
242 public boolean isCurrentBuildBeforeLaunch() { |
228 public boolean isCurrentBuildBeforeLaunch() { |
243 if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) |
229 if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING) |
292 launchOptions.project = project; |
278 launchOptions.project = project; |
293 launchOptions.configurationName = configurationName; |
279 launchOptions.configurationName = configurationName; |
294 launchOptions.isEmulation = isEmulation; |
280 launchOptions.isEmulation = isEmulation; |
295 launchOptions.emulatorOnly = emulatorOnly; |
281 launchOptions.emulatorOnly = emulatorOnly; |
296 launchOptions.mode = mode; |
282 launchOptions.mode = mode; |
297 LaunchWizardData d = new LaunchWizardData(launchOptions, service); |
283 LaunchWizardData d = new LaunchWizardData(); |
|
284 d.initialize(launchOptions); |
298 d.exeSelection = exeSelection; |
285 d.exeSelection = exeSelection; |
299 d.exeSelectionPath = exeSelectionPath; |
286 d.exeSelectionPath = exeSelectionPath; |
300 d.buildBeforeLaunch = buildBeforeLaunch; |
287 d.buildBeforeLaunch = buildBeforeLaunch; |
301 d.installPackage = installPackage; |
288 d.installPackage = installPackage; |
302 d.sisPath = sisPath; |
289 d.sisPath = sisPath; |
303 d.connection = connection; |
290 d.connection = connection; |
|
291 d.service = service; |
304 return d; |
292 return d; |
305 } |
293 } |
306 |
294 |
307 /** |
295 /** |
308 * Apply the given data to the receiver (when a transient dialog is accepted) |
296 * Apply the given data to the receiver (when a transient dialog is accepted) |
309 * @param dialogData |
297 * @param dialogData |
310 */ |
298 */ |
311 public void apply(LaunchWizardData dialogData) { |
299 public void apply(IWizardData launchWizardData) { |
|
300 LaunchWizardData dialogData = (LaunchWizardData) launchWizardData; |
312 exeSelection = dialogData.exeSelection; |
301 exeSelection = dialogData.exeSelection; |
313 exeSelectionPath = dialogData.exeSelectionPath; |
302 exeSelectionPath = dialogData.exeSelectionPath; |
314 buildBeforeLaunch = dialogData.buildBeforeLaunch; |
303 buildBeforeLaunch = dialogData.buildBeforeLaunch; |
315 installPackage = dialogData.installPackage; |
304 installPackage = dialogData.installPackage; |
316 sisPath = dialogData.sisPath; |
305 sisPath = dialogData.sisPath; |