diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java index b52055c194a..72d8adfc0b6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java @@ -207,7 +207,11 @@ public class OpenIncludeAction extends Action { public boolean visit(IResourceProxy proxy) throws CoreException { if (proxy.getType() == IResource.FILE && proxy.getName().equalsIgnoreCase(name.lastSegment())) { - list.add(proxy.requestResource().getLocation()); + IPath rPath = proxy.requestResource().getLocation(); + int numSegToRemove = rPath.segmentCount() - name.segmentCount(); + IPath sPath = rPath.removeFirstSegments(numSegToRemove); + if (sPath.equals(name)) + list.add(rPath); return false; } return true;