--- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Mon Feb 15 13:20:03 2010 -0600
@@ -176,11 +176,11 @@
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
- label="Symbian OS Application"
+ label="Symbian OS Board Launch"
icon="icons/launch_config_file_16x16.png"
modes="run, debug"
- class="com.nokia.cdt.internal.debug.launch.SymbianLaunchShortcut"
- id="com.nokia.cdt.debug.launch.symbianCPPShortcut">
+ class="com.nokia.cdt.internal.debug.launch.BoardLaunchShortcut"
+ id="com.nokia.cdt.debug.launch.symbianCPPShortcut.board">
<contextualLaunch>
<enablement>
<with variable="selection">
@@ -210,23 +210,185 @@
forcePluginActivation="true"
property="com.nokia.cdt.debug.launch.isExecutable"/>
</or>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isNotEmulator">
+ </test>
</and>
</iterate>
</with>
</enablement>
<contextLabel
mode="run"
- label="Run Symbian OS Application"/>
+ label="Run Symbian OS Application on board"/>
<contextLabel
mode="debug"
- label="Debug Symbian OS Application"/>
+ label="Debug Symbian OS Application on board"/>
</contextualLaunch>
<description
mode="run"
- description="Runs a Symbian OS executable"/>
+ description="Runs on a development board or reference hardware using a JTAG connection."/>
<description
mode="debug"
- description="Debugs a Symbian OS executable"/>
+ description="Debugs on a development board or reference hardware using a JTAG connection."/>
+ </shortcut>
+ <shortcut
+ class="com.nokia.cdt.internal.debug.launch.PhoneLaunchShortcut"
+ icon="icons/launch_config_file_16x16.png"
+ id="com.nokia.cdt.debug.launch.symbianCPPShortcut.phone"
+ label="Symbian OS Phone Launch"
+ modes="run, debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.debug.core.executables.Executable">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isCarbideProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isExecutable">
+ </test>
+ </or>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isNotEmulator">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Run Symbian OS Application on phone"
+ mode="run">
+ </contextLabel>
+ <contextLabel
+ label="Debug Symbian OS Application on phone"
+ mode="debug">
+ </contextLabel>
+ </contextualLaunch>
+ <description
+ description="Debugs on a phone using System TRK or Application TRK"
+ mode="debug">
+ </description>
+ <description
+ description="Runs on a phone using System TRK or Application TRK"
+ mode="run">
+ </description>
+ </shortcut>
+ <shortcut
+ class="com.nokia.cdt.internal.debug.launch.EmulatorLaunchShortcut"
+ icon="icons/launch_config_file_16x16.png"
+ id="com.nokia.cdt.debug.launch.symbianCPPShortcut.emulator"
+ label="Symbian OS Emulator Launch"
+ modes="run, debug">
+ <contextualLaunch>
+ <enablement>
+ <with
+ variable="selection">
+ <count
+ value="1">
+ </count>
+ <iterate>
+ <and>
+ <or>
+ <instanceof
+ value="org.eclipse.cdt.core.model.IBinary">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICProject">
+ </instanceof>
+ <instanceof
+ value="org.eclipse.cdt.debug.core.executables.Executable">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.cdt.launch.isCProject">
+ </test>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.IFileEditorInput">
+ </instanceof>
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isCarbideProject">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isExecutable">
+ </test>
+ </or>
+ <test
+ forcePluginActivation="true"
+ property="com.nokia.cdt.debug.launch.isEmulator">
+ </test>
+ </and>
+ </iterate>
+ </with>
+ </enablement>
+ <contextLabel
+ label="Run Symbian OS Application on emulator"
+ mode="run">
+ </contextLabel>
+ <contextLabel
+ label="Debug Symbian OS Application on emulator"
+ mode="debug">
+ </contextLabel>
+ </contextualLaunch>
+ <description
+ description="Debugs using a WINSCW emulator"
+ mode="debug">
+ </description>
+ <description
+ description="Runs using a WINSCW emulator"
+ mode="run">
+ </description>
</shortcut>
</extension>
@@ -234,7 +396,7 @@
<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
namespace="com.nokia.cdt.debug.launch"
- properties="isExecutable, isCarbideProject"
+ properties="isExecutable, isCarbideProject, isEmulator, isNotEmulator"
type="org.eclipse.core.runtime.IAdaptable"
class="com.nokia.cdt.internal.debug.launch.SymbianProjectPropertyTester"
id="com.nokia.cdt.debug.launch.SymbianProjectPropertyTester">
@@ -281,40 +443,4 @@
<extension-point id="launchWizardExtension" name="Launch Wizard Page" schema="schema/launchWizardExtension.exsd"/>
<extension-point id="launchCategoryExtension" name="Launch Category" schema="schema/launchCategoryExtension.exsd"/>
- <!-- REMOVE THIS : just a hack for getting the new launch wizard into a toolbar -->
-
- <extension
- point="org.eclipse.ui.commands">
- <category
- id="com.nokia.cdt.debug.launch.commands.category"
- name="Sample Category">
- </category>
- <command
- categoryId="com.nokia.cdt.debug.launch.commands.category"
- id="com.nokia.cdt.debug.launch.commands.sampleCommand"
- name="Sample Command">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="com.nokia.cdt.internal.debug.launch.newwizard.CommandRunLaunchWizard2"
- commandId="com.nokia.cdt.debug.launch.commands.sampleCommand">
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar
- id="com.nokia.cdt.debug.launch.toolbars.sampleToolbar">
- <command
- commandId="com.nokia.cdt.debug.launch.commands.sampleCommand"
- icon="icons/NewProjectAssist/debug.gif"
- id="com.nokia.cdt.debug.launch.toolbars.sampleCommand"
- tooltip="Show New Launch Wizard">
- </command>
- </toolbar>
- </menuContribution>
- </extension>
</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,185 @@
+package com.nokia.cdt.internal.debug.launch;
+
+import java.util.List;
+
+import org.eclipse.cdt.debug.core.executables.Executable;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchShortcut2;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+
+public abstract class AbstractSymbianLaunchShortcut implements ILaunchShortcut2 {
+
+ protected abstract void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode);
+
+ public void launch(IEditorPart editor, String mode) {
+ // launch an existing config if one exists
+ ILaunchConfiguration[] configs = getLaunchConfigurations(editor);
+ if (configs.length > 0) {
+ // just launch the first one that supports the mode
+ for (ILaunchConfiguration config : configs) {
+ try {
+ if (config.supportsMode(mode)) {
+ DebugUITools.launch(configs[0], mode);
+ return;
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ IEditorInput editorInput = editor.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput)editorInput).getFile();
+ if (file != null) {
+ launchProject(file.getProject(), null, null, mode);
+ }
+ }
+ }
+
+ public void launch(ISelection selection, String mode) {
+
+ // launch an existing config if one exists
+ ILaunchConfiguration[] configs = getLaunchConfigurations(selection);
+ if (configs.length > 0) {
+ // just launch the first one that supports the mode
+ for (ILaunchConfiguration config : configs) {
+ try {
+ if (config.supportsMode(mode)) {
+ DebugUITools.launch(configs[0], mode);
+ return;
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ IPath defaultMMP = null;
+ boolean launched = false;
+ Executable executable = null;
+
+ if (selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if (firstElement != null && firstElement instanceof Executable)
+ {
+ launchProject(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP, mode);
+ launched = true;
+ }
+ else
+ if (firstElement != null && firstElement instanceof IAdaptable)
+ {
+ IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class);
+ if (file != null)
+ {
+ IPath filePath = file.getLocation();
+ if ("mmp".equalsIgnoreCase(filePath.getFileExtension()))
+ {
+ defaultMMP = filePath;
+ }
+ else
+ {
+ executable = new Executable(file.getLocation(), file.getProject(), file);
+ launchProject(file.getProject(), executable, defaultMMP, mode);
+ launched = true;
+ }
+ }
+ }
+ }
+
+ if (!launched)
+ {
+ List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
+ if (projects.size() > 0) {
+ launchProject(projects.get(0), executable, defaultMMP, mode);
+ }
+ }
+ }
+
+ public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) {
+ IPath defaultMMP = null;
+ if (selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if (firstElement != null && firstElement instanceof Executable)
+ {
+ return LaunchPlugin.getDefault().getLaunchConfigurations(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP);
+ }
+ else
+ if (firstElement != null && firstElement instanceof IAdaptable)
+ {
+ IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class);
+ if (file != null)
+ {
+ IPath filePath = file.getLocation();
+ if ("mmp".equalsIgnoreCase(filePath.getFileExtension()))
+ {
+ defaultMMP = filePath;
+ }
+ Executable executable = new Executable(file.getLocation(), file.getProject(), file);
+ return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), executable, defaultMMP);
+ }
+ }
+ }
+
+ List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
+ if (projects.size() > 0) {
+ return LaunchPlugin.getDefault().getLaunchConfigurations(projects.get(0), null, defaultMMP);
+ }
+ return null;
+ }
+
+ public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) {
+ IEditorInput editorInput = editorpart.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput)editorInput).getFile();
+ if (file != null) {
+ return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), null, null);
+ }
+ }
+ return null;
+ }
+
+ public IResource getLaunchableResource(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if (firstElement != null && firstElement instanceof IFile)
+ {
+ IFile file = (IFile) firstElement;
+ return file.getProject();
+ }
+ if (firstElement != null && firstElement instanceof Executable)
+ {
+ return ((Executable)firstElement).getProject();
+ }
+ }
+ List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
+ if (projects.size() > 0) {
+ return projects.get(0);
+ }
+ return null;
+ }
+
+ public IResource getLaunchableResource(IEditorPart editorpart) {
+ IEditorInput editorInput = editorpart.getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput)editorInput).getFile();
+ if (file != null) {
+ return file.getProject();
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/BoardLaunchShortcut.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.cdt.internal.debug.launch;
+
+import org.eclipse.cdt.debug.core.executables.Executable;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory;
+import com.nokia.cdt.internal.debug.launch.wizard.AbstractLaunchWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
+
+public class BoardLaunchShortcut extends AbstractSymbianLaunchShortcut {
+
+ @Override
+ protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) {
+ LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode,
+ new ILaunchCreationWizardFactory() {
+ public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception {
+ LaunchCreationWizard creationWizard =
+ LaunchCreationWizardInstance.getInstance().create(
+ launchOptions.project,
+ launchOptions.configurationName,
+ launchOptions.mmps,
+ launchOptions.exes,
+ launchOptions.defaultExecutable,
+ launchOptions.isEmulation,
+ launchOptions.emulatorOnly,
+ launchOptions.mode);
+ creationWizard.setCategoryId(AbstractLaunchWizard.BOARD_CATEGORY_ID);
+ return creationWizard;
+ }
+ });
+ }
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/EmulatorLaunchShortcut.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.cdt.internal.debug.launch;
+
+import org.eclipse.cdt.debug.core.executables.Executable;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
+
+public class EmulatorLaunchShortcut extends AbstractSymbianLaunchShortcut {
+
+ @Override
+ protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) {
+ LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode,
+ new ILaunchCreationWizardFactory() {
+ public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception {
+ return LaunchCreationWizardInstance.getInstance().create(
+ launchOptions.project,
+ launchOptions.configurationName,
+ launchOptions.mmps,
+ launchOptions.exes,
+ launchOptions.defaultExecutable,
+ launchOptions.isEmulation,
+ launchOptions.emulatorOnly,
+ launchOptions.mode);
+ }
+ });
+ }
+
+}
+
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Mon Feb 15 13:20:03 2010 -0600
@@ -16,23 +16,51 @@
*/
package com.nokia.cdt.internal.debug.launch;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
-import org.eclipse.cdt.core.model.*;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.executables.Executable;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
-import org.eclipse.debug.core.*;
-import org.eclipse.debug.ui.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.UIJob;
import org.osgi.framework.BundleContext;
@@ -46,15 +74,23 @@
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
import com.nokia.carbide.remoteconnections.interfaces.IService;
-import com.nokia.cdt.debug.cw.symbian.*;
-import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizard;
-import com.nokia.cdt.internal.debug.launch.wizard.LaunchCreationWizardInstance;
+import com.nokia.cdt.debug.cw.symbian.SettingsData;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
import com.nokia.cpp.internal.api.utils.core.Logging;
/**
* The main plugin class to be used in the desktop.
*/
public class LaunchPlugin extends AbstractUIPlugin implements ILaunchListener, ILaunchConfigurationListener, IStartup {
+
+ public interface ILaunchCreationWizardFactory {
+// ILaunchCreationWizard createLaunchCreationWizard(IProject project, String mode,
+// final String defaultConfigName, boolean isX86, boolean useEmulatorByDefault,
+// IPath defaultExecutable, List<IPath> exePaths, List<IPath> mmpPaths) throws Exception;
+ ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception;
+ }
+
//The shared instance.
private static LaunchPlugin plugin;
//Resource bundle.
@@ -206,7 +242,8 @@
return isX86;
}
- private ILaunchConfiguration createConfigurationForProject(IProject project, Executable executable, IPath defaultMMP, String mode) throws CoreException {
+ private ILaunchConfiguration createConfigurationForProject(IProject project, Executable executable,
+ IPath defaultMMP, String mode, ILaunchCreationWizardFactory wizardFactory) throws CoreException {
boolean openLaunchConfigDialog = false;
@@ -292,15 +329,17 @@
// which exe to launch or emulator if not required,
// which non-emulator launch type,
// or both
+ LaunchOptions launchOptions = new LaunchOptions();
+ launchOptions.project = project;
+ launchOptions.mode = mode;
+ launchOptions.configurationName = defaultConfigName;
+ launchOptions.isEmulation = isX86;
+ launchOptions.emulatorOnly = useEmulatorByDefault;
+ launchOptions.defaultExecutable = defaultExecutable;
+ launchOptions.exes = exePaths;
+ launchOptions.mmps = mmpPaths;
try {
- final LaunchCreationWizard wizard =
- LaunchCreationWizardInstance.getInstance().create(project, defaultConfigName, mmpPaths, exePaths, defaultExecutable, isX86, useEmulatorByDefault, mode);
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.openWizard(CUIPlugin.getActiveWorkbenchShell());
- }
- });
+ final ILaunchCreationWizard wizard = openLaunchCreationWizard(launchOptions, wizardFactory);
config = wizard.getLaunchConfiguration();
openLaunchConfigDialog = wizard.shouldOpenLaunchConfigurationDialog();
}
@@ -326,6 +365,19 @@
return null;
}
+ private ILaunchCreationWizard openLaunchCreationWizard(LaunchOptions launchOptions,
+ ILaunchCreationWizardFactory wizardFactory) throws Exception {
+ final ILaunchCreationWizard wizard =
+ wizardFactory.createLaunchCreationWizard(launchOptions);
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ wizard.init();
+ wizard.openWizard(CUIPlugin.getActiveWorkbenchShell());
+ }
+ });
+ return wizard;
+ }
+
public ILaunchConfiguration[] getLaunchConfigurations(IProject project, Executable executable, IPath defaultMMP)
{
IPath defaultExecutable = null;
@@ -368,10 +420,11 @@
return configs.toArray(new ILaunchConfiguration[configs.size()]);
}
- public void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) {
+ public void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode,
+ ILaunchCreationWizardFactory wizardFactory) {
ILaunchConfiguration configuration = null;
try {
- configuration = createConfigurationForProject(project, executable, defaultMMP, mode);
+ configuration = createConfigurationForProject(project, executable, defaultMMP, mode, wizardFactory);
} catch (CoreException e) {
log(e);
}
@@ -540,7 +593,7 @@
});
}
-
+
public static IService getTRKService() {
return RemoteConnectionsActivator.getConnectionTypeProvider().
findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/PhoneLaunchShortcut.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.cdt.internal.debug.launch;
+
+import org.eclipse.cdt.debug.core.executables.Executable;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin.ILaunchCreationWizardFactory;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
+
+public class PhoneLaunchShortcut extends AbstractSymbianLaunchShortcut {
+
+ @Override
+ protected void launchProject(IProject project, Executable executable, IPath defaultMMP, String mode) {
+ LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode,
+ new ILaunchCreationWizardFactory() {
+ public ILaunchCreationWizard createLaunchCreationWizard(LaunchOptions launchOptions) throws Exception {
+ IConnectionTypeProvider provider = RemoteConnectionsActivator.getConnectionTypeProvider();
+ IService trkService = provider.findServiceByID("com.nokia.carbide.trk.support.service.TRKService"); //$NON-NLS-1$
+ LaunchWizard launchWizard = new LaunchWizard(launchOptions, trkService);
+ return launchWizard;
+ };
+ });
+ }
+}
\ No newline at end of file
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianLaunchShortcut.java Sun Feb 14 20:52:26 2010 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package com.nokia.cdt.internal.debug.launch;
-
-import java.util.List;
-
-import org.eclipse.cdt.debug.core.executables.Executable;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.ILaunchShortcut2;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-
-import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
-
-public class SymbianLaunchShortcut implements ILaunchShortcut2 {
-
- public void launch(IEditorPart editor, String mode) {
- // launch an existing config if one exists
- ILaunchConfiguration[] configs = getLaunchConfigurations(editor);
- if (configs.length > 0) {
- // just launch the first one that supports the mode
- for (ILaunchConfiguration config : configs) {
- try {
- if (config.supportsMode(mode)) {
- DebugUITools.launch(configs[0], mode);
- return;
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
-
- IEditorInput editorInput = editor.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)editorInput).getFile();
- if (file != null) {
- launchProject(file.getProject(), null, null, mode);
- }
- }
- }
-
- public void launch(ISelection selection, String mode) {
-
- // launch an existing config if one exists
- ILaunchConfiguration[] configs = getLaunchConfigurations(selection);
- if (configs.length > 0) {
- // just launch the first one that supports the mode
- for (ILaunchConfiguration config : configs) {
- try {
- if (config.supportsMode(mode)) {
- DebugUITools.launch(configs[0], mode);
- return;
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
-
- IPath defaultMMP = null;
- boolean launched = false;
- Executable executable = null;
-
- if (selection instanceof IStructuredSelection) {
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (firstElement != null && firstElement instanceof Executable)
- {
- launchProject(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP, mode);
- launched = true;
- }
- else
- if (firstElement != null && firstElement instanceof IAdaptable)
- {
- IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class);
- if (file != null)
- {
- IPath filePath = file.getLocation();
- if ("mmp".equalsIgnoreCase(filePath.getFileExtension()))
- {
- defaultMMP = filePath;
- }
- else
- {
- executable = new Executable(file.getLocation(), file.getProject(), file);
- launchProject(file.getProject(), executable, defaultMMP, mode);
- launched = true;
- }
- }
- }
- }
-
- if (!launched)
- {
- List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
- if (projects.size() > 0) {
- launchProject(projects.get(0), executable, defaultMMP, mode);
- }
- }
- }
-
- private void launchProject(final IProject project, final Executable executable, final IPath defaultMMP, final String mode) {
- LaunchPlugin.getDefault().launchProject(project, executable, defaultMMP, mode);
- }
-
- public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection) {
- IPath defaultMMP = null;
- if (selection instanceof IStructuredSelection) {
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (firstElement != null && firstElement instanceof Executable)
- {
- return LaunchPlugin.getDefault().getLaunchConfigurations(((Executable)firstElement).getProject(), (Executable)firstElement, defaultMMP);
- }
- else
- if (firstElement != null && firstElement instanceof IAdaptable)
- {
- IFile file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class);
- if (file != null)
- {
- IPath filePath = file.getLocation();
- if ("mmp".equalsIgnoreCase(filePath.getFileExtension()))
- {
- defaultMMP = filePath;
- }
- Executable executable = new Executable(file.getLocation(), file.getProject(), file);
- return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), executable, defaultMMP);
- }
- }
- }
-
- List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
- if (projects.size() > 0) {
- return LaunchPlugin.getDefault().getLaunchConfigurations(projects.get(0), null, defaultMMP);
- }
- return null;
- }
-
- public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editorpart) {
- IEditorInput editorInput = editorpart.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)editorInput).getFile();
- if (file != null) {
- return LaunchPlugin.getDefault().getLaunchConfigurations(file.getProject(), null, null);
- }
- }
- return null;
- }
-
- public IResource getLaunchableResource(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (firstElement != null && firstElement instanceof IFile)
- {
- IFile file = (IFile) firstElement;
- return file.getProject();
- }
- if (firstElement != null && firstElement instanceof Executable)
- {
- return ((Executable)firstElement).getProject();
- }
- }
- List<IProject> projects = CarbideBuilderPlugin.getProjectsFromSelection(selection);
- if (projects.size() > 0) {
- return projects.get(0);
- }
- return null;
- }
-
- public IResource getLaunchableResource(IEditorPart editorpart) {
- IEditorInput editorInput = editorpart.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)editorInput).getFile();
- if (file != null) {
- return file.getProject();
- }
- }
- return null;
- }
-}
-
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/SymbianProjectPropertyTester.java Mon Feb 15 13:20:03 2010 -0600
@@ -16,16 +16,22 @@
*/
package com.nokia.cdt.internal.debug.launch;
+import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.executables.Executable;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
/**
* A property tester that determines if a file is an executable.
@@ -41,7 +47,13 @@
}
if ("isCarbideProject".equals(property)) { //$NON-NLS-1$
return isCarbideProject(receiver);
- }
+ }
+ if ("isEmulator".equals(property)) { //$NON-NLS-1$
+ return isEmulator(receiver);
+ }
+ if ("isNotEmulator".equals(property)) { //$NON-NLS-1$
+ return !isEmulator(receiver);
+ }
return true;
}
@@ -81,4 +93,63 @@
return (celement != null && celement instanceof IBinary);
}
+ private boolean isEmulator(Object receiver) {
+ if (receiver instanceof Executable) {
+ return isEmulatorBinaryPath(((Executable) receiver).getPath());
+ }
+ if (receiver instanceof IBinary) {
+ return isEmulatorBinaryPath(((IBinary) receiver).getPath());
+ }
+ if (receiver instanceof IAdaptable) {
+ IResource res = (IResource) ((IAdaptable) receiver).getAdapter(IResource.class);
+ if (res != null) {
+ IProject project = res.getProject();
+ if (project != null) {
+ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
+ if (cpi != null) {
+ ICarbideBuildConfiguration buildConfig = cpi.getDefaultConfiguration();
+ // just check the platform for the default config
+ if (buildConfig.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) {
+ return true;
+ }
+ }
+ else {
+ return getIsEmulatorFromExecutablesProject(project);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean getIsEmulatorFromExecutablesProject(IProject project) {
+ ICProject cProject = CoreModel.getDefault().create(project);
+ if (cProject != null) {
+ try {
+ for (IBinary bin : cProject.getBinaryContainer().getBinaries()) {
+ if (bin.isExecutable()) {
+ IPath path = bin.getResource().getLocation();
+ if (isEmulatorBinaryPath(path)) {
+ return true;
+ }
+ }
+ }
+ } catch (CModelException e) {
+ }
+ }
+ return false;
+ }
+
+ private boolean isEmulatorBinaryPath(IPath binaryPath) {
+ if (binaryPath != null) {
+ for (String segment : binaryPath.segments()) {
+ if (segment.equalsIgnoreCase("winscw")) //$NON-NLS-1$
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchSettingsDialog.java Mon Feb 15 13:20:03 2010 -0600
@@ -40,7 +40,7 @@
protected final static String UID = ".uid";
- protected final LaunchOptionsData data;
+ protected final LaunchWizardData data;
protected int INDENT;
private String title;
@@ -50,7 +50,7 @@
* @param parentShell
* @param data
*/
- public AbstractLaunchSettingsDialog(Shell parentShell, LaunchOptionsData data) {
+ public AbstractLaunchSettingsDialog(Shell parentShell, LaunchWizardData data) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
this.data = data;
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/AbstractLaunchWizardSection.java Mon Feb 15 13:20:03 2010 -0600
@@ -48,7 +48,7 @@
public abstract class AbstractLaunchWizardSection implements IWizardSection {
private static final String CHANGE_LABEL = "Change...";
- protected final LaunchOptionsData data;
+ protected final LaunchWizardData data;
private String sectionName;
protected IStatus status;
@@ -58,7 +58,7 @@
private ISectionChangeListener changeListener;
- public AbstractLaunchWizardSection(LaunchOptionsData data, String sectionName) {
+ public AbstractLaunchWizardSection(LaunchWizardData data, String sectionName) {
this.data = data;
this.sectionName = sectionName;
status = Status.OK_STATUS;
@@ -83,7 +83,7 @@
public abstract void createControl(Composite parent);
/** Create the dialog for the Change... button. */
- protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchOptionsData dialogData);
+ protected abstract AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData);
/** Refresh the section after the Change... dialog has been closed. */
protected abstract void refresh();
@@ -162,7 +162,7 @@
* @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#doChange()
*/
protected void doChange() {
- LaunchOptionsData dialogData = data.copy();
+ LaunchWizardData dialogData = data.copy();
AbstractLaunchSettingsDialog dialog = createChangeSettingsDialog(getControl().getShell(), dialogData);
if (dialog.open() == Window.OK) {
data.apply(dialogData);
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/CommandRunLaunchWizard2.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/CommandRunLaunchWizard2.java Mon Feb 15 13:20:03 2010 -0600
@@ -72,18 +72,18 @@
allMMPPaths,
currBuiltMMPPaths);
- LaunchWizard wiz = new LaunchWizard(project,
- info.getDefaultBuildConfigName(),
- mmpFiles,
- currBuiltExePaths,
- EpocEngineHelper.getHostPathForExecutable(info.getDefaultConfiguration(), mmpFiles.get(0)),
- false, false,
- ILaunchManager.DEBUG_MODE,
- trkService
- );
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wiz);
- dialog.setPageSize(500, 300);
- dialog.open();
+// LaunchWizard wiz = new LaunchWizard(project,
+// info.getDefaultBuildConfigName(),
+// mmpFiles,
+// currBuiltExePaths,
+// EpocEngineHelper.getHostPathForExecutable(info.getDefaultConfiguration(), mmpFiles.get(0)),
+// false, false,
+// ILaunchManager.DEBUG_MODE,
+// trkService
+// );
+// WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wiz);
+// dialog.setPageSize(500, 300);
+// dialog.open();
}
return null;
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java Mon Feb 15 13:20:03 2010 -0600
@@ -68,7 +68,7 @@
private Button editButton;
private Label descriptionLabel;
- protected ConnectToDeviceDialog(Shell shell, LaunchOptionsData data) {
+ protected ConnectToDeviceDialog(Shell shell, LaunchWizardData data) {
super(shell, data);
manager = RemoteConnectionsActivator.getConnectionsManager();
typeProvider = RemoteConnectionsActivator.getConnectionTypeProvider();
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java Mon Feb 15 13:20:03 2010 -0600
@@ -43,7 +43,7 @@
* @param unifiedLaunchOptionsPage
*
*/
- public ConnectToDeviceSection(LaunchOptionsData data, UnifiedLaunchOptionsPage launchOptionsPage) {
+ public ConnectToDeviceSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) {
super(data, "Connect to device");
this.launchOptionsPage = launchOptionsPage;
manager = RemoteConnectionsActivator.getConnectionsManager();
@@ -69,7 +69,7 @@
}
/** Get the simple status for the connection state */
- static IStatus revalidate(LaunchOptionsData data) {
+ static IStatus revalidate(LaunchWizardData data) {
IStatus status = Status.OK_STATUS;
if (data.getConnection() == null) {
@@ -80,7 +80,7 @@
}
static String getStandardPNPMessage() {
- return "You may plug in a device over USB or activate it over WLAN, or create a new connection now for your device or simulator.";
+ return "You may plug in a device over USB or activate it over WLAN, or create a new connection now for your device.";
}
@Override
@@ -99,7 +99,7 @@
}
@Override
- protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchOptionsData dialogData) {
+ protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData) {
return new ConnectToDeviceDialog(shell, dialogData);
}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java Mon Feb 15 13:20:03 2010 -0600
@@ -64,7 +64,7 @@
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
-import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EExeSelection;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection;
import com.nokia.cpp.internal.api.utils.core.PathUtils;
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
@@ -85,7 +85,7 @@
private Button sisBrowse;
private Composite installPackageUI;
- protected DebugRunProcessDialog(Shell shell, LaunchOptionsData data) {
+ protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) {
super(shell, data);
}
@@ -194,8 +194,9 @@
});
- if (data.requiresInstallPackage()) {
+ if (data.isInstallPackage()) {
installPackageCheckbox.setSelection(true);
+ updatePackageUI();
}
updateSisFile();
@@ -311,7 +312,7 @@
protected void updateSisFile() {
String sisPath;
if (sisFile != null) {
- sisPath = sisFile.getSelectionIndex() == 0 ? "" : sisFile.getText(); //$NON-NLS-1$
+ sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$
data.setSisPath(sisPath);
} else if (sisEdit != null) {
sisPath = sisEdit.getText();
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessSection.java Mon Feb 15 13:20:03 2010 -0600
@@ -19,11 +19,16 @@
import java.text.MessageFormat;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EExeSelection;
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection;
import com.nokia.cpp.internal.api.utils.core.PathUtils;
/**
@@ -31,7 +36,7 @@
*/
public class DebugRunProcessSection extends AbstractLaunchWizardSection {
- public DebugRunProcessSection(LaunchOptionsData data) {
+ public DebugRunProcessSection(LaunchWizardData data) {
super(data, MessageFormat.format("{0} process", data.getModeLabel()));
}
@@ -52,11 +57,20 @@
data.setExeSelectionPath(data.getExes().get(0));
else if (data.getDefaultExecutable() != null)
data.setExeSelectionPath(data.getDefaultExecutable());
+ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject());
+ if (cpi != null) {
+ data.setInstallPackage(!data.isSysTRKConnection());
+ ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
+ for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
+ IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath();
+ data.setSisPath(sisPath.toOSString());
+ }
+ }
}
@Override
protected AbstractLaunchSettingsDialog createChangeSettingsDialog(
- Shell shell, LaunchOptionsData dialogData) {
+ Shell shell, LaunchWizardData dialogData) {
return new DebugRunProcessDialog(shell, dialogData);
}
@@ -84,10 +98,11 @@
case ATTACH_TO_PROCESS:
break;
}
-
- // TODO: package
+
+ if (data.isInstallPackage() && (data.getSisPath() == null || data.getSisPath().length() == 0))
+ status = error("Carbide must install a package to debug this project.");
}
-
+
@Override
protected void updateUI() {
@@ -110,7 +125,7 @@
break;
}
- copyOrInstallMsg = "copy files to the device";
+ copyOrInstallMsg = getCopyOrInstallMsg();
String runOrDebugProcessMessage = MessageFormat.format(mainFormat, copyOrInstallMsg, runOrLaunchMsg);
descriptionLabel.setText(runOrDebugProcessMessage);
@@ -121,4 +136,11 @@
}
}
+ private String getCopyOrInstallMsg() {
+ if (data.isSysTRKConnection() || !data.isInstallPackage())
+ return "copy files to the device";
+ else
+ return MessageFormat.format("install \"{0}\"", data.getSisPath());
+ }
+
}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchOptionsData.java Sun Feb 14 20:52:26 2010 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-package com.nokia.cdt.internal.debug.launch.newwizard;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.osgi.service.prefs.Preferences;
-
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-import com.nokia.carbide.remoteconnections.interfaces.IService;
-import com.nokia.cpp.internal.api.utils.core.TextUtils;
-
-/**
- * Data manipulated by the launch wizard and its dialogs.
- */
-public class LaunchOptionsData {
- public interface IPathValidator {
- /**
- * @param path IPath
- * @return Error string or <code>null</code> if is valid
- */
- String isValidPath(IPath path);
- }
-
- // settings detected in project
- private final List<IPath> mmps;
- private final List<IPath> exes;
- private final IPath defaultExecutable;
- private final IProject project;
- private final String configurationName;
- private final IService service;
- private final boolean isEmulation;
- private final boolean emulatorOnly;
- private final String mode;
- private IConnection connection;
-
- // overall target
- public static class LaunchType {
- private final String launchId;
-
- public LaunchType(String launchId) {
- this.launchId = launchId;
- }
-
- public boolean isApplicable(LaunchOptionsData data) {
- return true;
- }
-
- public String getLaunchId() {
- return launchId;
- }
- };
-
- public final static LaunchType APP_TRK = new LaunchType(null);
- public final static LaunchType SYS_TRK = new LaunchType(null);
- public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
- public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null);
- public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null);
-
- // settings made in Debug/Run Process section
- enum EExeSelection {
- USE_PROJECT_EXECUTABLE,
- USE_REMOTE_EXECUTABLE,
- ATTACH_TO_PROCESS,
- };
-
- private EExeSelection exeSelection;
- private IPath exeSelectionPath = Path.EMPTY;
- private EBuildBeforeLaunchOption buildBeforeLaunch;
- private boolean installPackage;
- private String sisPath;
-
- // settings made in the Other Settings section
- enum EBuildBeforeLaunchOption {
- ALWAYS,
- NEVER,
- USE_WORKSPACE_SETTING,
- }
-
- public LaunchOptionsData(List<IPath> mmps, List<IPath> exes,
- IPath defaultExecutable, IProject project,
- String configurationName, boolean isEmulation,
- boolean emulatorOnly, String mode,
- IService trkService) {
- this.mmps = mmps;
- this.exes = exes;
- this.defaultExecutable = defaultExecutable;
- this.project = project;
- this.configurationName = configurationName;
- this.isEmulation = isEmulation;
- this.emulatorOnly = emulatorOnly;
- this.mode = mode;
- this.service = trkService;
- }
-
- /**
- * @return the service
- */
- public IService getService() {
- return service;
- }
-
- /**
- * @return
- */
- public boolean isDebug() {
- return mode.equals(ILaunchManager.DEBUG_MODE);
- }
-
- public String getModeLabel() {
- if (mode.equals(ILaunchManager.RUN_MODE))
- return "Run";
- else if (mode.equals(ILaunchManager.DEBUG_MODE))
- return "Debug";
- else
- return TextUtils.titleCase(mode);
-
- }
-
- /**
- * Validate the detected and/or configured data
- * @return IStatus, never <code>null</code>
- */
- public IStatus validate() {
- return Status.OK_STATUS;
- }
-
- /**
- * @return
- * @return
- */
- public List<IPath> getExes() {
- return exes;
- }
-
- /**
- * @return the defaultExecutable
- */
- public IPath getDefaultExecutable() {
- return defaultExecutable;
- }
-
- /**
- * Set the executable selection mode
- * @param selection
- */
- public void setExeSelection(EExeSelection selection) {
- this.exeSelection = selection;
- }
- /**
- * Set the path for the exe
- * @param path or <code>null</code>
- */
- public void setExeSelectionPath(IPath path) {
- this.exeSelectionPath = path != null ? path : Path.EMPTY;
- }
-
- /**
- * @return
- */
- public EExeSelection getExeSelection() {
- return exeSelection;
- }
-
- public IPath getExeSelectionPath() {
- return exeSelectionPath;
- }
-
- public String getConnectionName() {
- IConnection connection = getConnection();
- if (connection == null)
- return null;
- return connection.getDisplayName();
- }
-
- public void setBuildBeforeLaunchOption(
- EBuildBeforeLaunchOption setting) {
- this.buildBeforeLaunch = setting;
- }
-
- public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
- return buildBeforeLaunch;
- }
-
- /** Get current workspace setting */
- public boolean isWorkspaceBuildBeforeLaunch() {
- // here's how to get the prefs from a plugin's #getPreferenceStore() without violating access
- String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH;
- int idx = prefId.lastIndexOf('.');
- String plugin = prefId.substring(0, idx);
- Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin);
- return node.getBoolean(prefId, true);
- }
-
- /** Get actual launch-time setting */
- public boolean isCurrentBuildBeforeLaunch() {
- if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
- return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
- return isWorkspaceBuildBeforeLaunch();
- }
-
- /**
- * @param selection
- */
- public void setInstallPackage(boolean selection) {
- this.installPackage = selection;
- }
-
- /**
- * @return the installPackage
- */
- public boolean isInstallPackage() {
- return installPackage;
- }
-
- /**
- * @return
- */
- public IProject getProject() {
- return project;
- }
-
- /**
- * @param sisPath
- */
- public void setSisPath(String sisPath) {
- this.sisPath = sisPath;
- }
-
- /**
- * Copy the data, for use by a transient dialog.
- * @return new copy of data
- */
- public LaunchOptionsData copy() {
- LaunchOptionsData d = new LaunchOptionsData(
- mmps, exes, defaultExecutable, project, configurationName,
- isEmulation, emulatorOnly, mode, service);
- d.exeSelection = exeSelection;
- d.exeSelectionPath = exeSelectionPath;
- d.buildBeforeLaunch = buildBeforeLaunch;
- d.installPackage = installPackage;
- d.sisPath = sisPath;
- d.connection = connection;
- return d;
- }
-
- /**
- * Apply the given data to the receiver (when a transient dialog is accepted)
- * @param dialogData
- */
- public void apply(LaunchOptionsData dialogData) {
- exeSelection = dialogData.exeSelection;
- exeSelectionPath = dialogData.exeSelectionPath;
- buildBeforeLaunch = dialogData.buildBeforeLaunch;
- installPackage = dialogData.installPackage;
- sisPath = dialogData.sisPath;
- connection = dialogData.connection;
- }
-
- /**
- * @return
- */
- public boolean requiresInstallPackage() {
- return false;
- }
-
- public void setConnection(IConnection connection) {
- this.connection = connection;
- }
-
- public IConnection getConnection() {
- return connection;
- }
-
-}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizard.java Mon Feb 15 13:20:03 2010 -0600
@@ -18,14 +18,12 @@
package com.nokia.cdt.internal.debug.launch.newwizard;
import java.text.MessageFormat;
-import java.util.List;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IPageChangedListener;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.PageChangedEvent;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.wizard.IWizardContainer;
@@ -38,28 +36,29 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
+import com.nokia.cdt.internal.debug.launch.wizard.ILaunchCreationWizard;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
/**
* New launch wizard for Carbide 3.0.
*
* See https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=10419
*/
-public class LaunchWizard extends Wizard {
+public class LaunchWizard extends Wizard implements ILaunchCreationWizard {
- private LaunchOptionsData launchData;
+ private LaunchWizardData launchData;
private UnifiedLaunchOptionsPage mainPage;
private Button advancedButton;
private boolean advancedEdit;
private IPageChangedListener pageChangedListener;
+ private boolean hasFinished;
- public LaunchWizard(IProject project, String configurationName,
- List<IPath> mmps, List<IPath> exes, IPath defaultExecutable,
- boolean isEmulation, boolean emulatorOnly, String mode,
- IService trkService) {
- launchData = new LaunchOptionsData(mmps, exes, defaultExecutable, project, configurationName,
- isEmulation, emulatorOnly, mode, trkService);
+ public LaunchWizard(LaunchOptions launchOptions, IService trkService) {
+ launchData = new LaunchWizardData(launchOptions, trkService);
mainPage = new UnifiedLaunchOptionsPage(launchData);
mainPage.initializeSettings();
setWindowTitle("New Launch Configuration Wizard");
@@ -176,8 +175,33 @@
@Override
public boolean performFinish() {
- MessageDialog.openWarning(getShell(), "New Launch Configuration Wizard", "Launching from this wizard not enabled yet");
- return false;
+ hasFinished = true;
+ return true;
+ }
+
+ public boolean shouldOpenLaunchConfigurationDialog() {
+ return hasFinished && advancedEdit;
}
+ public ILaunchConfigurationWorkingCopy getLaunchConfiguration() {
+ if (!hasFinished)
+ return null;
+
+ ILaunchConfigurationWorkingCopy config = null;
+ try {
+ config = launchData.createConfiguration();
+ } catch (CoreException e) {
+ LaunchPlugin.log(e);
+ }
+
+ return config;
+ }
+
+ public void init() {
+ }
+
+ public int openWizard(Shell shell) {
+ WizardDialog dialog = new WizardDialog(shell, this);
+ return dialog.open();
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/LaunchWizardData.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.cdt.internal.debug.launch.newwizard;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.osgi.service.prefs.Preferences;
+
+import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.internal.api.IConnectedService2;
+import com.nokia.carbide.remoteconnections.internal.registry.Registry;
+import com.nokia.cdt.debug.cw.symbian.SettingsData;
+import com.nokia.cdt.internal.debug.launch.wizard.LaunchOptions;
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+
+import cwdbg.PreferenceConstants;
+
+/**
+ * Data manipulated by the launch wizard and its dialogs.
+ */
+@SuppressWarnings("restriction")
+public class LaunchWizardData extends LaunchOptions {
+ public interface IPathValidator {
+ /**
+ * @param path IPath
+ * @return Error string or <code>null</code> if is valid
+ */
+ String isValidPath(IPath path);
+ }
+
+ private final IService service;
+
+ // overall target
+ public static class LaunchType {
+ private final String launchId;
+
+ public LaunchType(String launchId) {
+ this.launchId = launchId;
+ }
+
+ public boolean isApplicable(LaunchWizardData data) {
+ return true;
+ }
+
+ public String getLaunchId() {
+ return launchId;
+ }
+ };
+
+ public final static LaunchType APP_TRK = new LaunchType(null);
+ public final static LaunchType SYS_TRK = new LaunchType(null);
+ public final static LaunchType ATTACH_TO_PROCESS_LAUNCH = new LaunchType(null);
+ public final static LaunchType PLATSIM_RUN_MODE = new LaunchType(null);
+ public final static LaunchType PLATSIM_STOP_MODE = new LaunchType(null);
+
+ // settings made in Debug/Run Process section
+ enum EExeSelection {
+ USE_PROJECT_EXECUTABLE,
+ USE_REMOTE_EXECUTABLE,
+ ATTACH_TO_PROCESS,
+ };
+
+ private EExeSelection exeSelection;
+ private IPath exeSelectionPath = Path.EMPTY;
+ private EBuildBeforeLaunchOption buildBeforeLaunch;
+ private boolean installPackage;
+ private String sisPath;
+ private IConnection connection;
+
+ // settings made in the Other Settings section
+ enum EBuildBeforeLaunchOption {
+ ALWAYS,
+ NEVER,
+ USE_WORKSPACE_SETTING,
+ }
+
+ public LaunchWizardData(LaunchOptions launchOptions, IService trkService) {
+ this.mmps = launchOptions.mmps;
+ this.exes = launchOptions.exes;
+ this.defaultExecutable = launchOptions.defaultExecutable;
+ this.project = launchOptions.project;
+ this.configurationName = launchOptions.configurationName;
+ this.isEmulation = launchOptions.isEmulation;
+ this.emulatorOnly = launchOptions.emulatorOnly;
+ this.mode = launchOptions.mode;
+ this.service = trkService;
+ }
+
+ /**
+ * @return the service
+ */
+ public IService getService() {
+ return service;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isDebug() {
+ return mode.equals(ILaunchManager.DEBUG_MODE);
+ }
+
+ public String getModeLabel() {
+ if (mode.equals(ILaunchManager.RUN_MODE))
+ return "Run";
+ else if (mode.equals(ILaunchManager.DEBUG_MODE))
+ return "Debug";
+ else
+ return TextUtils.titleCase(mode);
+
+ }
+
+ /**
+ * Validate the detected and/or configured data
+ * @return IStatus, never <code>null</code>
+ */
+ public IStatus validate() {
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return
+ * @return
+ */
+ public List<IPath> getExes() {
+ return exes;
+ }
+
+ /**
+ * @return the defaultExecutable
+ */
+ public IPath getDefaultExecutable() {
+ return defaultExecutable;
+ }
+
+ /**
+ * Set the executable selection mode
+ * @param selection
+ */
+ public void setExeSelection(EExeSelection selection) {
+ this.exeSelection = selection;
+ }
+ /**
+ * Set the path for the exe
+ * @param path or <code>null</code>
+ */
+ public void setExeSelectionPath(IPath path) {
+ this.exeSelectionPath = path != null ? path : Path.EMPTY;
+ }
+
+ /**
+ * @return
+ */
+ public EExeSelection getExeSelection() {
+ return exeSelection;
+ }
+
+ public IPath getExeSelectionPath() {
+ return exeSelectionPath;
+ }
+
+ public String getConnectionName() {
+ IConnection connection = getConnection();
+ if (connection == null)
+ return null;
+ return connection.getDisplayName();
+ }
+
+ public void setBuildBeforeLaunchOption(
+ EBuildBeforeLaunchOption setting) {
+ this.buildBeforeLaunch = setting;
+ }
+
+ public EBuildBeforeLaunchOption getBuildBeforeLaunch() {
+ return buildBeforeLaunch;
+ }
+
+ /** Get current workspace setting */
+ public boolean isWorkspaceBuildBeforeLaunch() {
+ // here's how to get the prefs from a plugin's #getPreferenceStore() without violating access
+ String prefId = IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH;
+ int idx = prefId.lastIndexOf('.');
+ String plugin = prefId.substring(0, idx);
+ Preferences node = Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(plugin);
+ return node.getBoolean(prefId, true);
+ }
+
+ /** Get actual launch-time setting */
+ public boolean isCurrentBuildBeforeLaunch() {
+ if (buildBeforeLaunch != EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
+ return buildBeforeLaunch == EBuildBeforeLaunchOption.ALWAYS;
+ return isWorkspaceBuildBeforeLaunch();
+ }
+
+ /**
+ * @param selection
+ */
+ public void setInstallPackage(boolean selection) {
+ this.installPackage = selection;
+ }
+
+ /**
+ * @return the installPackage
+ */
+ public boolean isInstallPackage() {
+ return installPackage;
+ }
+
+ /**
+ * @return
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /**
+ * @param sisPath
+ */
+ public void setSisPath(String sisPath) {
+ this.sisPath = sisPath;
+ }
+
+ /**
+ * @return
+ */
+ public String getSisPath() {
+ return sisPath;
+ }
+
+ /**
+ * Copy the data, for use by a transient dialog.
+ * @return new copy of data
+ */
+ public LaunchWizardData copy() {
+ LaunchOptions launchOptions = new LaunchOptions();
+ launchOptions.mmps = mmps;
+ launchOptions.exes = exes;
+ launchOptions.defaultExecutable = defaultExecutable;
+ launchOptions.project = project;
+ launchOptions.configurationName = configurationName;
+ launchOptions.isEmulation = isEmulation;
+ launchOptions.emulatorOnly = emulatorOnly;
+ launchOptions.mode = mode;
+ LaunchWizardData d = new LaunchWizardData(launchOptions, service);
+ d.exeSelection = exeSelection;
+ d.exeSelectionPath = exeSelectionPath;
+ d.buildBeforeLaunch = buildBeforeLaunch;
+ d.installPackage = installPackage;
+ d.sisPath = sisPath;
+ d.connection = connection;
+ return d;
+ }
+
+ /**
+ * Apply the given data to the receiver (when a transient dialog is accepted)
+ * @param dialogData
+ */
+ public void apply(LaunchWizardData dialogData) {
+ exeSelection = dialogData.exeSelection;
+ exeSelectionPath = dialogData.exeSelectionPath;
+ buildBeforeLaunch = dialogData.buildBeforeLaunch;
+ installPackage = dialogData.installPackage;
+ sisPath = dialogData.sisPath;
+ connection = dialogData.connection;
+ }
+
+ /**
+ * @return
+ */
+ public boolean requiresInstallPackage() {
+ return !isSysTRKConnection() || installPackage;
+ }
+
+ public void setConnection(IConnection connection) {
+ this.connection = connection;
+ }
+
+ public IConnection getConnection() {
+ return connection;
+ }
+
+ public ILaunchConfigurationWorkingCopy createConfiguration() throws CoreException {
+ String launchTypeId = getApplicableLaunchTypeId();
+ ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(launchTypeId);
+ ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, configurationName);
+ initializeConfigSettings(launchTypeId, config);
+
+ return config;
+ }
+
+ private void initializeConfigSettings(String launchTypeId, ILaunchConfigurationWorkingCopy config) {
+ IPath exePath = getExePath();
+ IPath mmpPath = getMmpPath(exePath);
+ if (launchTypeId.equals(SettingsData.APP_TRK_LAUNCH_TYPE_ID)) {
+ SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
+ }
+ else if (launchTypeId.equals(SettingsData.SYS_TRK_LAUNCH_TYPE_ID)) {
+ SettingsData.setDefaults(config, SettingsData.LaunchConfig_SysTRK, project, mmpPath, exePath);
+ }
+ else if (launchTypeId.equals(SettingsData.ATTACH_LAUNCH_TYPE_ID)) {
+ SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, project, mmpPath, exePath);
+ }
+ addBuildOptions(config);
+ // always set the current connection id
+ config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID);
+ if (installPackage)
+ config.setAttribute(PreferenceConstants.J_PN_SisFileHostPath, sisPath);
+ }
+
+ private IPath getMmpPath(IPath exePath) {
+ if (!mmps.isEmpty()) {
+ for (int i = 0; i < exes.size(); i++) {
+ IPath exe = exes.get(i);
+ if (exe.lastSegment().equals(exePath.lastSegment()))
+ return mmps.get(i);
+ }
+ }
+ return null;
+ }
+
+ private IPath getExePath() {
+ if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
+ return exes.get(0);
+ return exeSelectionPath;
+ }
+
+ private IConnectedService getConnectedService() {
+ if (connection != null) {
+ Collection<IConnectedService> connectedServices =
+ RemoteConnectionsActivator.getConnectionsManager().getConnectedServices(connection);
+ for (IConnectedService connectedService : connectedServices) {
+ if (connectedService.getService().getIdentifier().equals(service.getIdentifier()))
+ return connectedService;
+ }
+ }
+ return null;
+ }
+
+ public boolean isSysTRKConnection() {
+ IConnectedService connectedService = getConnectedService();
+ if (connectedService instanceof IConnectedService2) {
+ String value = ((IConnectedService2) connectedService).getProperties().get("is-system-trk"); //$NON-NLS-1$
+ return Boolean.parseBoolean(value);
+ }
+ return false;
+ }
+
+ private String getApplicableLaunchTypeId() {
+ if (exeSelection.equals(EExeSelection.ATTACH_TO_PROCESS))
+ return SettingsData.ATTACH_LAUNCH_TYPE_ID;
+ else if (!installPackage || isSysTRKConnection())
+ return SettingsData.SYS_TRK_LAUNCH_TYPE_ID;
+ else
+ return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
+ }
+
+ private void addBuildOptions(ILaunchConfigurationWorkingCopy config) {
+ int buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_USE_WORKSPACE_SETTING;
+ switch (buildBeforeLaunch) {
+ case NEVER:
+ buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED;
+ break;
+ case ALWAYS:
+ buildBeforeLaunchValue = ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED;
+ break;
+ }
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, buildBeforeLaunchValue);
+ }
+}
+
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsDialog.java Mon Feb 15 13:20:03 2010 -0600
@@ -35,7 +35,7 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PreferencesUtil;
-import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption;
/**
* This dialog allows in-depth configuration of the other settings in the launch.
@@ -48,7 +48,7 @@
private Button fWorkspaceSettingsButton;
private Link fWorkspaceSettingsLink;
- protected OtherSettingsDialog(Shell shell, LaunchOptionsData data) {
+ protected OtherSettingsDialog(Shell shell, LaunchWizardData data) {
super(shell, data);
}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java Mon Feb 15 13:20:03 2010 -0600
@@ -21,7 +21,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-import com.nokia.cdt.internal.debug.launch.newwizard.LaunchOptionsData.EBuildBeforeLaunchOption;
+import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption;
/**
* Present the "Build before debug" section with a short description.
@@ -31,7 +31,7 @@
/**
*
*/
- public OtherSettingsSection(LaunchOptionsData data) {
+ public OtherSettingsSection(LaunchWizardData data) {
super(data, "Other settings");
}
@@ -86,7 +86,7 @@
*/
@Override
protected AbstractLaunchSettingsDialog createChangeSettingsDialog(
- Shell shell, LaunchOptionsData dialogData) {
+ Shell shell, LaunchWizardData dialogData) {
return new OtherSettingsDialog(shell, dialogData);
}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java Mon Feb 15 13:20:03 2010 -0600
@@ -46,7 +46,7 @@
*/
public class UnifiedLaunchOptionsPage extends WizardPage implements ISectionChangeListener {
- private final LaunchOptionsData data;
+ private final LaunchWizardData data;
private ArrayList<IWizardSection> sections;
@@ -57,7 +57,7 @@
* @param project
* @param configurationName
*/
- public UnifiedLaunchOptionsPage(LaunchOptionsData data) {
+ public UnifiedLaunchOptionsPage(LaunchWizardData data) {
super("Configure Launch Settings");
setDescription("Configure the connection and process to launch.");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/ILaunchCreationWizard.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.cdt.internal.debug.launch.wizard;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.widgets.Shell;
+
+public interface ILaunchCreationWizard {
+
+ void init();
+
+ int openWizard(Shell shell);
+
+ ILaunchConfigurationWorkingCopy getLaunchConfiguration();
+
+ boolean shouldOpenLaunchConfigurationDialog();
+}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchCreationWizard.java Mon Feb 15 13:20:03 2010 -0600
@@ -30,11 +30,9 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
import com.nokia.carbide.cpp.ui.CarbideUIPlugin;
import com.nokia.carbide.cpp.ui.ICarbideSharedImages;
@@ -44,11 +42,10 @@
import com.nokia.cpp.internal.api.utils.core.Logging;
import com.nokia.cpp.internal.api.utils.core.Pair;
-public class LaunchCreationWizard extends Wizard {
+public class LaunchCreationWizard extends Wizard implements ILaunchCreationWizard {
private MainExecutableSelectionWizardPage fBinarySelectionPage;
private LaunchWizardSummaryPage fEmulationSummaryPage;
- private LaunchCategorySelectionPage fCategorySelectionPage;
private LaunchWizardSelectionPage fWizardSelectionPage;
private BuildOptionsSelectionPage fBuildOptionsSelectionPage;
private ILaunchConfigurationWorkingCopy launchConfig;
@@ -56,6 +53,7 @@
private IProject project;
private String configurationName;
private List<AbstractLaunchWizard> wizards = new ArrayList<AbstractLaunchWizard>();
+ private String categoryId;
public LaunchCreationWizard(IProject project, String configurationName,
List<IPath> mmps, List<IPath> exes, IPath defaultExecutable,
@@ -76,7 +74,6 @@
fBinarySelectionPage = new MainExecutableSelectionWizardPage(mmps, exes, defaultExecutable, true, emulatorPath, emulatorOnly, fEmulationSummaryPage);
}
else {
- fCategorySelectionPage = new LaunchCategorySelectionPage(this);
fWizardSelectionPage = new LaunchWizardSelectionPage(this, mmps, exes, defaultExecutable, project, configurationName, mode);
}
}
@@ -117,7 +114,6 @@
addPage(fEmulationSummaryPage);
}
else if (fWizardSelectionPage != null) {
- addPage(fCategorySelectionPage);
addPage(fWizardSelectionPage);
}
}
@@ -127,7 +123,7 @@
return true;
}
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ public void init() {
setWindowTitle(Messages.getString("LaunchCreationWizard.0")); //$NON-NLS-1$
setDefaultPageImageDescriptor(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_NEW_LAUNCH_CONFIG_WIZARD_BANNER));
}
@@ -155,8 +151,12 @@
return shouldOpenLaunchDialog;
}
- public String getSelectedCategoryId() {
- return fCategorySelectionPage.getSelectedCategoryId();
+ public void setCategoryId(String categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ public String getCategoryId() {
+ return categoryId;
}
public List<Wizard> getWizardsForCategory(String categoryId) {
@@ -170,30 +170,12 @@
}
private void loadWizards(List<IPath> mmps, List<IPath> exes, IPath defaultExecutable, String mode) {
- AppTRKLaunchWizard appTRKWizard = new AppTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName);
- if (appTRKWizard.supportsMode(mode)) {
- appTRKWizard.addPages();
- wizards.add(appTRKWizard);
- }
-
- SystemTRKLaunchWizard sysTRKWizard = new SystemTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName);
- if (sysTRKWizard.supportsMode(mode)) {
- sysTRKWizard.addPages();
- wizards.add(sysTRKWizard);
- }
-
Trace32LaunchWizard trace32Wizard = new Trace32LaunchWizard(mmps, exes, defaultExecutable, project, configurationName);
if (trace32Wizard.supportsMode(mode)) {
trace32Wizard.addPages();
wizards.add(trace32Wizard);
}
- AttachTRKLaunchWizard attachTRKWizard = new AttachTRKLaunchWizard(mmps, exes, defaultExecutable, project, configurationName);
- if (attachTRKWizard.supportsMode(mode)) {
- attachTRKWizard.addPages();
- wizards.add(attachTRKWizard);
- }
-
// load any wizard extensions
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(LaunchPlugin.PLUGIN_ID + ".launchWizardExtension"); //$NON-NLS-1$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchOptions.java Mon Feb 15 13:20:03 2010 -0600
@@ -0,0 +1,19 @@
+package com.nokia.cdt.internal.debug.launch.wizard;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+public class LaunchOptions {
+
+ public IProject project;
+ public String mode;
+ public String configurationName;
+ public boolean isEmulation; // aka isX86
+ public boolean emulatorOnly; // aka useEmulationByDefault
+ public IPath defaultExecutable;
+ public List<IPath> exes;
+ public List<IPath> mmps;
+
+}
\ No newline at end of file
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java Sun Feb 14 20:52:26 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/LaunchWizardSelectionPage.java Mon Feb 15 13:20:03 2010 -0600
@@ -146,7 +146,7 @@
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible && wizardSelectionTableViewer != null) {
- wizardSelectionTableViewer.setInput(mainWizard.getWizardsForCategory(mainWizard.getSelectedCategoryId()));
+ wizardSelectionTableViewer.setInput(mainWizard.getWizardsForCategory(mainWizard.getCategoryId()));
if (inputChanged) {
wizardSelectionTableViewer.setSelection(new StructuredSelection(wizardSelectionTableViewer.getElementAt(0)), true);
}