Example usage for org.eclipse.jdt.internal.core.hierarchy TypeHierarchy javaProject

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

Introduction

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

Prototype

public IJavaProject javaProject() 

Source Link

Document

Returns the java project this hierarchy was created in.

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 ww . j a v a  2  s.c o m*/
            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();
}