removed classic TRK launchers and related classes.
--- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java Mon Aug 16 22:04:30 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java Mon Aug 16 22:47:46 2010 -0500
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
@@ -42,8 +41,6 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchDelegate;
-import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
@@ -349,21 +346,6 @@
configuration.setAttribute(PreferenceConstants.J_PN_ProgramArguments, ""); //$NON-NLS-1$
configuration.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, Registry.CURRENT_CONNECTION_ID);
- HashSet<String> set = new HashSet<String>();
- set.add(ILaunchManager.DEBUG_MODE);
- try {
- ILaunchDelegate preferredDelegate = configuration.getPreferredDelegate(set);
- if (preferredDelegate == null) {
- if (configuration.getType().getIdentifier().equals(APP_TRK_LAUNCH_TYPE_ID)) {
- configuration.setPreferredLaunchDelegate(set, "com.nokia.carbide.cpp.edc.launch.appTRKLaunchDelegate"); //$NON-NLS-1$
- } else if (configuration.getType().getIdentifier().equals(SYS_TRK_LAUNCH_TYPE_ID)) {
- configuration.setPreferredLaunchDelegate(set, "com.nokia.carbide.cpp.edc.launch.systemTRKLaunchDelegate"); //$NON-NLS-1$
- } else if (configuration.getType().getIdentifier().equals(ATTACH_LAUNCH_TYPE_ID)) {
- configuration.setPreferredLaunchDelegate(set, "com.nokia.carbide.cpp.edc.launch.attachLaunchDelegate"); //$NON-NLS-1$
- }
- }
- } catch (CoreException e) {}
-
if (project != null) {
String projectName = project.getName();
configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
--- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Mon Aug 16 22:04:30 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml Mon Aug 16 22:47:46 2010 -0500
@@ -16,39 +16,6 @@
id="com.nokia.cdt.debug.launch.emulationLaunchDelegate">
</launchDelegate>
- <launchDelegate
- name="Classic Symbian OS Application TRK"
- delegateDescription="Launch a classic Symbian OS Application TRK debug session."
- delegate="com.nokia.cdt.internal.debug.launch.TRKLaunchDelegate"
- modes="run,debug"
- type="com.nokia.cdt.debug.launch.appTRKLaunch"
- id="com.nokia.cdt.debug.launch.appTRKLaunchDelegate"
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
- </launchDelegate>
-
- <launchDelegate
- name="Classic Symbian OS System TRK"
- delegateDescription="Launch a classic Symbian OS System TRK debug session."
- delegate="com.nokia.cdt.internal.debug.launch.TRKLaunchDelegate"
- modes="run,debug"
- type="com.nokia.cdt.debug.launch.systemTRKLaunch"
- id="com.nokia.cdt.debug.launch.systemTRKLaunchDelegate"
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
- </launchDelegate>
-
- <launchDelegate
- name="Classic Symbian OS Attach to Process"
- delegate="com.nokia.cdt.internal.debug.launch.AttachLaunchDelegate"
- delegateDescription="Launch a classic Symbian OS Attach to Process debug session."
- modes="debug"
- type="com.nokia.cdt.debug.launch.attachLaunch"
- id="com.nokia.cdt.debug.launch.attachLaunchDelegate"
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
- </launchDelegate>
-
</extension>
<extension
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java Mon Aug 16 22:04:30 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +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 org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.core.cdi.ICDISession;
-import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.swt.widgets.Display;
-
-import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
-import com.freescale.cdt.debug.cw.core.cdi.Session;
-import com.freescale.cdt.debug.cw.core.os.OSProcess;
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-import com.nokia.cdt.debug.cw.symbian.SettingsData;
-import com.nokia.cdt.debug.cw.symbian.SymbianPlugin;
-import com.nokia.cdt.internal.debug.launch.ui.ChooseProcessDialog;
-
-import cwdbg.PreferenceConstants;
-
-public class AttachLaunchDelegate extends TRKLaunchDelegate {
-
- private OSProcess attachTarget;
-
- @Override
- public void launch(ILaunchConfiguration config, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
- // See comment at definition of the "mutex" for why this "synchronized".
- synchronized(Session.sessionStartStopMutex()) {
-
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- monitor.beginTask(LaunchMessages.getString("LocalRunLaunchDelegate.Launching_Local_C_Application"), 10); //$NON-NLS-1$
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
-
- if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
- config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
- }
-
- final IConnection connection = RemoteConnectionsTRKHelper.ensureConnectionFromConfig(config);
- if (connection == null) {
- IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID,
- LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$
- throw new DebugException(status);
- }
- connection.useConnection(true);
-
- try {
- addBeingLaunched(config); // indicating the LC is being launched
-
- monitor.worked(1);
- IPath exePath = verifyProgramPath(config);
- ICProject project = verifyCProject(config);
- IBinaryObject exeFile = verifyBinary(project, exePath);
-
- // See comment for this method for more.
- SettingsData.setInternalPreferences(config, SettingsData.LaunchConfig_AppTRK);
-
- // set the default source locator if required
- setDefaultSourceLocator(launch, config);
-
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- hookConnectionStatus();
- // debug mode
- ICDebugConfiguration debugConfig = getDebugConfig(config);
- ICDISession dsession = null;
- String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
- if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
- dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
- new SubProgressMonitor(monitor, 8));
-
- assert(dsession instanceof Session);
- Session cwDebugSession = (Session)dsession;
-
- doAdditionalSessionSetup(cwDebugSession);
-
- IPath[] otherExecutables = getOtherExecutables(project, new Path(""), config, monitor);
- {
- try {
- monitor.worked(1);
-
- // if enabled in the prefs, show the console view(s)
- if (config.getAttribute(PreferenceConstants.J_PN_ViewUnframedData, false)) {
- SymbianPlugin.getDefault().openUnframedDataConsole(true);
- }
-
- if (config.getAttribute(PreferenceConstants.J_PN_ViewCommMessages, false)) {
- SymbianPlugin.getDefault().openTRKCommLogConsole(true);
- }
-
- config = synchronizeWithProjectAccessPaths(project, config);
-
- // Connect to device
- cwDebugSession.connectRemote(monitor);
-
- // get processes on the device
- OSProcess[] processesOnTarget = cwDebugSession.getTargetProcesses();
-
- // Ask user to choose a process
- String defaultProcessName = exeFile.getPath().removeFileExtension().lastSegment();
- OSProcess attachTarget = null;
- String choosenProcessTarget = config.getAttribute(SettingsData.AttachToProcessDialog_Selection, "");
- if (choosenProcessTarget.length() > 0) {
- attachTarget = chooseProcessTargetNoUI(processesOnTarget, choosenProcessTarget);
- } else {
- attachTarget = chooseProcessTarget(processesOnTarget, defaultProcessName);
- }
-
- if (attachTarget == null) {
- this.cancel(LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"), 0); //$NON-NLS-1$
- } else {
- String processName = attachTarget.parseProcess().getProcessName();
-
- for (IPath oExePath : otherExecutables) {
- if (oExePath.lastSegment().startsWith(processName))
- exePath = oExePath;
- }
-
- exeFile = verifyBinary(project, exePath);
-
- cwDebugSession.attachToProcess(
- attachTarget, launch, config,
- exeFile, otherExecutables, monitor,
- project,
- getTargetLabel(exeFile.getName()));
- }
-
- } catch (CoreException e) {
- Session session = (Session)dsession;
- session.cleanupAfterLaunchFailure();
- throw e;
- } catch (Exception e) {
- Session session = (Session)dsession;
- session.debuggingStopped(null);
- this.abort(e.getLocalizedMessage(), null, 0);
- }
- }
- }
- hookSessionEnded(launch);
- } else if (mode.equals(ILaunchManager.RUN_MODE)) {
- // run mode not supported for attach
- }
- } catch (CoreException e) {
- connection.useConnection(false);
- unhookConnectionStatus();
- if (! monitor.isCanceled()) // don't throw on user cancellation
- throw e;
- } finally {
- monitor.done();
- removeBeingLaunched(config);
- }
- } // end of synchronized.
- }
-
- private OSProcess chooseProcessTarget(final OSProcess[] processesOnTarget, final String defaultProcessName) {
- attachTarget = null;
-
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- ChooseProcessDialog dialog = new ChooseProcessDialog(
- processesOnTarget, defaultProcessName, Display.getDefault().getActiveShell());
- int dialogResult = dialog.open();
-
- if (dialogResult == org.eclipse.jface.dialogs.Dialog.OK) {
- attachTarget = dialog.getSelectedProcess();
- }
- }
- });
-
- return attachTarget;
- }
-
- private OSProcess chooseProcessTargetNoUI(final OSProcess[] processesOnTarget, final String choosenProcessName) {
- attachTarget = null;
-
- for (OSProcess process : processesOnTarget) {
- if (process.parseProcess().getProcessName().equals(choosenProcessName)) {
- attachTarget = process;
- break;
- }
- }
-
- return attachTarget;
- }
-}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchMessages.properties Mon Aug 16 22:04:30 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchMessages.properties Mon Aug 16 22:47:46 2010 -0500
@@ -1,5 +1,3 @@
CarbideCPPLaunchDelegate.DebuggerName=Carbide.c++ Debugger
CarbideCPPLaunchDelegate.DebugUnderway=A debug session is running for the following launch configuration. Please kill the existing session before launching another one.\n
-TRKLaunchDelegate.runSucceed=The following program is successfully launched on device.
-TRKLaunchDelegate.NoConnectionErrorMsg=The connection for this launch configuration has been deleted. Please edit the configuration and select a valid connection.
NokiaAbstractLaunchDelegate.LaunchUnderway=Launching "{0}" is already underway. Please find it in Progress View where you can either wait for it to finish or cancel it.
\ No newline at end of file
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java Mon Aug 16 22:04:30 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,426 +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.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.core.cdi.ICDISession;
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-
-import com.freescale.cdt.debug.cw.CWException;
-import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
-import com.freescale.cdt.debug.cw.core.cdi.ISessionListener;
-import com.freescale.cdt.debug.cw.core.cdi.Session;
-import com.freescale.cdt.debug.cw.core.cdi.model.Target;
-import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
-import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
-import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
-import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener;
-import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
-import com.nokia.cdt.debug.common.internal.api.ILaunchDelegateConnectionExtension;
-import com.nokia.cdt.debug.cw.symbian.SettingsData;
-import com.nokia.cdt.debug.cw.symbian.SymbianPlugin;
-import com.nokia.cdt.internal.debug.launch.ui.PartialUpgradeAlertDialog;
-
-import cwdbg.PreferenceConstants;
-
-public class TRKLaunchDelegate extends NokiaAbstractLaunchDelegate {
-
- private static final String DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION = "DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION"; //$NON-NLS-1$
- private static final int LARGE_SIS_THRESHOLD = 250 * 1024; // 250K
-
- protected Session cwDebugSession;
- protected IConnection connection;
- private IConnectionStatusChangedListener connectionStatusChangedListener;
- private List<ILaunchDelegateConnectionExtension> connectionExtensions;
-
- public void launch(
- ILaunchConfiguration config,
- final String mode,
- final ILaunch launch,
- IProgressMonitor monitor) throws CoreException
- {
- // See comment at definition of the "mutex" for why this "synchronized".
- synchronized(Session.sessionStartStopMutex()) {
-
- cwDebugSession = null;
-
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- monitor.beginTask(LaunchMessages.getString("LocalRunLaunchDelegate.Launching_Local_C_Application"), 30); //$NON-NLS-1$
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
-
- if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
- config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
- }
-
- connection = RemoteConnectionsTRKHelper.ensureConnectionFromConfig(config);
- if (connection == null) {
- IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID,
- LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$
- throw new DebugException(status);
- }
-
- invokeConnectionSpecificSetup(launch, new SubProgressMonitor(monitor, 5));
-
- connection.useConnection(true);
- try {
- addBeingLaunched(config); // indicating the LC is being launched
-
- monitor.worked(1);
- IPath exePath = verifyProgramPath(config);
- ICProject project = verifyCProject(config);
- IBinaryObject exeFile = verifyBinary(project, exePath);
- String arguments[] = getProgramArgumentsArray(config);
-
- // See comment for this method for more.
- SettingsData.setInternalPreferences(config, SettingsData.LaunchConfig_AppTRK);
-
- // set the partial upgrade pref value
- ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
- workingCopy.setAttribute(PreferenceConstants.J_PN_PUSisFileHostPath, ""); //$NON-NLS-1$
-
- String sisHostPath = config.getAttribute(PreferenceConstants.J_PN_SisFileHostPath, ""); //$NON-NLS-1$
- if (sisHostPath.length() > 0) {
- // app trk launch - see if there's a partial upgrade sis file
- IPath sisPath = new Path(sisHostPath);
- String buildConfigName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
- if (buildConfigName.length() > 0) {
- ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project.getProject());
- if (cpi != null) {
- for (ICarbideBuildConfiguration buildConfig : cpi.getBuildConfigurations()) {
- if (buildConfig.getDisplayString().equals(buildConfigName)) {
- IPath puSisPath = CarbideCPPBuilder.getPartialUpgradeSisPath(buildConfig, sisPath);
- if (puSisPath != null && puSisPath.toFile().exists()) {
- workingCopy.setAttribute(PreferenceConstants.J_PN_PUSisFileHostPath, puSisPath.toOSString());
- }
- break;
- }
- }
- }
- }
- }
-
- // save the changes
- workingCopy.doSave();
-
- // set the default source locator if required
- setDefaultSourceLocator(launch, config);
-
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- hookConnectionStatus();
- // debug mode
- ICDebugConfiguration debugConfig = getDebugConfig(config);
- ICDISession dsession = null;
- String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
- if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
- dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
- new SubProgressMonitor(monitor, 8));
-
- assert(dsession instanceof Session);
- cwDebugSession = (Session)dsession;
-
- doAdditionalSessionSetup(cwDebugSession);
-
- IPath[] otherExecutables = getOtherExecutables(project, exePath, config, new SubProgressMonitor(monitor, 1));
- {
- try {
- monitor.worked(1);
-
- // if enabled in the prefs, show the console view(s)
- if (config.getAttribute(PreferenceConstants.J_PN_ViewUnframedData, false)) {
- SymbianPlugin.getDefault().openUnframedDataConsole(true);
- }
-
- if (config.getAttribute(PreferenceConstants.J_PN_ViewCommMessages, false)) {
- SymbianPlugin.getDefault().openTRKCommLogConsole(true);
- }
-
- config = synchronizeWithProjectAccessPaths(project, config);
-
- File wd = getWorkingDirectory(config);
- Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true);
- ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget());
-
- } catch (CoreException e) {
- Session session = (Session)dsession;
- session.cleanupAfterLaunchFailure();
- throw e;
- } catch (Exception e) {
- Session session = (Session)dsession;
- session.debuggingStopped(null);
- this.abort(e.getLocalizedMessage(), null, 0);
- }
- }
- }
- hookSessionEnded(launch);
- }
- else if (mode.equals(ILaunchManager.RUN_MODE)) {
- // Run the program.
- // Connect to DE, download and launch the program, close debug session.
- ICDebugConfiguration debugConfig = getDebugConfig(config);
- ICDISession dsession = null;
-
- // Set up communication with DE.
- dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
- new SubProgressMonitor(monitor, 8));
-
- // Launch the program through the DE.
- cwDebugSession = (Session)dsession;
- cwDebugSession.launchExecutable(
- launch,
- config,
- exeFile,
- new IPath[0],
- arguments,
- null,
- getEnvironmentAsProperty(config),
- new SubProgressMonitor(monitor, 8),
- project,
- "", //$NON-NLS-1$
- false /* run instead of debug */);
-
- // The above call would throw exception on error. So it must have succeeded
- // if control gets here. Show success message in a dialog.
- //
- // get the name of the executable that's launched instead of, say, the DLL name if
- // exeFile is a DLL.
- final String exeLaunched = config.getAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, exeFile.toString());
- Display display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
-
- display.syncExec(new Runnable() {
- public void run() {
- shutdownConnection(launch);
- MessageDialog.openInformation(
- CUIPlugin.getActiveWorkbenchShell(),
- LaunchMessages.getString("CarbideCPPLaunchDelegate.DebuggerName"), //$NON-NLS-1$
- LaunchMessages.getString("TRKLaunchDelegate.runSucceed") + //$NON-NLS-1$
- "\n\t\"" + exeLaunched + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- }
-
- invokeConnectionSpecificPostLaunch(launch, new SubProgressMonitor(monitor, 5));
- } catch (CWException e) {
- shutdownConnection(launch);
- unhookConnectionStatus();
- if (! monitor.isCanceled()) // don't throw on user cancellation
- e.printStackTrace();
- } catch (CoreException e) {
- shutdownConnection(launch);
- unhookConnectionStatus();
- if (! monitor.isCanceled()) // don't throw on user cancellation
- throw e;
- } finally {
- monitor.done();
- removeBeingLaunched(config);
- }
- } // end of synchronized.
- }
-
- protected void shutdownConnection(ILaunch launch) {
- try {
- invokeConnectionSpecificShutdown(launch, new NullProgressMonitor());
- } catch (CoreException e) {
- LaunchPlugin.log(e);
- } finally {
- connection.useConnection(false);
- }
- }
-
- /** Create the extensions every session, in case they hold state. */
- protected List<ILaunchDelegateConnectionExtension> getLaunchDelegateConnectionExtensions() {
- if (connectionExtensions == null) {
- connectionExtensions = new ArrayList<ILaunchDelegateConnectionExtension>();
- IConfigurationElement[] elements =
- Platform.getExtensionRegistry().getConfigurationElementsFor(ILaunchDelegateConnectionExtension.ID);
- for (IConfigurationElement element : elements) {
- try {
- connectionExtensions.add((ILaunchDelegateConnectionExtension) element.createExecutableExtension("class"));
- } catch (CoreException e) {
- LaunchPlugin.log(e);
- }
- }
- }
- return connectionExtensions;
- }
-
- protected void invokeConnectionSpecificSetup(ILaunch launch,
- IProgressMonitor monitor) throws CoreException {
- List<ILaunchDelegateConnectionExtension> extensions = getLaunchDelegateConnectionExtensions();
- monitor.beginTask("", extensions.size());
- for (ILaunchDelegateConnectionExtension extension : extensions) {
- extension.initializeConnection(launch, connection, new SubProgressMonitor(monitor, 1));
- }
- monitor.done();
- }
-
- protected void invokeConnectionSpecificPostLaunch(ILaunch launch,
- IProgressMonitor monitor) throws CoreException {
- List<ILaunchDelegateConnectionExtension> extensions = getLaunchDelegateConnectionExtensions();
- monitor.beginTask("", extensions.size());
- for (ILaunchDelegateConnectionExtension extension : extensions) {
- extension.launchStarted(launch, connection, new SubProgressMonitor(monitor, 1));
- }
- monitor.done();
- }
-
-
- protected void invokeConnectionSpecificShutdown(
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
- List<ILaunchDelegateConnectionExtension> extensions = getLaunchDelegateConnectionExtensions();
- monitor.beginTask("", extensions.size());
- for (ILaunchDelegateConnectionExtension extension : extensions) {
- extension.terminateConnection(launch, connection, new SubProgressMonitor(monitor, 1));
- }
- monitor.done();
- }
-
- protected void hookSessionEnded(final ILaunch launch) {
- if (cwDebugSession != null) {
- cwDebugSession.addListener(new ISessionListener() {
- public void sessionEnded() {
- try {
- invokeConnectionSpecificShutdown(launch, new NullProgressMonitor());
- } catch (CoreException e) {
- LaunchPlugin.log(e);
- } finally {
- connection.useConnection(false);
- unhookConnectionStatus();
- }
- }
- });
- }
- }
-
- protected void hookConnectionStatus() {
- if (connection instanceof IConnection2) {
- connectionStatusChangedListener = new IConnectionStatusChangedListener() {
- public void statusChanged(IConnectionStatus status) {
- if (status.getEConnectionStatus().equals(EConnectionStatus.IN_USE_DISCONNECTED)) {
- try {
- cwDebugSession.getLaunch().terminate();
- } catch (Exception e) {
- LaunchPlugin.log(e);
- }
- }
- }
- };
- ((IConnection2) connection).addStatusChangedListener(connectionStatusChangedListener);
- }
- }
-
- protected void unhookConnectionStatus() {
- if (connection instanceof IConnection2 && connectionStatusChangedListener != null) {
- ((IConnection2) connection).removeStatusChangedListener(connectionStatusChangedListener);
- }
- }
-
- @Override
- public boolean buildForLaunch(final ILaunchConfiguration configuration,
- String mode, IProgressMonitor monitor) throws CoreException {
- // for app trk, check to see if we need to ask the user if they want to enable
- // partial upgrade builds
- String sisHostPath = configuration.getAttribute(PreferenceConstants.J_PN_SisFileHostPath, ""); //$NON-NLS-1$
- if (sisHostPath.length() > 0) {
- // app trk launch - see if the partial upgrade option is enabled
- IPath sisPath = new Path(sisHostPath);
- String buildConfigName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
- if (buildConfigName.length() > 0) {
- final ICProject project = verifyCProject(configuration);
- ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project.getProject());
- if (cpi != null) {
- for (ICarbideBuildConfiguration buildConfig : cpi.getBuildConfigurations()) {
- if (buildConfig.getDisplayString().equals(buildConfigName)) {
- if (null == CarbideCPPBuilder.getPartialUpgradeSisPath(buildConfig, sisPath)) {
- if (!configuration.getAttribute(DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION, false)) {
- // get the size of the sis file if it exists
- File sisFile = sisPath.toFile();
- if (sisFile.exists() && sisFile.length() > LARGE_SIS_THRESHOLD) {
- // it's larger than the threshold so present dialog.
-
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- PartialUpgradeAlertDialog dlg = new PartialUpgradeAlertDialog(CUIPlugin.getActiveWorkbenchShell(), project.getProject());
- dlg.open();
-
- // if they check the option then remember it
- if (dlg.dontAskAgain()) {
- try {
- ILaunchConfigurationWorkingCopy workingCopy = configuration.getWorkingCopy();
- workingCopy.setAttribute(DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION, true);
-
- // save the changes
- workingCopy.doSave();
- } catch (CoreException e) {
- e.printStackTrace();
- LaunchPlugin.log(e);
- }
- }
- }
- });
- }
- }
- }
- break;
- }
- }
- }
- }
- }
-
-
- return super.buildForLaunch(configuration, mode, monitor);
- }
-}