binaryFileName = null, qBinaryFileName = null,
sourceFileName = null, qSourceFileName = null,
qPackageName = null;
NameEnvironmentAnswer suggestedAnswer = null;
for (int i = 0, length = this.locations.length; i < length; i++) {
ClasspathLocation location = this.locations[i];
NameEnvironmentAnswer answer;
if (location instanceof ClasspathSourceDirectory) {
if (sourceFileName == null) {
qSourceFileName = qualifiedTypeName; // doesn't include the file extension
sourceFileName = qSourceFileName;
qPackageName = ""; //$NON-NLS-1$
if (qualifiedTypeName.length() > typeName.length) {
int typeNameStart = qSourceFileName.length() - typeName.length;
qPackageName = qSourceFileName.substring(0, typeNameStart - 1);
sourceFileName = qSourceFileName.substring(typeNameStart);
}
}
ICompilationUnit workingCopy = (ICompilationUnit) this.workingCopies.get(qualifiedTypeName);
if (workingCopy != null) {
answer = new NameEnvironmentAnswer(workingCopy, null /*no access restriction*/);
} else {
answer = location.findClass(
sourceFileName, // doesn't include the file extension
qPackageName,
qSourceFileName); // doesn't include the file extension
}
} else {
if (binaryFileName == null) {
qBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class;
binaryFileName = qBinaryFileName;
qPackageName = ""; //$NON-NLS-1$
if (qualifiedTypeName.length() > typeName.length) {
int typeNameStart = qBinaryFileName.length() - typeName.length - 6; // size of ".class"
qPackageName = qBinaryFileName.substring(0, typeNameStart - 1);
binaryFileName = qBinaryFileName.substring(typeNameStart);
}
}
answer =
location.findClass(
binaryFileName,
qPackageName,
qBinaryFileName);
}
if (answer != null) {