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(LookupEnvironment lookupEnvironment, HierarchyBuilder builder) 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java

License:Open Source License

protected boolean createHierarchyResolver(IType focusType, PossibleMatch[] possibleMatches) {
    // cache focus type if not a possible match
    char[][] compoundName = CharOperation.splitOn('.', focusType.getFullyQualifiedName().toCharArray());
    boolean isPossibleMatch = false;
    for (int i = 0, length = possibleMatches.length; i < length; i++) {
        if (CharOperation.equals(possibleMatches[i].compoundName, compoundName)) {
            isPossibleMatch = true;//  www. jav  a 2  s. co  m
            break;
        }
    }
    if (!isPossibleMatch) {
        if (focusType.isBinary()) {
            try {
                cacheBinaryType(focusType, null);
            } catch (JavaModelException e) {
                return false;
            }
        } else {
            // cache all types in the focus' compilation unit (even secondary types)
            accept((ICompilationUnit) focusType.getCompilationUnit(), null /*TODO no access restriction*/);
        }
    }

    // resolve focus type
    this.hierarchyResolver = new HierarchyResolver(this.lookupEnvironment,
            null/*hierarchy is not going to be computed*/);
    ReferenceBinding binding = this.hierarchyResolver.setFocusType(compoundName);
    return binding != null && binding.isValidBinding() && (binding.tagBits & TagBits.HierarchyHasProblems) == 0;
}