Example usage for org.eclipse.jdt.internal.core.hierarchy HierarchyResolver HierarchyResolver

List of usage examples for org.eclipse.jdt.internal.core.hierarchy HierarchyResolver HierarchyResolver

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.hierarchy HierarchyResolver HierarchyResolver.

Prototype

public HierarchyResolver(INameEnvironment nameEnvironment, Map settings, HierarchyBuilder builder,
            IProblemFactory problemFactory) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.java

License:Open Source License

public HierarchyBuilder(TypeHierarchy hierarchy) throws JavaModelException {

    this.hierarchy = hierarchy;
    JavaProject project = (JavaProject) hierarchy.javaProject();

    IType focusType = hierarchy.getType();
    org.eclipse.jdt.core.ICompilationUnit unitToLookInside = focusType == null ? null
            : focusType.getCompilationUnit();
    org.eclipse.jdt.core.ICompilationUnit[] workingCopies = this.hierarchy.workingCopies;
    org.eclipse.jdt.core.ICompilationUnit[] unitsToLookInside;
    if (unitToLookInside != null) {
        int wcLength = workingCopies == null ? 0 : workingCopies.length;
        if (wcLength == 0) {
            unitsToLookInside = new org.eclipse.jdt.core.ICompilationUnit[] { unitToLookInside };
        } else {/*from  w w  w  .j a  v  a 2s . com*/
            unitsToLookInside = new org.eclipse.jdt.core.ICompilationUnit[wcLength + 1];
            unitsToLookInside[0] = unitToLookInside;
            System.arraycopy(workingCopies, 0, unitsToLookInside, 1, wcLength);
        }
    } else {
        unitsToLookInside = workingCopies;
    }
    if (project != null) {
        // GROOVY start - pulled out of the call
        Map optionMap = project.getOptions(true);
        CompilerUtils.configureOptionsBasedOnNature(optionMap, project);
        // GROOVY end
        SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(unitsToLookInside);
        this.nameLookup = searchableEnvironment.nameLookup;
        this.hierarchyResolver = new HierarchyResolver(searchableEnvironment,
                // GROOVY start
                /* old {
                project.getOptions(true),
                } new */
                optionMap,
                // GROOVY end
                this, new DefaultProblemFactory());
    }
    this.infoToHandle = new HashMap(5);
    this.focusQualifiedName = focusType == null ? null : focusType.getFullyQualifiedName();
}