From faa699368bcfbeb139f4ee77132148bb96971db9 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Wed, 20 Jul 2005 19:20:46 +0000 Subject: [PATCH] Patch for Devin Steffler. Fixed Bug 76043 F3 opens external file instead of linked resource --- .../eclipse/cdt/core/parser/ParserUtil.java | 11 +- .../BaseSelectionTestsIndexer.java | 25 +++ .../CPPSelectionTestsCTagsIndexer.java | 26 +++ .../CPPSelectionTestsDOMIndexer.java | 26 +++ .../CPPSelectionTestsNoIndexer.java | 51 ++++++ .../CSelectionTestsCTagsIndexer.java | 26 +++ .../CSelectionTestsDOMIndexer.java | 26 +++ .../CSelectionTestsNoIndexer.java | 155 ++++++++++++++++++ 8 files changed, 343 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java index 59fde73e058..5d460c2cd7d 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/parser/ParserUtil.java @@ -115,6 +115,7 @@ public class ParserUtil if( workspace == null ) return null; IPath path = new Path( finalPath ); + IPath initialPath = new Path( finalPath ); IWorkspaceRoot root = workspace.getRoot(); if( root.getLocation().isPrefixOf( path ) ) @@ -130,9 +131,13 @@ public class ParserUtil return resultingResource; // check for linked resources - IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path); - if( files != null && files.length > 0 && files[0] != null) { - return files[0]; + IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(initialPath); + + // note for findFilesForLocation(IPath): This method does not consider whether resources actually exist at the given locations. + // so only return the first IFile found that is accessible + for(int i=0; i