public void cleanup() {
this.directoryCache = null;
}
SimpleLookupTable directoryTable(String qualifiedPackageName) {
SimpleLookupTable dirTable = (SimpleLookupTable) this.directoryCache.get(qualifiedPackageName);
if (dirTable == this.missingPackageHolder) return null; // package exists in another classpath directory or jar
if (dirTable != null) return dirTable;
try {
IResource container = this.sourceFolder.findMember(qualifiedPackageName); // this is a case-sensitive check
if (container instanceof IContainer) {
IResource[] members = ((IContainer) container).members();
dirTable = new SimpleLookupTable();
for (int i = 0, l = members.length; i < l; i++) {
IResource m = members[i];
String name;
if (m.getType() == IResource.FILE) {
int index = Util.indexOfJavaLikeExtension(name = m.getName());
if (index >= 0) {
String fullPath = m.getFullPath().toString();
if (!org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) {
dirTable.put(name.substring(0, index), m);
}
}
}
}
// look for secondary types, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=382778
IJavaProject project = JavaCore.create(container.getProject());
Map secondaryTypePaths = JavaModelManager.getJavaModelManager().secondaryTypes(project, false, null);
if (secondaryTypePaths.size() > 0) {
Map typesInPackage = (Map) secondaryTypePaths.get(qualifiedPackageName);
if (typesInPackage != null && typesInPackage.size() > 0) {
for (Iterator j = typesInPackage.keySet().iterator(); j.hasNext();) {
String secondaryTypeName = (String) j.next();
IType secondaryType = (IType) typesInPackage.get(secondaryTypeName);
IJavaElement parent = secondaryType.getParent();
String fullPath = parent.getResource().getFullPath().toString();
if (!org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) {
dirTable.put(secondaryTypeName, parent.getResource());
}
}
}
}
this.directoryCache.put(qualifiedPackageName, dirTable);