if (!partialMatch) {
// exact match
if (requestor.isCanceled()) return;
ClassFile classFile = new ClassFile((PackageFragment) pkg, name);
if (classFile.existsUsingJarTypeCache()) {
IType type = classFile.getType();
if (acceptType(type, acceptFlags, false/*not a source type*/)) {
requestor.acceptType(type);
}
}
} else {
IJavaElement[] classFiles= null;
try {
classFiles= pkg.getChildren();
} catch (JavaModelException npe) {
return; // the package is not present
}
int length= classFiles.length;
String unqualifiedName = name;
int index = name.lastIndexOf('$');
if (index != -1) {
//the type name of the inner type
unqualifiedName = Util.localTypeName(name, index, name.length());
// unqualifiedName is empty if the name ends with a '$' sign.
// See http://dev.eclipse.org/bugs/show_bug.cgi?id=14642
}
int matchLength = name.length();
for (int i = 0; i < length; i++) {
if (requestor.isCanceled())
return;
IJavaElement classFile= classFiles[i];
// MatchName will never have the extension ".class" and the elementName always will.
String elementName = classFile.getElementName();
if (elementName.regionMatches(true /*ignore case*/, 0, name, 0, matchLength)) {
IType type = ((ClassFile) classFile).getType();
String typeName = type.getElementName();
if (typeName.length() > 0 && !Character.isDigit(typeName.charAt(0))) { //not an anonymous type
if (nameMatches(unqualifiedName, type, true/*partial match*/) && acceptType(type, acceptFlags, false/*not a source type*/))
requestor.acceptType(type);
}
}