diff options
author | Uwe Stieber | 2014-11-04 15:15:53 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-11-04 15:15:53 +0000 |
commit | 2b80fdafd5d72ab3ce9e49222ad23dfed0c76e13 (patch) | |
tree | cd7896551b22719e88e076d65ed24cbe747868d3 | |
parent | 1bc450e38e7c11f4ca2a8675fb636a2e0c484eeb (diff) | |
download | org.eclipse.tcf-2b80fdafd5d72ab3ce9e49222ad23dfed0c76e13.tar.gz org.eclipse.tcf-2b80fdafd5d72ab3ce9e49222ad23dfed0c76e13.tar.xz org.eclipse.tcf-2b80fdafd5d72ab3ce9e49222ad23dfed0c76e13.zip |
Target Explorer: TCF customized C/C++ Remote Application main tab to support all variants of the program name field as input for path substitution
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TECDSFMainTab.java | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TECDSFMainTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TECDSFMainTab.java index 5c2425411..4e4b3e021 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TECDSFMainTab.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TECDSFMainTab.java @@ -24,8 +24,16 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.launch.cdt.tabs; +import java.io.File; +import java.net.URI; + +import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.URIUtil; +import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.jface.window.Window; @@ -296,7 +304,31 @@ public class TECDSFMainTab extends CMainTab { if (connection != null) { IPathMapResolverService svc = ServiceManager.getInstance().getService(connection, IPathMapResolverService.class); if (svc != null) { - String remoteName = svc.findTargetPath(connection, programName); + String remoteName = null; + + // The program name may contain variables, resolve them first + try { + programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName); + } + catch (CoreException e) { + // Silently ignore substitution failure (for consistency with "Arguments" and "Work directory" fields) + } + + // The path might be project relative + IPath p = new Path(programName); + if (!p.isAbsolute()) { + ICProject project = getCProject(); + if (project != null && project.isOpen()) { + URI uri = project.getLocationURI(); + File f = URIUtil.toFile(uri); + if (f != null) { + programName = new File(f, p.toString()).getAbsolutePath(); + } + } + } + + // Perform the path resolution + remoteName = svc.findTargetPath(connection, programName); if (remoteName != null) { boolean prevRemoteProgTextFireNotification = remoteProgTextFireNotification; remoteProgTextFireNotification = false; |