From 9f0fd1d1990267ed66ee9f525a9c8c89414f9347 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 23 Apr 2009 08:59:17 +0000 Subject: [PATCH] Follow up for bug 272815. --- .../parser/org/eclipse/cdt/internal/core/index/CIndex.java | 2 +- .../org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java | 4 +++- .../cdt/internal/ui/actions/CreateParserLogAction.java | 4 ++-- .../cdt/internal/ui/includebrowser/IBContentProvider.java | 4 ++-- .../internal/ui/search/PDOMSearchUnresolvedIncludesQuery.java | 4 ++-- .../src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java | 3 +-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java index 656b73eaf66..ccf7ce2011a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java @@ -304,7 +304,7 @@ public class CIndex implements IIndex { for (int k= 0; k < includes.length; k++) { IIndexInclude include = includes[k]; IIndexFileLocation target= include.getIncludesLocation(); - Object key= target != null ? (Object) target : include.getName(); + Object key= target != null ? (Object) target : include.getFullName(); if (handled.add(key)) { out.add(include); if (depth != 0) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java index 8b05142e3e9..52065425ad8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMInclude.java @@ -265,7 +265,9 @@ public class PDOMInclude implements IIndexFragmentInclude { } public String getName() throws CoreException { - return getFullName().substring(fName.lastIndexOf('/') + 1); + final String fullName= getFullName(); + final int idx= Math.max(fullName.lastIndexOf('/'), fullName.lastIndexOf('\\')); + return fullName.substring(idx + 1); } public void convertToUnresolved() throws CoreException { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java index 9cca7186697..0fba02a70a5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/CreateParserLogAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2009 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 @@ -314,7 +314,7 @@ public class CreateParserLogAction implements IObjectActionDelegate { outputUnresolvedIncludes(index, out, indent, inc.getIncludesLocation(), linkageID, handled); } else { - out.println(indent + "Unresolved inclusion: " + inc.getName() + " in file " + + out.println(indent + "Unresolved inclusion: " + inc.getFullName() + " in file " + inc.getIncludedByLocation().getURI()); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java index 4ecb120dbe2..fe3b3328ff9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/includebrowser/IBContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2009 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 @@ -114,7 +114,7 @@ public class IBContentProvider extends AsyncTreeContentProvider { else { IIndexFileLocation includesPath= include.getIncludesLocation(); if (includesPath == null) { - targetFile= new IBFile(include.getName()); + targetFile= new IBFile(include.getFullName()); } else { targetFile= new IBFile(project, includesPath); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchUnresolvedIncludesQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchUnresolvedIncludesQuery.java index abf9268c0b3..70c8d1e8ba8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchUnresolvedIncludesQuery.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/PDOMSearchUnresolvedIncludesQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2009 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 @@ -39,7 +39,7 @@ public class PDOMSearchUnresolvedIncludesQuery extends PDOMSearchQuery { for (IIndexInclude include : file.getIncludes()) { if (include.isActive() && !include.isResolved()) { result.addMatch(new PDOMSearchMatch(new ProblemSearchElement( - IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND, include.getName(), + IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND, include.getFullName(), include.getIncludedByLocation()), include.getNameOffset(), include.getNameLength())); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java index d3bc0fd6c32..e7e31dbc85b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java @@ -243,7 +243,6 @@ public class IndexUI { for (int j=0; j bestDiff) { break; } - if (candidate.getName().endsWith(elementName)) { + if (candidate.getFullName().endsWith(elementName)) { bestDiff= diff; best= candidate; }