From 8b1fb78bf12ae740b57babd38ffd09de359fbc59 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 19 Apr 2009 04:04:45 +0000 Subject: [PATCH] Rolled back change that introduced IIndexInclude.getFullName method since the implementation was buggy (bug 272143). --- .../eclipse/cdt/core/index/IIndexInclude.java | 13 ++------ .../internal/core/pdom/dom/PDOMInclude.java | 30 ++++++++----------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexInclude.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexInclude.java index 1cc4cd9f632..5cb449d4d17 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexInclude.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexInclude.java @@ -8,7 +8,6 @@ * Contributors: * Markus Schorn - initial API and implementation * Andrew Ferguson (Symbian) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.core.index; @@ -58,16 +57,8 @@ public interface IIndexInclude { String getName() throws CoreException; /** - * Returns the name of the include. The name does not include the enclosing quotes - * or angle brackets. E.g.: for '' 'sys/types.h' will be returned. - * @throws CoreException - * @since 5.1 - */ - String getFullName() throws CoreException; - - /** - * Returns the character offset of the name of the include in its source file. - * The name does not include the enclosing quotes or angle brackets. + * Returns the character offset of the name of the include in its source file. The name does + * not include the enclosing quotes or angle brackets. * @throws CoreException */ int getNameOffset() throws CoreException; 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 5d3adc0da5f..3034d9cfd9f 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 @@ -6,9 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * QNX - Initial API and implementation - * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) + * QNX - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom; @@ -27,6 +26,7 @@ import org.eclipse.core.runtime.CoreException; /** * @author Doug Schaefer + * */ public class PDOMInclude implements IIndexFragmentInclude { @@ -49,7 +49,7 @@ public class PDOMInclude implements IIndexFragmentInclude { private final int record; // cached fields - private String fName; + private String fName= null; public PDOMInclude(PDOMLinkage pdom, int record) { this.linkage = pdom; @@ -95,7 +95,8 @@ public class PDOMInclude implements IIndexFragmentInclude { if (isResolved()) { // Remove us from the includedBy chain removeThisFromIncludedByChain(); - } else { + } + else { getNameForUnresolved().delete(); } @@ -106,11 +107,10 @@ public class PDOMInclude implements IIndexFragmentInclude { private void removeThisFromIncludedByChain() throws CoreException { PDOMInclude prevInclude = getPrevInIncludedBy(); PDOMInclude nextInclude = getNextInIncludedBy(); - if (prevInclude != null) { + if (prevInclude != null) prevInclude.setNextInIncludedBy(nextInclude); - } else { + else ((PDOMFile) getIncludes()).setFirstIncludedBy(nextInclude); - } if (nextInclude != null) nextInclude.setPrevInIncludedBy(prevInclude); @@ -136,7 +136,8 @@ public class PDOMInclude implements IIndexFragmentInclude { int rec= 0; if (includes == null) { rec= linkage.getDB().newString(name).getRecord(); - } else { + } + else { rec= includes.getRecord(); } linkage.getDB().putInt(record + INCLUDES_FILE_OR_NAME, rec); @@ -239,13 +240,6 @@ public class PDOMInclude implements IIndexFragmentInclude { } public String getName() throws CoreException { - if (fName == null) { - computeName(); - } - return fName.substring(fName.lastIndexOf('/') + 1); - } - - public String getFullName() throws CoreException { if (fName == null) { computeName(); } @@ -255,9 +249,11 @@ public class PDOMInclude implements IIndexFragmentInclude { private void computeName() throws CoreException { if (isResolved()) { fName= getIncludes().getLocation().getURI().getPath(); - } else { + } + else { fName= getNameForUnresolved().getString(); } + fName= fName.substring(fName.lastIndexOf('/')+1); } public void convertToUnresolved() throws CoreException {