Example usage for org.eclipse.jdt.internal.compiler.env NameEnvironmentAnswer isBinaryType

List of usage examples for org.eclipse.jdt.internal.compiler.env NameEnvironmentAnswer isBinaryType

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env NameEnvironmentAnswer isBinaryType.

Prototype

public boolean isBinaryType() 

Source Link

Document

Answer whether the receiver contains the resolved binary form of the type.

Usage

From source file:com.codenvy.ide.ext.java.SearchableEnvironmentTest.java

License:Open Source License

private String processAnswer(NameEnvironmentAnswer answer, IJavaProject project, INameEnvironment environment)
        throws JavaModelException {
    if (answer == null)
        return null;
    if (answer.isBinaryType()) {
        IBinaryType binaryType = answer.getBinaryType();
        return BinaryTypeConvector.toJsonBinaryType(binaryType);
    } else if (answer.isCompilationUnit()) {
        ICompilationUnit compilationUnit = answer.getCompilationUnit();
        return getSourceTypeInfo(project, environment, compilationUnit);
    } else if (answer.isSourceType()) {
        ISourceType[] sourceTypes = answer.getSourceTypes();
        if (sourceTypes.length == 1) {
            ISourceType sourceType = sourceTypes[0];
            SourceTypeElementInfo elementInfo = (SourceTypeElementInfo) sourceType;
            IType handle = elementInfo.getHandle();
            org.eclipse.jdt.core.ICompilationUnit unit = handle.getCompilationUnit();
            return getSourceTypeInfo(project, environment, (ICompilationUnit) unit);
        }/*from  www  .  j a  va2 s  .c  om*/
    }
    return null;
}