1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 15:35:24 +02:00

Rolled back change that introduced IIndexInclude.getFullName method since the implementation was buggy (bug 272143).

This commit is contained in:
Sergey Prigogin 2009-04-19 04:04:45 +00:00
parent 40a7d9c364
commit 8b1fb78bf1
2 changed files with 15 additions and 28 deletions

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.index; package org.eclipse.cdt.core.index;
@ -58,16 +57,8 @@ public interface IIndexInclude {
String getName() throws CoreException; String getName() throws CoreException;
/** /**
* Returns the name of the include. The name does not include the enclosing quotes * Returns the character offset of the name of the include in its source file. The name does
* or angle brackets. E.g.: for '<sys/types.h>' 'sys/types.h' will be returned. * not include the enclosing quotes or angle brackets.
* @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.
* @throws CoreException * @throws CoreException
*/ */
int getNameOffset() throws CoreException; int getNameOffset() throws CoreException;

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * QNX - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom; package org.eclipse.cdt.internal.core.pdom.dom;
@ -27,6 +26,7 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
public class PDOMInclude implements IIndexFragmentInclude { public class PDOMInclude implements IIndexFragmentInclude {
@ -49,7 +49,7 @@ public class PDOMInclude implements IIndexFragmentInclude {
private final int record; private final int record;
// cached fields // cached fields
private String fName; private String fName= null;
public PDOMInclude(PDOMLinkage pdom, int record) { public PDOMInclude(PDOMLinkage pdom, int record) {
this.linkage = pdom; this.linkage = pdom;
@ -95,7 +95,8 @@ public class PDOMInclude implements IIndexFragmentInclude {
if (isResolved()) { if (isResolved()) {
// Remove us from the includedBy chain // Remove us from the includedBy chain
removeThisFromIncludedByChain(); removeThisFromIncludedByChain();
} else { }
else {
getNameForUnresolved().delete(); getNameForUnresolved().delete();
} }
@ -106,11 +107,10 @@ public class PDOMInclude implements IIndexFragmentInclude {
private void removeThisFromIncludedByChain() throws CoreException { private void removeThisFromIncludedByChain() throws CoreException {
PDOMInclude prevInclude = getPrevInIncludedBy(); PDOMInclude prevInclude = getPrevInIncludedBy();
PDOMInclude nextInclude = getNextInIncludedBy(); PDOMInclude nextInclude = getNextInIncludedBy();
if (prevInclude != null) { if (prevInclude != null)
prevInclude.setNextInIncludedBy(nextInclude); prevInclude.setNextInIncludedBy(nextInclude);
} else { else
((PDOMFile) getIncludes()).setFirstIncludedBy(nextInclude); ((PDOMFile) getIncludes()).setFirstIncludedBy(nextInclude);
}
if (nextInclude != null) if (nextInclude != null)
nextInclude.setPrevInIncludedBy(prevInclude); nextInclude.setPrevInIncludedBy(prevInclude);
@ -136,7 +136,8 @@ public class PDOMInclude implements IIndexFragmentInclude {
int rec= 0; int rec= 0;
if (includes == null) { if (includes == null) {
rec= linkage.getDB().newString(name).getRecord(); rec= linkage.getDB().newString(name).getRecord();
} else { }
else {
rec= includes.getRecord(); rec= includes.getRecord();
} }
linkage.getDB().putInt(record + INCLUDES_FILE_OR_NAME, rec); linkage.getDB().putInt(record + INCLUDES_FILE_OR_NAME, rec);
@ -239,13 +240,6 @@ public class PDOMInclude implements IIndexFragmentInclude {
} }
public String getName() throws CoreException { public String getName() throws CoreException {
if (fName == null) {
computeName();
}
return fName.substring(fName.lastIndexOf('/') + 1);
}
public String getFullName() throws CoreException {
if (fName == null) { if (fName == null) {
computeName(); computeName();
} }
@ -255,9 +249,11 @@ public class PDOMInclude implements IIndexFragmentInclude {
private void computeName() throws CoreException { private void computeName() throws CoreException {
if (isResolved()) { if (isResolved()) {
fName= getIncludes().getLocation().getURI().getPath(); fName= getIncludes().getLocation().getURI().getPath();
} else { }
else {
fName= getNameForUnresolved().getString(); fName= getNameForUnresolved().getString();
} }
fName= fName.substring(fName.lastIndexOf('/')+1);
} }
public void convertToUnresolved() throws CoreException { public void convertToUnresolved() throws CoreException {