Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Torregrosa Paez2016-03-29 08:53:18 -0400
committerPablo Torregrosa Paez2016-03-29 08:53:18 -0400
commit01acd751992fdfb4332d3ae69439214906c53e11 (patch)
tree2e9c49d9e68f26dfb74d0199f1b0c0d9c9802c82 /target_explorer
parentda0f96fa1429b4ff6b48e055622be15650db8632 (diff)
downloadorg.eclipse.tcf-01acd751992fdfb4332d3ae69439214906c53e11.tar.gz
org.eclipse.tcf-01acd751992fdfb4332d3ae69439214906c53e11.tar.xz
org.eclipse.tcf-01acd751992fdfb4332d3ae69439214906c53e11.zip
TE: Fix host path resolution and symbolic link error msg on remote apps
Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com> Change-Id: I4c0c266d7ad200a95e8efedca5a90fbd1fe9d550
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEAbstractMainTab.java31
3 files changed, 28 insertions, 7 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
index 9a7bef9dd..ba2668d24 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2016 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
@@ -36,6 +36,7 @@ public class Messages extends NLS {
public static String RemoteCMainTab_SkipDownload;
public static String RemoteCMainTab_ErrorNoProgram;
public static String RemoteCMainTab_ErrorNoConnection;
+ public static String RemoteCMainTab_ErrorSymbolicLink;
public static String RemoteCMainTab_Pid;
public static String TEHelper_executing;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
index 930814755..d33b26f85 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/nls/Messages.properties
@@ -26,6 +26,7 @@ RemoteCMainTab_Program=Remote Absolute File Path for C/C++ Application:
RemoteCMainTab_SkipDownload=Skip download to target path
RemoteCMainTab_ErrorNoProgram=Remote executable path is not specified.
RemoteCMainTab_ErrorNoConnection=Remote Connection must be selected.
+RemoteCMainTab_ErrorSymbolicLink=Selection is a symbolic link, did you mean ''{0}''?
RemoteCMainTab_Remote_Path_Browse_Button=Browse...
RemoteCMainTab_Pid=PID of remote application to attach:
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEAbstractMainTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEAbstractMainTab.java
index ac2154c5d..ebedcfb20 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEAbstractMainTab.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/tabs/TEAbstractMainTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 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
@@ -11,6 +11,8 @@ package org.eclipse.tcf.te.tcf.launch.cdt.tabs;
import java.io.File;
import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab;
@@ -22,6 +24,7 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -56,6 +59,7 @@ public abstract class TEAbstractMainTab extends CMainTab {
private static final String CONNECTION_TEXT_ERROR = Messages.RemoteCMainTab_ErrorNoConnection;
private static final String PRE_RUN_LABEL_TEXT = Messages.RemoteCMainTab_Prerun;
private static final String PID_LABEL_TEXT = Messages.RemoteCMainTab_Pid;
+ private static final String REMOTE_PROG_SYMBOLIC_TEXT_ERROR = Messages.RemoteCMainTab_ErrorSymbolicLink;
protected TCFPeerSelector peerSelector;
protected Label remoteProgLabel;
@@ -159,6 +163,12 @@ public abstract class TEAbstractMainTab extends CMainTab {
retVal = false;
}
}
+ } else {
+ try {
+ if ( Files.isSymbolicLink(Paths.get(fProgText.getText())) ) {
+ setErrorMessage(NLS.bind(REMOTE_PROG_SYMBOLIC_TEXT_ERROR, Files.readSymbolicLink(Paths.get(fProgText.getText()))));
+ }
+ } catch (Exception e) { /* Omitted on purpose */ }
}
return retVal;
}
@@ -423,12 +433,21 @@ public abstract class TEAbstractMainTab extends CMainTab {
IPathMapResolverService svc = ServiceManager.getInstance().getService(connection, IPathMapResolverService.class);
if (svc != null) {
String programName = svc.findHostPath(connection, remoteName);
- if (programName != null) {
- boolean prevProgTextFireNotification = progTextFireNotification;
- progTextFireNotification = false;
- fProgText.setText(programName);
- progTextFireNotification = prevProgTextFireNotification;
+ if (programName == null) {
+ // If there is no match, try to use the parent directory
+ String programParent = svc.findHostPath(connection, Path.fromPortableString(remoteName).removeLastSegments(1).toPortableString());
+ if (programParent != null) {
+ programName = new File(programParent, Path.fromPortableString(remoteName).lastSegment()).toString();
+ }
+ else {
+ programName = ""; //$NON-NLS-1$
+ }
}
+
+ boolean prevProgTextFireNotification = progTextFireNotification;
+ progTextFireNotification = false;
+ fProgText.setText(programName);
+ progTextFireNotification = prevProgTextFireNotification;
}
}
}

Back to the top