Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343648 - Remote project outline displays header file from local host
Summary: Remote project outline displays header file from local host
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: RDT (show other bugs)
Version: 4.0.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.0.7   Edit
Assignee: Vivian Kong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-22 07:08 EDT by Dave Hudak CLA
Modified: 2011-04-28 15:49 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hudak CLA 2011-04-22 07:08:05 EDT
I am using Helios with PTP 4.0.6.201102161000.  I have created a remote C project which builds and runs correctly on the remote host.  To recreate this bug, I:

1.  I add all the correct remote paths to the project properties.  
2.  One path, /usr/include, exists on both the local side and the remote side
3.  For a header file in /usr/include (I tried stdlib.h and signal.h):
	a.  if I use the editor to open the header file (by left-clicking on the file in the editor and selecting "Open Declaration") - it opens the remote version (it works correctly).
	b.  If I use the Outline to open the header file (by clicking on the associated icon in the outline) - it opens the *local* version 

Also, in the Project Explorer, I see an "includes" pile after setting my remote paths.  If I expand "includes", I see the remote paths as folders.  
	a.  If I click on the arrow to open the folder of one of the remote-only paths (i.e., not /usr/include), the arrow rotates and disappears.  No folder entries are displayed.
	b.  If I click on the arrow to open the /usr/include, the arrow rotates and the files and folders are displayed from the *local* version.

Let me know if I can provide anything else.

Dave Hudak
Comment 1 Vivian Kong CLA 2011-04-26 10:19:05 EDT
I'll take a look
Comment 2 Vivian Kong CLA 2011-04-28 15:21:16 EDT
The OpenIncludeAction always tries to open the include on the local host first before attempting the remote host.  For remote projects, it should not try to open the include on the local host.

The second issue (in the Project Explorer) will need a separate fix.  I'll open another bug for that.

Proposed patch:

### Eclipse Workspace Patch 1.0
#P org.eclipse.ptp.rdt.ui
Index: src/org/eclipse/ptp/internal/rdt/ui/editor/OpenIncludeAction.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/internal/rdt/ui/editor/OpenIncludeAction.java,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 OpenIncludeAction.java
--- src/org/eclipse/ptp/internal/rdt/ui/editor/OpenIncludeAction.java	10 Feb 2011 20:11:11 -0000	1.4.2.2
+++ src/org/eclipse/ptp/internal/rdt/ui/editor/OpenIncludeAction.java	28 Apr 2011 19:16:03 -0000
@@ -13,6 +13,11 @@
  *     Anton Leherbauer (Wind River Systems)
  *******************************************************************************/
 
+/* -- ST-Origin --
+ * Source folder: org.eclipse.cdt.ui/src
+ * Class: org.eclipse.cdt.internal.ui.editor.OpenIncludeAction
+ * Version: 1.34
+ */
 package org.eclipse.ptp.internal.rdt.ui.editor;
 
 import java.io.File;
@@ -53,6 +58,7 @@
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.window.Window;
 import org.eclipse.ptp.rdt.core.RDTLog;
+import org.eclipse.ptp.rdt.core.resources.RemoteNature;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
 
@@ -98,7 +104,10 @@
 			if (fullFileName != null) {
 				IPath fullPath= new Path(fullFileName);
 				if (fullPath.isAbsolute() && fullPath.toFile().exists()) { //local
-					filesFound.add(fullPath.toFile().toURI());
+					//Bug 343648 - Remote project outline displays header file from local host
+					if (!RemoteNature.hasRemoteNature(include.getCProject().getProject())) {
+						filesFound.add(fullPath.toFile().toURI());
+					}
 				}
 				if (filesFound.isEmpty()) {
 					//remote: get host information and try again
Comment 3 Vivian Kong CLA 2011-04-28 15:49:30 EDT
Fixed in ptp_4_0 and HEAD.

See Bug 344190 for the issue in Project Explorer.