Example usage for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding outermostEnclosingType

List of usage examples for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding outermostEnclosingType

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup SourceTypeBinding outermostEnclosingType.

Prototype

public final ReferenceBinding outermostEnclosingType() 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.control.StateHelper.java

License:Open Source License

public static boolean isDefinitelyReadyToProcess(ReferenceBinding type, ReferenceBinding requestingSite,
        int state) {

    if (!(type instanceof SourceTypeBinding))
        return false; // most treatment not needed for binary types
    SourceTypeBinding sourceType = (SourceTypeBinding) type;

    if (TypeBinding.equalsEquals(sourceType.outermostEnclosingType().erasure(),
            requestingSite.outermostEnclosingType().erasure())
            || CharOperation.equals(type.getFileName(), requestingSite.getFileName()))
        return false; // could infinitely recurse to the same inclosing of kind

    if (!StateHelper.isReadyToProcess(sourceType, state))
        return false;

    try {/*from  w  w w .j ava 2  s .  c  o m*/
        StateMemento unitState = sourceType.scope.compilationUnitScope().referenceContext.state;
        if (unitState.isReadyToProcess(state))
            return true; // GOAL
    } catch (NullPointerException npe) {
        // be shy, if any enclosing thing was missing don't risk infinite recursion.
    }

    return false;
}