Skip to main content
summaryrefslogtreecommitdiffstats
path: root/cross
diff options
context:
space:
mode:
Diffstat (limited to 'cross')
-rw-r--r--cross/org.eclipse.cdt.launch.remote/.classpath4
-rw-r--r--cross/org.eclipse.cdt.launch.remote/.settings/org.eclipse.jdt.core.prefs10
-rw-r--r--cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF13
-rw-r--r--cross/org.eclipse.cdt.launch.remote/plugin.properties11
-rw-r--r--cross/org.eclipse.cdt.launch.remote/plugin.xml156
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Activator.java49
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java166
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFDebuggerTab.java91
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFMainTab.java675
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDebuggerTab.java73
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCMainTab.java12
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteDSFGDBDebuggerPage.java158
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteGdbLaunchDelegate.java116
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteLaunchConfigurationTabGroup.java27
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteRunLaunchDelegate.java176
15 files changed, 1530 insertions, 207 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/.classpath b/cross/org.eclipse.cdt.launch.remote/.classpath
index 7bdc3fd567..327dfdac61 100644
--- a/cross/org.eclipse.cdt.launch.remote/.classpath
+++ b/cross/org.eclipse.cdt.launch.remote/.classpath
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="discouraged" pattern="**/internal/**"/>
</accessrules>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/cross/org.eclipse.cdt.launch.remote/.settings/org.eclipse.jdt.core.prefs b/cross/org.eclipse.cdt.launch.remote/.settings/org.eclipse.jdt.core.prefs
index 381fc6eb06..cad5a679d5 100644
--- a/cross/org.eclipse.cdt.launch.remote/.settings/org.eclipse.jdt.core.prefs
+++ b/cross/org.eclipse.cdt.launch.remote/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Fri Mar 28 14:14:24 CET 2008
+#Tue Jun 01 14:51:21 MSD 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
@@ -12,7 +12,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
@@ -68,4 +68,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF b/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
index 66bfd8da30..6c27e2fa7b 100644
--- a/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
+++ b/cross/org.eclipse.cdt.launch.remote/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.launch.remote;singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.launch.remote.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
@@ -21,9 +21,14 @@ Require-Bundle: org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.core.runtime,
org.eclipse.cdt.debug.mi.ui,
org.eclipse.cdt.debug.ui,
- org.eclipse.rse.files.ui;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.rse.files.ui;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.cdt.dsf.gdb;bundle-version="3.0.0",
+ org.eclipse.cdt.dsf.gdb.ui;bundle-version="2.1.0",
+ org.eclipse.cdt.dsf;bundle-version="2.1.0",
+ org.eclipse.core.variables;bundle-version="3.2.300"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Bundle-Vendor: %providerName
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Export-Package: org.eclipse.cdt.launch.remote;x-internal:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.cdt.internal.launch.remote;x-internal:=true,
+ org.eclipse.cdt.launch.remote;x-internal:=true
diff --git a/cross/org.eclipse.cdt.launch.remote/plugin.properties b/cross/org.eclipse.cdt.launch.remote/plugin.properties
index 0c0f2ab0fe..4fcb15e224 100644
--- a/cross/org.eclipse.cdt.launch.remote/plugin.properties
+++ b/cross/org.eclipse.cdt.launch.remote/plugin.properties
@@ -1,13 +1,20 @@
################################################################################
-# Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
+# Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
-# Martin Oberhuber - initial API and implementation
+# Martin Oberhuber - initial API and implementation
+# Anna Dushistova (Mentor Graphics) - [314659] added launch delegate for dsf
################################################################################
pluginName=C/C++ Remote Debug Launcher
providerName=Eclipse CDT
+
+launchConfigurationType.name = C/C++ Remote Application
+cdiLaunchDelegate.name = Standard C/C++ Remote Application
+cdiLaunchDelegate.description = Standard remote application launching/debugging using the standard debugger Framework (CDI).
+dsfLaunchDelegate.name = GDB (DSF) Remote Debugging
+dsfLaunchDelegate.description = Start new application on a remote system under control of GDB debugger integrated using the Debugger Services Framework (DSF). \ No newline at end of file
diff --git a/cross/org.eclipse.cdt.launch.remote/plugin.xml b/cross/org.eclipse.cdt.launch.remote/plugin.xml
index fa6d0b2e6c..9b912e136e 100644
--- a/cross/org.eclipse.cdt.launch.remote/plugin.xml
+++ b/cross/org.eclipse.cdt.launch.remote/plugin.xml
@@ -1,29 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2006 PalmSource, Inc. and others
+Copyright (c) 2006, 2010 PalmSource, Inc. and others
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
-Ewa Matejska (PalmSource) - initial API and implementation
-Martin Oberhuber (Wind River) - fix 158529: Migrate docs to HTML / TOC format
+Ewa Matejska (PalmSource) - initial API and implementation
+Martin Oberhuber (Wind River) - fix 158529: Migrate docs to HTML / TOC format
+Anna Dushistova (Mentor Graphics) - [314659] added launch delegate for dsf
-->
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- delegate="org.eclipse.cdt.launch.remote.RemoteRunLaunchDelegate"
public="true"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
- name="C/C++ Remote Application"
+ name="%launchConfigurationType.name"
id="org.eclipse.rse.remotecdt.RemoteApplicationLaunch"
- modes="debug,run">
+ >
</launchConfigurationType>
</extension>
+ <extension point="org.eclipse.debug.core.launchDelegates">
+ <launchDelegate
+ id="org.eclipse.rse.remotecdt.launch"
+ type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch"
+ modes="run,debug"
+ delegate="org.eclipse.cdt.launch.remote.RemoteRunLaunchDelegate"
+ name="%cdiLaunchDelegate.name"
+ delegateDescription="%cdiLaunchDelegate.description"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchDelegate>
+ <launchDelegate
+ id="org.eclipse.rse.remotecdt.dsf.debug"
+ type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch"
+ modes="debug"
+ delegate="org.eclipse.cdt.launch.remote.RemoteGdbLaunchDelegate"
+ name="%dsfLaunchDelegate.name"
+ delegateDescription="%dsfLaunchDelegate.description"
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchDelegate>
+ </extension>
+
+
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
@@ -39,8 +61,126 @@ Martin Oberhuber (Wind River) - fix 158529: Migrate docs to HTML / TOC format
helpContextId="org.eclipse.rse.remotecdt.launchgroup"
id="org.eclipse.rse.remotecdt.RemoteLaunchTabGroup"
type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch">
+ <launchMode
+ mode="run">
+ </launchMode>
</launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.eclipse.cdt.launch.remote.RemoteLaunchConfigurationTabGroup"
+ helpContextId="org.eclipse.rse.remotecdt.launchgroup"
+ id="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ type="org.eclipse.rse.remotecdt.RemoteApplicationLaunch">
+ <launchMode
+ mode="debug">
+ </launchMode>
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabs">
+ <tab
+ id="org.eclipse.rse.remotecdt.launch.RemoteCMainTab"
+ group="org.eclipse.rse.remotecdt.RemoteLaunchTabGroup"
+ name="Main"
+ class="org.eclipse.cdt.launch.remote.RemoteCMainTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.debug.RemoteCMainTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Main"
+ class="org.eclipse.cdt.launch.remote.RemoteCMainTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.dsf.gdb.mainTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Main"
+ class="org.eclipse.cdt.launch.remote.RemoteCDSFMainTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.dsf.debug"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.launch.CAgrumentsTab"
+ group="org.eclipse.rse.remotecdt.RemoteLaunchTabGroup"
+ name="Arguments"
+ class="org.eclipse.cdt.launch.ui.CArgumentsTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.rse.remotecdt.launch.RemoteCMainTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.debug.CArgumentsTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Arguments"
+ class="org.eclipse.cdt.launch.ui.CArgumentsTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.rse.remotecdt.launch.RemoteCMainTab"/>
+ </tab>
+ <tab id="org.eclipse.rse.remotecdt.dsf.debug.CArgumentsTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Arguments"
+ class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CArgumentsTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.dsf.debug"/>
+ <placement after="org.eclipse.cdt.launch.remote.dsf.mainTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.launch.RemoteCDebuggerTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Debugger"
+ class="org.eclipse.cdt.launch.remote.RemoteCDebuggerTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/>
+ </tab>
+ <tab id="org.eclipse.rse.remotecdt.dsf.debug.RemoteCDSFDebuggerTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Debugger"
+ class="org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.dsf.debug"/>
+ <placement after="org.eclipse.cdt.dsf.gdb.launch.argumentsTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.launch.SourceLookupTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Source"
+ class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.rse.remotecdt.launch.RemoteCDebuggerTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.debug.dsf.SourceLookupTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Source"
+ class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.dsf.debug"/>
+ <placement after="org.eclipse.rse.remotecdt.dsf.debug.RemoteCDSFDebuggerTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.launch.CommonTab"
+ group="org.eclipse.rse.remotecdt.RemoteLaunchTabGroup"
+ name="Common"
+ class="org.eclipse.debug.ui.CommonTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.debug.CommonTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Common"
+ class="org.eclipse.debug.ui.CommonTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.launch"/>
+ <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.rse.remotecdt.debug.dsf.CommonTab"
+ group="org.eclipse.rse.remotecdt.RemoteDebugTabGroup"
+ name="Common"
+ class="org.eclipse.debug.ui.CommonTab">
+ <associatedDelegate delegate="org.eclipse.rse.remotecdt.dsf.debug"/>
+ <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
+ </tab>
+
</extension>
+
+
<extension
point="org.eclipse.cdt.debug.core.CDebugger">
<debugger
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Activator.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Activator.java
index 27cd2b2632..c8ed4252d0 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Activator.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/internal/launch/remote/Activator.java
@@ -1,17 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 PalmSource, Inc. and others.
+ * Copyright (c) 2006, 2010 PalmSource, Inc.and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Ewa Matejska (PalmSource)
+ * Ewa Matejska (PalmSource)
+ * Anna Dushistova (Mentor Graphics) - [314659] move remote launch/debug to DSF
*******************************************************************************/
package org.eclipse.cdt.internal.launch.remote;
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.eclipse.debug.core.ILaunchManager;
import org.osgi.framework.BundleContext;
/**
@@ -19,6 +27,16 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends Plugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.launch.remote"; //$NON-NLS-1$
+
+
+ private static final String REMOTE_LAUNCH_TYPE = "org.eclipse.rse.remotecdt.RemoteApplicationLaunch"; //$NON-NLS-1$
+
+
+ private static final String PREFERRED_DEBUG_REMOTE_LAUNCH_DELEGATE = "org.eclipse.rse.remotecdt.dsf.debug"; //$NON-NLS-1$
+
+
/* The shared instance */
private static Activator plugin;
@@ -35,6 +53,7 @@ public class Activator extends Plugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ setDefaultLaunchDelegates();
}
/*
@@ -55,4 +74,30 @@ public class Activator extends Plugin {
return plugin;
}
+ public static BundleContext getBundleContext() {
+ return getDefault().getBundle().getBundleContext();
+ }
+
+ private void setDefaultLaunchDelegates() {
+ // Set the default launch delegates as early as possible, and do it only once (Bug 312997)
+ ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
+
+ HashSet<String> debugSet = new HashSet<String>();
+ debugSet.add(ILaunchManager.DEBUG_MODE);
+
+ ILaunchConfigurationType remoteCfg = launchMgr.getLaunchConfigurationType(REMOTE_LAUNCH_TYPE);
+ try {
+ if (remoteCfg.getPreferredDelegate(debugSet) == null) {
+ ILaunchDelegate[] delegates = remoteCfg.getDelegates(debugSet);
+ for (ILaunchDelegate delegate : delegates) {
+ if (PREFERRED_DEBUG_REMOTE_LAUNCH_DELEGATE.equals(delegate.getId())) {
+ remoteCfg.setPreferredDelegate(debugSet, delegate);
+ break;
+ }
+ }
+ }
+ } catch (CoreException e) {}
+ }
+
+
}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java
index 6df4f34c90..e750eb38ba 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RSEHelper.java
@@ -1,33 +1,52 @@
/********************************************************************************
- * Copyright (c) 2009 MontaVista Software, Inc.
+ * Copyright (c) 2009, 2010 MontaVista Software, Inc. and others.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Anna Dushistova (MontaVista) - initial API and implementation
+ * Anna Dushistova (MontaVista) - initial API and implementation
+ * Anna Dushistova (Mentor Graphics) - [314659] moved common methods for DSF and CDI launches to this class
********************************************************************************/
package org.eclipse.cdt.launch.remote;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.internal.launch.remote.Activator;
import org.eclipse.cdt.internal.launch.remote.Messages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.services.IService;
+import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
+import org.eclipse.rse.services.files.IFileService;
+import org.eclipse.rse.services.shells.HostShellProcessAdapter;
+import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IShellService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
public class RSEHelper {
+ private final static String EXIT_CMD = "exit"; //$NON-NLS-1$
+ private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$
+
+
public static IHost getRemoteConnectionByName(String remoteConnection) {
if (remoteConnection == null)
return null;
@@ -151,4 +170,147 @@ public class RSEHelper {
return (IHost[]) shellConnections.toArray(new IHost[shellConnections.size()]);
}
+
+
+ public static void remoteFileDownload(ILaunchConfiguration config,
+ ILaunch launch, String localExePath, String remoteExePath,
+ IProgressMonitor monitor) throws CoreException {
+
+ boolean skipDownload = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
+ false);
+
+ if (skipDownload)
+ // Nothing to do. Download is skipped.
+ return;
+ monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100);
+ IFileService fileService;
+ try {
+ fileService = (IFileService) RSEHelper
+ .getConnectedRemoteFileService(
+ getCurrentConnection(config),
+ new SubProgressMonitor(monitor, 10));
+ File file = new File(localExePath);
+ Path remotePath = new Path(remoteExePath);
+ fileService.upload(file, remotePath.removeLastSegments(1)
+ .toString(), remotePath.lastSegment(), true, null, null,
+ new SubProgressMonitor(monitor, 85));
+ // Need to change the permissions to match the original file
+ // permissions because of a bug in upload
+ remoteShellExec(
+ config,
+ "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } catch (SystemOperationCancelledException e) {
+ abort(e.getLocalizedMessage(), null, IStatus.CANCEL);
+ } catch (Exception e) {
+ abort(Messages.RemoteRunLaunchDelegate_6, e,
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ static String spaceEscapify(String inputString) {
+ if (inputString == null)
+ return null;
+
+ return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public static IHost getCurrentConnection(ILaunchConfiguration config)
+ throws CoreException {
+ String remoteConnection = config.getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
+ ""); //$NON-NLS-1$
+ IHost connection = RSEHelper
+ .getRemoteConnectionByName(remoteConnection);
+ if (connection == null) {
+ abort(Messages.RemoteRunLaunchDelegate_13, null,
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ return connection;
+ }
+
+ public static Process remoteShellExec(ILaunchConfiguration config,
+ String prelaunchCmd, String remoteCommandPath, String arguments,
+ IProgressMonitor monitor) throws CoreException {
+ // The exit command is called to force the remote shell to close after
+ // our command
+ // is executed. This is to prevent a running process at the end of the
+ // debug session.
+ // See Bug 158786.
+ monitor.beginTask(NLS.bind(Messages.RemoteRunLaunchDelegate_8,
+ remoteCommandPath, arguments), 10);
+ String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath)
+ : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
+
+ String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD;
+
+ if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$
+ remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand;
+
+ IShellService shellService;
+ Process p = null;
+ try {
+ shellService = (IShellService) RSEHelper
+ .getConnectedRemoteShellService(
+ getCurrentConnection(config),
+ new SubProgressMonitor(monitor, 7));
+
+ // This is necessary because runCommand does not actually run the
+ // command right now.
+ String env[] = new String[0];
+ try {
+ IHostShell hostShell = shellService.launchShell(
+ "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
+ hostShell.writeToShell(remoteCommand);
+ p = new HostShellProcessAdapter(hostShell);
+ } catch (Exception e) {
+ if (p != null) {
+ p.destroy();
+ }
+ abort(Messages.RemoteRunLaunchDelegate_7, e,
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ } catch (Exception e1) {
+ abort(e1.getMessage(), e1,
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+
+ monitor.done();
+ return p;
+ }
+
+ public static String getRemoteHostname(ILaunchConfiguration config)
+ throws CoreException {
+ IHost currentConnection = getCurrentConnection(config);
+ return currentConnection.getHostName();
+ }
+
+ /**
+ * Throws a core exception with an error status object built from the given
+ * message, lower level exception, and error code.
+ *
+ * @param message
+ * the status message
+ * @param exception
+ * lower level exception associated with the error, or
+ * <code>null</code> if none
+ * @param code
+ * error code
+ */
+ public static void abort(String message, Throwable exception, int code) throws CoreException {
+ IStatus status;
+ if (exception != null) {
+ MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, code, message, exception);
+ multiStatus.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, exception.getLocalizedMessage(), exception));
+ status= multiStatus;
+ } else {
+ status= new Status(IStatus.ERROR, Activator.PLUGIN_ID, code, message, null);
+ }
+ throw new CoreException(status);
+ }
+
+
}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFDebuggerTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFDebuggerTab.java
new file mode 100644
index 0000000000..afd9ee265f
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFDebuggerTab.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mentor Graphics Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (Mentor Graphics) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.launch.remote;
+
+import org.eclipse.cdt.debug.ui.ICDebuggerPage;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CDebuggerTab;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbCoreDebuggerPage;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbDebuggerPage;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbServerDebuggerPage;
+import org.eclipse.cdt.dsf.gdb.service.SessionType;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class RemoteCDSFDebuggerTab extends CDebuggerTab {
+
+ private final static String DEFAULTS_SET = "org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
+
+ public RemoteCDSFDebuggerTab() {
+ super(SessionType.REMOTE, false);
+ }
+
+ /*
+ * When the launch configuration is created for Run mode, this Debugger tab
+ * is not created because it is not used for Run mode but only for Debug
+ * mode. When we then open the same configuration in Debug mode, the launch
+ * configuration already exists and initializeFrom() is called instead of
+ * setDefaults(). We therefore call setDefaults() ourselves and update the
+ * configuration. If we don't then the user will be required to press Apply
+ * to get the default settings saved. Bug 281970
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(DEFAULTS_SET, true);
+ super.setDefaults(config);
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ try {
+ if (config.hasAttribute(DEFAULTS_SET) == false) {
+ ILaunchConfigurationWorkingCopy wc;
+ wc = config.getWorkingCopy();
+ setDefaults(wc);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ }
+
+ super.initializeFrom(config);
+ }
+
+ protected void loadDynamicDebugArea() {
+ Composite dynamicTabHolder = getDynamicTabHolder();
+ // Dispose of any current child widgets in the tab holder area
+ Control[] children = dynamicTabHolder.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ children[i].dispose();
+ }
+ setDynamicTab(new RemoteDSFGDBDebuggerPage());
+
+ ICDebuggerPage debuggerPage = getDynamicTab();
+ if (debuggerPage == null) {
+ return;
+ }
+ // Ask the dynamic UI to create its Control
+ debuggerPage
+ .setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ debuggerPage.createControl(dynamicTabHolder);
+ debuggerPage.getControl().setVisible(true);
+ dynamicTabHolder.layout(true);
+ contentsChanged();
+ }
+
+ @Override
+ public String getId() {
+ return "org.eclipse.rse.remotecdt.dsf.debug.RemoteCDSFDebuggerTab"; //$NON-NLS-1$
+ }
+
+}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFMainTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFMainTab.java
new file mode 100644
index 0000000000..f44bd866b9
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDSFMainTab.java
@@ -0,0 +1,675 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ewa Matejska (PalmSource) - initial API and implementation
+ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Martin Oberhuber (Wind River) - [196934] hide disabled system types in remotecdt combo
+ * Yu-Fen Kuo (MontaVista) - [190613] Fix NPE in Remotecdt when RSEUIPlugin has not been loaded
+ * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
+ * Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path
+ * Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement
+ * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
+ * Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated
+ * Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem
+ * Anna Dushistova (Mentor Graphics) - adapted from RemoteCMainTab
+ *******************************************************************************/
+package org.eclipse.cdt.launch.remote;
+
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab;
+import org.eclipse.cdt.internal.launch.remote.Messages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.window.Window;
+import org.eclipse.rse.core.IRSESystemType;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.IPropertySet;
+import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog;
+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
+import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+public class RemoteCDSFMainTab extends CMainTab {
+
+ /* Labels and Error Messages */
+ private static final String REMOTE_PROG_LABEL_TEXT = Messages.RemoteCMainTab_Program;
+ private static final String SKIP_DOWNLOAD_BUTTON_TEXT = Messages.RemoteCMainTab_SkipDownload;
+ private static final String REMOTE_PROG_TEXT_ERROR = Messages.RemoteCMainTab_ErrorNoProgram;
+ private static final String CONNECTION_TEXT_ERROR = Messages.RemoteCMainTab_ErrorNoConnection;
+ private static final String PRE_RUN_LABEL_TEXT = Messages.RemoteCMainTab_Prerun;
+
+ /* Defaults */
+ private static final String REMOTE_PATH_DEFAULT = EMPTY_STRING;
+ private static final boolean SKIP_DOWNLOAD_TO_REMOTE_DEFAULT = false;
+
+ protected Button newRemoteConnectionButton;
+ protected Button remoteConnectionPropertiesButton;
+ protected Button remoteBrowseButton;
+ protected Label connectionLabel;
+ protected Combo connectionCombo;
+ protected Label remoteProgLabel;
+ protected Text remoteProgText;
+ protected Button skipDownloadButton;
+ protected Button useLocalPathButton;
+
+ SystemNewConnectionAction action = null;
+ private Text preRunText;
+ private Label preRunLabel;
+
+ public RemoteCDSFMainTab() {
+ super(CMainTab.INCLUDE_BUILD_SETTINGS);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ // TODO Auto-generated method stub
+ super.createControl(parent);
+ Composite comp = (Composite) getControl();
+ /* The RSE Connection dropdown with New button. */
+ createVerticalSpacer(comp, 1);
+ createRemoteConnectionGroup(comp, 4);
+ /* The remote binary location and skip download option */
+ createVerticalSpacer(comp, 1);
+ createTargetExePathGroup(comp);
+ createDownloadOption(comp);
+
+ /* If the local binary path changes, modify the remote binary location */
+ fProgText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent evt) {
+ setLocalPathForRemotePath();
+ }
+ });
+
+ PlatformUI
+ .getWorkbench()
+ .getHelpSystem()
+ .setHelp(getControl(),
+ "org.eclipse.rse.internal.remotecdt.launchgroup"); //$NON-NLS-1$
+
+ }
+
+ /*
+ * isValid
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+ boolean retVal = super.isValid(config);
+ if (retVal == true) {
+ setErrorMessage(null);
+ int currentSelection = connectionCombo.getSelectionIndex();
+ String connection_name = currentSelection >= 0 ? connectionCombo
+ .getItem(currentSelection) : ""; //$NON-NLS-1$
+ if (connection_name.equals("")) { //$NON-NLS-1$
+ setErrorMessage(CONNECTION_TEXT_ERROR);
+ retVal = false;
+ }
+ if (retVal) {
+ String name = remoteProgText.getText().trim();
+ if (name.length() == 0) {
+ setErrorMessage(REMOTE_PROG_TEXT_ERROR);
+ retVal = false;
+ }
+ }
+ }
+ return retVal;
+ }
+
+ protected void createRemoteConnectionGroup(Composite parent, int colSpan) {
+ Composite projComp = new Composite(parent, SWT.NONE);
+ GridLayout projLayout = new GridLayout();
+ projLayout.numColumns = 4;
+ projLayout.marginHeight = 0;
+ projLayout.marginWidth = 0;
+ projComp.setLayout(projLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colSpan;
+ projComp.setLayoutData(gd);
+
+ connectionLabel = new Label(projComp, SWT.NONE);
+ connectionLabel.setText(Messages.RemoteCMainTab_Connection);
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ connectionLabel.setLayoutData(gd);
+
+ connectionCombo = new Combo(projComp, SWT.DROP_DOWN | SWT.READ_ONLY);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ connectionCombo.setLayoutData(gd);
+ connectionCombo.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ setDirty(true);
+ updateLaunchConfigurationDialog();
+ useDefaultsFromConnection();
+ updatePropertiesButton();
+ }
+ });
+
+ newRemoteConnectionButton = createPushButton(projComp,
+ Messages.RemoteCMainTab_New, null);
+ newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ handleNewRemoteConnectionSelected();
+ updateLaunchConfigurationDialog();
+ updateConnectionPulldown();
+ }
+ });
+
+ remoteConnectionPropertiesButton = createPushButton(projComp,
+ Messages.RemoteCMainTab_Properties, null);
+ remoteConnectionPropertiesButton
+ .addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ handleRemoteConnectionPropertiesSelected();
+ }
+ });
+
+ updateConnectionPulldown();
+ }
+
+ /*
+ * createTargetExePath This creates the remote path user-editable textfield
+ * on the Main Tab.
+ */
+ protected void createTargetExePathGroup(Composite parent) {
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.numColumns = 2;
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ mainComp.setLayoutData(gd);
+
+ remoteProgLabel = new Label(mainComp, SWT.NONE);
+ remoteProgLabel.setText(REMOTE_PROG_LABEL_TEXT);
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ remoteProgLabel.setLayoutData(gd);
+
+ remoteProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ remoteProgText.setLayoutData(gd);
+ remoteProgText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ remoteBrowseButton = createPushButton(mainComp,
+ Messages.RemoteCMainTab_Remote_Path_Browse_Button, null);
+ remoteBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ handleRemoteBrowseSelected();
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ // Commands to run before execution
+ preRunLabel = new Label(mainComp, SWT.NONE);
+ preRunLabel.setText(PRE_RUN_LABEL_TEXT);
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ preRunLabel.setLayoutData(gd);
+
+ preRunText = new Text(mainComp, SWT.MULTI | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ preRunText.setLayoutData(gd);
+ preRunText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ }
+
+ /*
+ * createDownloadOption This creates the skip download check button.
+ */
+ protected void createDownloadOption(Composite parent) {
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ GridLayout mainLayout = new GridLayout();
+ mainLayout.marginHeight = 0;
+ mainLayout.marginWidth = 0;
+ mainComp.setLayout(mainLayout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ mainComp.setLayoutData(gd);
+
+ skipDownloadButton = createCheckButton(mainComp,
+ SKIP_DOWNLOAD_BUTTON_TEXT);
+ skipDownloadButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ skipDownloadButton.setEnabled(true);
+ }
+
+ protected void handleNewRemoteConnectionSelected() {
+ if (action == null) {
+ action = new SystemNewConnectionAction(getControl().getShell(),
+ false, false, null);
+ }
+
+ try {
+ action.run();
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+ protected IHost getCurrentConnection() {
+ int currentSelection = connectionCombo.getSelectionIndex();
+ String remoteConnection = currentSelection >= 0 ? connectionCombo
+ .getItem(currentSelection) : null;
+ return RSEHelper.getRemoteConnectionByName(remoteConnection);
+ }
+
+ protected void handleRemoteBrowseSelected() {
+ IHost currentConnectionSelected = getCurrentConnection();
+ SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl()
+ .getShell(),
+ Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title,
+ currentConnectionSelected);
+ dlg.setBlockOnOpen(true);
+ if (dlg.open() == Window.OK) {
+ Object retObj = dlg.getSelectedObject();
+ if (retObj instanceof IRemoteFile) {
+ IRemoteFile selectedFile = (IRemoteFile) retObj;
+ remoteProgText.setText(selectedFile.getAbsolutePath());
+ }
+
+ }
+ }
+
+ protected void handleRemoteConnectionPropertiesSelected() {
+ class RemoteConnectionPropertyDialog extends Dialog {
+ private IHost fHost;
+ boolean fbLocalHost;
+ private Button fSkipDownloadBtn;
+ private Text fWSRoot;
+
+ public RemoteConnectionPropertyDialog(Shell parentShell,
+ String dialogTitle, IHost host) {
+ super(parentShell);
+ parentShell.setText(dialogTitle);
+ fHost = host;
+ fbLocalHost = fHost.getSystemType().isLocal();
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ // create composite
+ Composite composite = (Composite) super
+ .createDialogArea(parent);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(Messages.RemoteCMainTab_Properties_Location);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL
+ | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ fWSRoot = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ fWSRoot.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+
+ fSkipDownloadBtn = new Button(composite, SWT.CHECK);
+ fSkipDownloadBtn
+ .setText(Messages.RemoteCMainTab_Properties_Skip_default);
+ if (!fbLocalHost) {
+ IPropertySet propertySet = fHost
+ .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
+ if (propertySet != null) {
+ String value = propertySet
+ .getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
+ if (value != null) {
+ fWSRoot.setText(value);
+ }
+ fSkipDownloadBtn
+ .setSelection(Boolean
+ .valueOf(
+ propertySet
+ .getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
+ .booleanValue());
+ }
+ } else {
+ fSkipDownloadBtn.setEnabled(false);
+ fWSRoot.setEnabled(false);
+ }
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ protected void buttonPressed(int buttonId) {
+ if (!fbLocalHost && (buttonId == IDialogConstants.OK_ID)) {
+ IPropertySet propertySet = fHost
+ .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
+ if (propertySet == null) {
+ propertySet = fHost
+ .createPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
+ }
+ propertySet.addProperty(
+ IRemoteConnectionHostConstants.REMOTE_WS_ROOT,
+ fWSRoot.getText());
+ propertySet
+ .addProperty(
+ IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD,
+ Boolean.toString(fSkipDownloadBtn
+ .getSelection()));
+ fHost.commit();
+ }
+ super.buttonPressed(buttonId);
+ }
+ }
+ IHost currentConnectionSelected = getCurrentConnection();
+ RemoteConnectionPropertyDialog dlg = new RemoteConnectionPropertyDialog(
+ getControl().getShell(),
+ Messages.RemoteCMainTab_Properties_title,
+ currentConnectionSelected);
+ dlg.setBlockOnOpen(true);
+ dlg.open();
+ }
+
+ protected void updateConnectionPulldown() {
+ if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL))
+ try {
+ RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
+ } catch (InterruptedException e) {
+ return;
+ }
+ // already initialized
+ connectionCombo.removeAll();
+ IHost[] connections = RSEHelper.getSuitableConnections();
+ for (int i = 0; i < connections.length; i++) {
+ IRSESystemType sysType = connections[i].getSystemType();
+ if (sysType != null && sysType.isEnabled()) {
+ connectionCombo.add(connections[i].getAliasName());
+ }
+ }
+
+ if (connections.length > 0) {
+ connectionCombo.select(connections.length - 1);
+ }
+ updatePropertiesButton();
+ }
+
+ private void updatePropertiesButton() {
+ if ((remoteConnectionPropertiesButton == null)
+ || remoteConnectionPropertiesButton.isDisposed()) {
+ return;
+ }
+ boolean bEnableProperties = false;
+ IHost currentConnectionSelected = getCurrentConnection();
+ if (currentConnectionSelected != null) {
+ IRSESystemType sysType = currentConnectionSelected.getSystemType();
+ if (sysType != null && sysType.isEnabled() && !sysType.isLocal()) {
+ bEnableProperties = true;
+ }
+ }
+ remoteConnectionPropertiesButton.setEnabled(bEnableProperties);
+ }
+
+ protected void updateTargetProgFromConfig(ILaunchConfiguration config) {
+ String targetPath = null;
+ try {
+ targetPath = config.getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
+ REMOTE_PATH_DEFAULT);
+ } catch (CoreException e) {
+ // Ignore
+ }
+ remoteProgText.setText(targetPath);
+
+ String prelaunchCmd = null;
+ try {
+ prelaunchCmd = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
+ ""); //$NON-NLS-1$
+ } catch (CoreException e) {
+ // Ignore
+ }
+ preRunText.setText(prelaunchCmd);
+ }
+
+ protected void updateSkipDownloadFromConfig(ILaunchConfiguration config) {
+ boolean downloadToTarget = true;
+ try {
+ downloadToTarget = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
+ SKIP_DOWNLOAD_TO_REMOTE_DEFAULT);
+ } catch (CoreException e) {
+ // Ignore for now
+ }
+ skipDownloadButton.setSelection(downloadToTarget);
+ }
+
+ /*
+ * setLocalPathForRemotePath This function sets the remote path text field
+ * with the value of the local executable path.
+ */
+ private void setLocalPathForRemotePath() {
+ String programName = fProgText.getText().trim();
+ boolean bUpdateRemote = false;
+
+ String remoteName = remoteProgText.getText().trim();
+ String remoteWsRoot = getRemoteWSRoot();
+ if (remoteName.length() == 0) {
+ bUpdateRemote = true;
+ } else if (remoteWsRoot.length() != 0) {
+ bUpdateRemote = remoteName.equals(remoteWsRoot);
+ }
+
+ if (programName.length() != 0 && bUpdateRemote) {
+ IProject project = getCProject().getProject();
+ IPath exePath = new Path(programName);
+ if (!exePath.isAbsolute()) {
+ exePath = project.getFile(programName).getLocation();
+
+ IPath wsRoot = project.getWorkspace().getRoot().getLocation();
+ exePath = makeRelativeToWSRootLocation(exePath, remoteWsRoot,
+ wsRoot);
+ }
+ String path = exePath.toString();
+ remoteProgText.setText(path);
+ }
+ }
+
+ private void useDefaultsFromConnection() {
+ if ((remoteProgText != null) && !remoteProgText.isDisposed()) {
+ String remoteName = remoteProgText.getText().trim();
+ String remoteWsRoot = getRemoteWSRoot();
+ if (remoteName.length() == 0) {
+ remoteProgText.setText(remoteWsRoot);
+ } else {
+ // try to use remote path
+ IPath wsRoot = getCProject().getProject().getWorkspace()
+ .getRoot().getLocation();
+ IPath remotePath = makeRelativeToWSRootLocation(new Path(
+ remoteName), remoteWsRoot, wsRoot);
+ remoteProgText.setText(remotePath.toString());
+ }
+ }
+ if ((skipDownloadButton != null) && !skipDownloadButton.isDisposed()) {
+ skipDownloadButton.setSelection(getDefaultSkipDownload());
+ if (RSEHelper.getFileSubsystem(getCurrentConnection()) == null) {
+ skipDownloadButton.setEnabled(false);
+ } else {
+ skipDownloadButton.setEnabled(true);
+ }
+ }
+ if ((remoteBrowseButton != null) && !remoteBrowseButton.isDisposed()) {
+ if (RSEHelper.getFileSubsystem(getCurrentConnection()) == null) {
+ remoteBrowseButton.setEnabled(false);
+ } else {
+ remoteBrowseButton.setEnabled(true);
+ }
+ }
+ }
+
+ private IPath makeRelativeToWSRootLocation(IPath exePath,
+ String remoteWsRoot, IPath wsRoot) {
+ if (remoteWsRoot.length() != 0) {
+ // use remoteWSRoot instead of Workspace Root
+ if (wsRoot.isPrefixOf(exePath)) {
+ return new Path(remoteWsRoot).append(exePath
+ .removeFirstSegments(wsRoot.segmentCount()).setDevice(
+ null));
+ }
+ }
+ return exePath;
+ }
+
+ private String getRemoteWSRoot() {
+ IHost host = getCurrentConnection();
+ if (host != null) {
+ IPropertySet propertySet = host
+ .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
+ if (propertySet != null) {
+ String value = propertySet
+ .getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
+ if (value != null) {
+ return value;
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private boolean getDefaultSkipDownload() {
+ IHost host = getCurrentConnection();
+ if (host != null) {
+ if (RSEHelper.getFileSubsystem(host) == null) {
+ return true;
+ }
+ IPropertySet propertySet = host
+ .getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
+ if (propertySet != null) {
+ return Boolean
+ .valueOf(
+ propertySet
+ .getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
+ .booleanValue();
+ }
+ }
+ return SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ String remoteConnection = null;
+ try {
+ remoteConnection = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
+ ""); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ // Ignore
+ }
+
+ String[] items = connectionCombo.getItems();
+ int i = 0;
+ for (i = 0; i < items.length; i++)
+ if (items[i].equals(remoteConnection))
+ break;
+ /*
+ * Select the last used connection in the connecion pulldown if it still
+ * exists.
+ */
+ if (i < items.length)
+ connectionCombo.select(i);
+ else if (items.length > 0)
+ connectionCombo.select(0);
+
+ super.initializeFrom(config);
+
+ updateTargetProgFromConfig(config);
+ updateSkipDownloadFromConfig(config);
+ updatePropertiesButton();
+ }
+
+ /*
+ * performApply
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+
+ int currentSelection = connectionCombo.getSelectionIndex();
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
+ currentSelection >= 0 ? connectionCombo
+ .getItem(currentSelection) : null);
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
+ remoteProgText.getText());
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
+ skipDownloadButton.getSelection());
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
+ preRunText.getText());
+ super.performApply(config);
+ }
+
+ @Override
+ public String getId() {
+ return "org.eclipse.cdt.launch.remote.dsf.mainTab"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ super.setDefaults(config);
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
+ EMPTY_STRING);
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
+ REMOTE_PATH_DEFAULT);
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
+ SKIP_DOWNLOAD_TO_REMOTE_DEFAULT);
+ config.setAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
+ EMPTY_STRING);
+ }
+
+}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDebuggerTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDebuggerTab.java
index 243ef31d49..f4cf471a24 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDebuggerTab.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCDebuggerTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 PalmSource, Inc. and others.
+ * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ewa Matejska (PalmSource)
+ * Anna Dushistova (Mentor Graphics) - [314659] move remote launch/debug to DSF
*******************************************************************************/
package org.eclipse.cdt.launch.remote;
@@ -17,31 +18,44 @@ import java.util.List;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.launch.ui.CDebuggerTab;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
public class RemoteCDebuggerTab extends CDebuggerTab {
+
+ private final static String DEFAULTS_SET = "org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
+ public RemoteCDebuggerTab() {
+ super(false);
+ }
+
public void createControl(Composite parent) {
super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
- "org.eclipse.rse.internal.remotecdt.launchgroup"); //$NON-NLS-1$
+ PlatformUI
+ .getWorkbench()
+ .getHelpSystem()
+ .setHelp(getControl(),
+ "org.eclipse.rse.internal.remotecdt.launchgroup"); //$NON-NLS-1$
}
static final private String REMOTE_GDB_DEBUGGER_NAME = "remote gdb/mi"; //$NON-NLS-1$
-
+
public RemoteCDebuggerTab(boolean attachMode) {
super(attachMode);
}
-
- protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
- ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
+
+ protected void loadDebuggerComboBox(ILaunchConfiguration config,
+ String selection) {
+ ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault()
+ .getDebugConfigurations();
String defaultSelection = selection;
List list = new ArrayList();
- for(int i = 0; i < debugConfigs.length; i++) {
+ for (int i = 0; i < debugConfigs.length; i++) {
ICDebugConfiguration configuration = debugConfigs[i];
- if(configuration.getName().equals(REMOTE_GDB_DEBUGGER_NAME)) {
+ if (configuration.getName().equals(REMOTE_GDB_DEBUGGER_NAME)) {
list.add(configuration);
// Select as default selection
defaultSelection = configuration.getID();
@@ -49,8 +63,43 @@ public class RemoteCDebuggerTab extends CDebuggerTab {
}
}
setInitializeDefault(defaultSelection.equals("") ? true : false); //$NON-NLS-1$
- loadDebuggerCombo((ICDebugConfiguration[])list.toArray(
- new ICDebugConfiguration[list.size()]), defaultSelection);
+ loadDebuggerCombo(
+ (ICDebugConfiguration[]) list.toArray(new ICDebugConfiguration[list
+ .size()]), defaultSelection);
}
-
+
+ @Override
+ public String getId() {
+ return "org.eclipse.rse.remotecdt.launch.RemoteCDebuggerTab"; //$NON-NLS-1$
+ }
+
+ /*
+ * When the launch configuration is created for Run mode, this Debugger tab
+ * is not created because it is not used for Run mode but only for Debug
+ * mode. When we then open the same configuration in Debug mode, the launch
+ * configuration already exists and initializeFrom() is called instead of
+ * setDefaults(). We therefore call setDefaults() ourselves and update the
+ * configuration. If we don't then the user will be required to press Apply
+ * to get the default settings saved. Bug 281970
+ */
+ @Override
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(DEFAULTS_SET, true);
+ super.setDefaults(config);
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration config) {
+ try {
+ if (config.hasAttribute(DEFAULTS_SET) == false) {
+ ILaunchConfigurationWorkingCopy wc;
+ wc = config.getWorkingCopy();
+ setDefaults(wc);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ }
+ super.initializeFrom(config);
+ }
+
}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCMainTab.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCMainTab.java
index 5ae1b63a58..e390c0e1fd 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCMainTab.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteCMainTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 PalmSource, Inc. and others.
+ * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@
* Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
* Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated
* Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem
+ * Anna Dushistova (Mentor Graphics) - [314659] move remote launch/debug to DSF
*******************************************************************************/
package org.eclipse.cdt.launch.remote;
@@ -81,6 +82,10 @@ public class RemoteCMainTab extends CMainTab {
private Text preRunText;
private Label preRunLabel;
+ public RemoteCMainTab() {
+ this(true);
+ }
+
public RemoteCMainTab(boolean terminalOption) {
super(terminalOption);
}
@@ -665,4 +670,9 @@ public class RemoteCMainTab extends CMainTab {
}
return SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
}
+
+ @Override
+ public String getId() {
+ return "org.eclipse.rse.remotecdt.launch.RemoteCMainTab"; //$NON-NLS-1$
+ }
}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteDSFGDBDebuggerPage.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteDSFGDBDebuggerPage.java
new file mode 100644
index 0000000000..ebf491c982
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteDSFGDBDebuggerPage.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ewa Matejska (PalmSource)
+ *
+ * Referenced GDBDebuggerPage code to write this.
+ * Anna Dushistova (Mentor Graphics) - adapted from RemoteGDBDebuggerPage
+ *******************************************************************************/
+package org.eclipse.cdt.launch.remote;
+
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GdbDebuggerPage;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.SerialPortSettingsBlock;
+import org.eclipse.cdt.dsf.gdb.internal.ui.launching.TCPSettingsBlock;
+import org.eclipse.cdt.internal.launch.remote.Messages;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+public class RemoteDSFGDBDebuggerPage extends GdbDebuggerPage{
+
+ protected Text fGDBServerCommandText;
+
+ protected Text fGDBServerPortNumberText;
+
+ private boolean fIsInitializing = false;
+
+
+ public RemoteDSFGDBDebuggerPage() {
+ super();
+ }
+
+
+ public String getName() {
+ return Messages.Remote_GDB_Debugger_Options;
+ }
+
+ public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
+ super.setDefaults(configuration);
+ configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT );
+ configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT );
+ }
+
+ public void initializeFrom( ILaunchConfiguration configuration ) {
+ setInitializing(true);
+ super.initializeFrom(configuration);
+
+ String gdbserverCommand = null;
+ String gdbserverPortNumber = null;
+ try {
+ gdbserverCommand = configuration.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
+ }
+ catch( CoreException e ) {
+ }
+ try {
+ gdbserverPortNumber = configuration.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT );
+ }
+ catch( CoreException e ) {
+ }
+ fGDBServerCommandText.setText( gdbserverCommand );
+ fGDBServerPortNumberText.setText( gdbserverPortNumber );
+ setInitializing(false);
+ }
+
+ public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
+ super.performApply(configuration);
+ String str = fGDBServerCommandText.getText();
+ str.trim();
+ configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, str );
+ str = fGDBServerPortNumberText.getText();
+ str.trim();
+ configuration.setAttribute( IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, str );
+ }
+
+ protected void createGdbserverSettingsTab( TabFolder tabFolder ) {
+ TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
+ tabItem.setText( Messages.Gdbserver_Settings_Tab_Name );
+
+ Composite comp = new Composite(tabFolder, SWT.NULL);
+ comp.setLayout(new GridLayout(1, true));
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ comp.setFont( tabFolder.getFont() );
+ tabItem.setControl( comp );
+
+ Composite subComp = new Composite(comp, SWT.NULL);
+ subComp.setLayout(new GridLayout(2, true));
+ subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+ subComp.setFont( tabFolder.getFont() );
+
+ Label label = new Label(subComp, SWT.LEFT);
+ label.setText(Messages.Gdbserver_name_textfield_label);
+ GridData gd = new GridData();
+ label.setLayoutData( gd );
+
+
+ fGDBServerCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData();
+ fGDBServerCommandText.setLayoutData(data);
+ fGDBServerCommandText.addModifyListener( new ModifyListener() {
+
+ public void modifyText( ModifyEvent evt ) {
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ label = new Label(subComp, SWT.LEFT);
+ label.setText(Messages.Port_number_textfield_label);
+ gd = new GridData();
+ label.setLayoutData( gd );
+
+ fGDBServerPortNumberText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
+ data = new GridData();
+ fGDBServerPortNumberText.setLayoutData(data);
+ fGDBServerPortNumberText.addModifyListener( new ModifyListener() {
+
+ public void modifyText( ModifyEvent evt ) {
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse.swt.widgets.TabFolder)
+ */
+ public void createTabs( TabFolder tabFolder ) {
+ super.createTabs( tabFolder );
+ createGdbserverSettingsTab( tabFolder );
+ }
+
+ @Override
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ private void setInitializing(boolean isInitializing) {
+ fIsInitializing = isInitializing;
+ }
+
+}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteGdbLaunchDelegate.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteGdbLaunchDelegate.java
new file mode 100644
index 0000000000..37882f1464
--- /dev/null
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteGdbLaunchDelegate.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mentor Graphics Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anna Dushistova (Mentor Graphics) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.launch.remote;
+
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
+import org.eclipse.cdt.internal.launch.remote.Activator;
+import org.eclipse.cdt.internal.launch.remote.Messages;
+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.core.runtime.SubProgressMonitor;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.rse.core.RSECorePlugin;
+
+public class RemoteGdbLaunchDelegate extends GdbLaunchDelegate {
+
+ @Override
+ public void launch(ILaunchConfiguration config, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ // Need to initialize RSE
+ if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL)) {
+ monitor.subTask(Messages.RemoteRunLaunchDelegate_10);
+ try {
+ RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
+ } catch (InterruptedException e) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ getPluginID(), IStatus.OK, e.getLocalizedMessage(), e));
+ }
+ }
+
+ IPath exePath = CDebugUtils.verifyProgramPath(config);
+ if (exePath != null) {
+ // 1.Download binary if needed
+ String remoteExePath = config.getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
+ ""); //$NON-NLS-1$
+ monitor.setTaskName(Messages.RemoteRunLaunchDelegate_2);
+ RSEHelper.remoteFileDownload(config, launch, exePath.toString(),
+ remoteExePath, new SubProgressMonitor(monitor, 80));
+ // 2.Launch gdbserver on target
+ String gdbserverPortNumber = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
+ String gdbserverCommand = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND,
+ IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
+ String commandArguments = ":" + gdbserverPortNumber + " " //$NON-NLS-1$ //$NON-NLS-2$
+ + RSEHelper.spaceEscapify(remoteExePath);
+ String arguments = getProgramArguments(config);
+ String prelaunchCmd = config
+ .getAttribute(
+ IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
+ ""); //$NON-NLS-1$
+
+ if (arguments != null && !arguments.equals("")) //$NON-NLS-1$
+ commandArguments += " " + arguments; //$NON-NLS-1$
+ monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9);
+ Process remoteShellProcess = RSEHelper.remoteShellExec(config,
+ prelaunchCmd, gdbserverCommand, commandArguments,
+ new SubProgressMonitor(monitor, 5));
+
+ DebugPlugin.newProcess(launch, remoteShellProcess,
+ Messages.RemoteRunLaunchDelegate_RemoteShell);
+
+
+ // 3. Let debugger know how gdbserver was started on the remote
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
+ true);
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST,
+ RSEHelper.getRemoteHostname(config));
+ wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT,
+ gdbserverPortNumber);
+ wc.doSave();
+
+ }
+
+ super.launch(config, mode, launch, monitor);
+ }
+
+ protected String getProgramArguments(ILaunchConfiguration config)
+ throws CoreException {
+ String args = config.getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ (String) null);
+ if (args != null) {
+ args = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(args);
+ }
+ return args;
+ }
+
+ @Override
+ protected String getPluginID() {
+ return Activator.PLUGIN_ID;
+ }
+}
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteLaunchConfigurationTabGroup.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteLaunchConfigurationTabGroup.java
index b81f6073ee..e11612039f 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteLaunchConfigurationTabGroup.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteLaunchConfigurationTabGroup.java
@@ -6,32 +6,25 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchConfigurationTabGroup
+ * Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchConfigurationTabGroup
+ * Anna Dushistova (Mentor Graphics) - [314659] move remote launch/debug to DSF
*******************************************************************************/
-
package org.eclipse.cdt.launch.remote;
-import org.eclipse.cdt.launch.ui.CArgumentsTab;
+
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
-import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
/**
- * This class defines the tab group for the Remote C++ Launch
- * Configuration.
+ * This class defines the tab group for the Remote C++ Launch Configuration. It
+ * returns an empty set of tabs because all the tabs are contributed via
+ * launchConfigurationTabs extension point
*/
public class RemoteLaunchConfigurationTabGroup extends
AbstractLaunchConfigurationTabGroup {
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
- new RemoteCMainTab(true),
- new CArgumentsTab(),
- new RemoteCDebuggerTab(false),
- new SourceLookupTab(),
- new CommonTab()
- };
- setTabs(tabs);
- }
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {};
+ setTabs(tabs);
+ }
} \ No newline at end of file
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteRunLaunchDelegate.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteRunLaunchDelegate.java
index 8f4caccb49..1cce8b8230 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteRunLaunchDelegate.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteRunLaunchDelegate.java
@@ -1,30 +1,30 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 PalmSource, Inc. and others.
+ * Copyright (c) 2006, 2010 PalmSource, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchDelegate
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error
- * Anna Dushistova (MontaVista) - [234490][remotecdt] Launching with disconnected target fails
- * Anna Dushistova (MontaVista) - [235298][remotecdt] Further improve progress reporting and cancellation of Remote CDT Launch
- * Anna Dushistova (MontaVista) - [244173][remotecdt][nls] Externalize Strings in RemoteRunLaunchDelegate
- * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
- * Nikita Shulga (EmbeddedAlley) - [265236][remotecdt] Wait for RSE to initialize before querying it for host list
- * Anna Dushistova (MontaVista) - [267951] [remotecdt] Support systemTypes without files subsystem
+ * Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchDelegate
+ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error
+ * Anna Dushistova (MontaVista) - [234490][remotecdt] Launching with disconnected target fails
+ * Anna Dushistova (MontaVista) - [235298][remotecdt] Further improve progress reporting and cancellation of Remote CDT Launch
+ * Anna Dushistova (MontaVista) - [244173][remotecdt][nls] Externalize Strings in RemoteRunLaunchDelegate
+ * Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
+ * Nikita Shulga (EmbeddedAlley) - [265236][remotecdt] Wait for RSE to initialize before querying it for host list
+ * Anna Dushistova (MontaVista) - [267951][remotecdt] Support systemTypes without files subsystem
+ * Anna Dushistova (Mentor Graphics) - [314659]Fixed deprecated methods
*******************************************************************************/
package org.eclipse.cdt.launch.remote;
-import java.io.File;
-
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDIDebugger2;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.cdi.CDIException;
@@ -32,6 +32,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
+import org.eclipse.cdt.internal.launch.remote.Activator;
import org.eclipse.cdt.internal.launch.remote.Messages;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.core.runtime.CoreException;
@@ -39,7 +40,6 @@ 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.DebugPlugin;
@@ -50,18 +50,9 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.services.shells.HostShellProcessAdapter;
-import org.eclipse.rse.services.shells.IHostShell;
-import org.eclipse.rse.services.shells.IShellService;
public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
- private final static String EXIT_CMD = "exit"; //$NON-NLS-1$
- private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$
-
/*
* (non-Javadoc)
*
@@ -71,8 +62,8 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
ILaunch launch, IProgressMonitor monitor) throws CoreException {
IBinaryObject exeFile = null;
- IPath exePath = verifyProgramPath(config);
- ICProject project = verifyCProject(config);
+ IPath exePath = CDebugUtils.verifyProgramPath(config);
+ ICProject project = CDebugUtils.verifyCProject(config);
if (exePath != null) {
exeFile = verifyBinary(project, exePath);
String arguments = getProgramArguments(config);
@@ -112,7 +103,7 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
try {
// Download the binary to the remote before debugging.
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_2);
- remoteFileDownload(config, launch, exePath.toString(),
+ RSEHelper.remoteFileDownload(config, launch, exePath.toString(),
remoteExePath, new SubProgressMonitor(monitor,
80));
@@ -128,11 +119,11 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND,
IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
String command_arguments = ":" + gdbserver_port_number + " " //$NON-NLS-1$ //$NON-NLS-2$
- + spaceEscapify(remoteExePath);
+ + RSEHelper.spaceEscapify(remoteExePath);
if (arguments != null && !arguments.equals("")) //$NON-NLS-1$
command_arguments += " " + arguments; //$NON-NLS-1$
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9);
- remoteShellProcess = remoteShellExec(config,
+ remoteShellProcess = RSEHelper.remoteShellExec(config,
prelaunchCmd, gdbserver_command,
command_arguments, new SubProgressMonitor(
monitor, 5));
@@ -153,7 +144,7 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
wc
.setAttribute(
IGDBServerMILaunchConfigurationConstants.ATTR_HOST,
- getRemoteHostname(config));
+ RSEHelper.getRemoteHostname(config));
wc
.setAttribute(
IGDBServerMILaunchConfigurationConstants.ATTR_PORT,
@@ -216,11 +207,11 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
try {
// Download the binary to the remote before debugging.
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_2);
- remoteFileDownload(config, launch, exePath.toString(),
+ RSEHelper.remoteFileDownload(config, launch, exePath.toString(),
remoteExePath, new SubProgressMonitor(monitor, 80));
// Use a remote shell to launch the binary.
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_12);
- remoteProcess = remoteShellExec(config, prelaunchCmd,
+ remoteProcess = RSEHelper.remoteShellExec(config, prelaunchCmd,
remoteExePath, arguments, new SubProgressMonitor(
monitor, 20));
DebugPlugin.newProcess(launch, remoteProcess,
@@ -240,127 +231,8 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
}
}
- private String spaceEscapify(String inputString) {
- if (inputString == null)
- return null;
-
- return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected IHost getCurrentConnection(ILaunchConfiguration config)
- throws CoreException {
- String remoteConnection = config.getAttribute(
- IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
- ""); //$NON-NLS-1$
- IHost connection = RSEHelper
- .getRemoteConnectionByName(remoteConnection);
- if (connection == null) {
- abort(Messages.RemoteRunLaunchDelegate_13, null,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- return connection;
- }
-
- protected Process remoteFileDownload(ILaunchConfiguration config,
- ILaunch launch, String localExePath, String remoteExePath,
- IProgressMonitor monitor) throws CoreException {
-
- boolean skipDownload = config
- .getAttribute(
- IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
- false);
-
- if (skipDownload)
- // Nothing to do. Download is skipped.
- return null;
- monitor.beginTask(Messages.RemoteRunLaunchDelegate_2, 100);
- IFileService fileService;
- try {
- fileService = (IFileService) RSEHelper
- .getConnectedRemoteFileService(
- getCurrentConnection(config),
- new SubProgressMonitor(monitor, 10));
- File file = new File(localExePath);
- Path remotePath = new Path(remoteExePath);
- fileService.upload(file, remotePath.removeLastSegments(1)
- .toString(), remotePath.lastSegment(), true, null, null,
- new SubProgressMonitor(monitor, 85));
- // Need to change the permissions to match the original file
- // permissions because of a bug in upload
- Process p = remoteShellExec(
- config,
- "", "chmod", "+x " + spaceEscapify(remotePath.toString()), new SubProgressMonitor(monitor, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Thread.sleep(500);
- p.destroy();
- } catch (SystemOperationCancelledException e) {
- cancel(e.getLocalizedMessage(), IStatus.CANCEL);
- } catch (Exception e) {
- abort(Messages.RemoteRunLaunchDelegate_6, e,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- } finally {
- monitor.done();
- }
- return null;
- }
-
- protected String getRemoteHostname(ILaunchConfiguration config)
- throws CoreException {
- IHost currentConnection = getCurrentConnection(config);
- return currentConnection.getHostName();
- }
-
- protected Process remoteShellExec(ILaunchConfiguration config,
- String prelaunchCmd, String remoteCommandPath, String arguments,
- IProgressMonitor monitor) throws CoreException {
- // The exit command is called to force the remote shell to close after
- // our command
- // is executed. This is to prevent a running process at the end of the
- // debug session.
- // See Bug 158786.
- monitor.beginTask(NLS.bind(Messages.RemoteRunLaunchDelegate_8,
- remoteCommandPath, arguments), 10);
- String real_remote_command = arguments == null ? spaceEscapify(remoteCommandPath)
- : spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
-
- String remote_command = real_remote_command + CMD_DELIMITER + EXIT_CMD;
-
- if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$
- remote_command = prelaunchCmd + CMD_DELIMITER + remote_command;
-
- IShellService shellService;
- Process p = null;
- try {
- shellService = (IShellService) RSEHelper
- .getConnectedRemoteShellService(
- getCurrentConnection(config),
- new SubProgressMonitor(monitor, 7));
-
- // This is necessary because runCommand does not actually run the
- // command right now.
- String env[] = new String[0];
- try {
- IHostShell hostShell = shellService.launchShell(
- "", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
- hostShell.writeToShell(remote_command);
- p = new HostShellProcessAdapter(hostShell);
- } catch (Exception e) {
- if (p != null) {
- p.destroy();
- }
- abort(Messages.RemoteRunLaunchDelegate_7, e,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- abort(e1.getMessage(), e1,
- ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
-
- monitor.done();
- return p;
- }
-
+ @Override
protected String getPluginID() {
- return "org.eclipse.rse.internal.remotecdt"; //$NON-NLS-1$
+ return Activator.PLUGIN_ID;
}
}

Back to the top