public HierarchyBuilder(TypeHierarchy hierarchy) throws JavaModelException {
this.hierarchy = hierarchy;
JavaProject project = (JavaProject) hierarchy.javaProject();
IType focusType = hierarchy.getType();
org.aspectj.org.eclipse.jdt.core.ICompilationUnit unitToLookInside = focusType == null ? null : focusType.getCompilationUnit();
org.aspectj.org.eclipse.jdt.core.ICompilationUnit[] workingCopies = this.hierarchy.workingCopies;
org.aspectj.org.eclipse.jdt.core.ICompilationUnit[] unitsToLookInside;
if (unitToLookInside != null) {
int wcLength = workingCopies == null ? 0 : workingCopies.length;
if (wcLength == 0) {
unitsToLookInside = new org.aspectj.org.eclipse.jdt.core.ICompilationUnit[] {unitToLookInside};
} else {
unitsToLookInside = new org.aspectj.org.eclipse.jdt.core.ICompilationUnit[wcLength+1];
unitsToLookInside[0] = unitToLookInside;
System.arraycopy(workingCopies, 0, unitsToLookInside, 1, wcLength);
}
} else {
unitsToLookInside = workingCopies;
}
if (project != null) {
SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(unitsToLookInside);
this.nameLookup = searchableEnvironment.nameLookup;
this.hierarchyResolver =
new HierarchyResolver(
searchableEnvironment,
project.getOptions(true),
this,
new DefaultProblemFactory());
}
this.infoToHandle = new HashMap(5);
this.focusQualifiedName = focusType == null ? null : focusType.getFullyQualifiedName();
}