Example usage for org.eclipse.jdt.core.dom WildcardType BOUND_PROPERTY

List of usage examples for org.eclipse.jdt.core.dom WildcardType BOUND_PROPERTY

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom WildcardType BOUND_PROPERTY.

Prototype

ChildPropertyDescriptor BOUND_PROPERTY

To view the source code for org.eclipse.jdt.core.dom WildcardType BOUND_PROPERTY.

Click Source Link

Document

The "bound" structural property of this node type (child type: Type ).

Usage

From source file:org.eclipse.scout.sdk.saml.importer.internal.jdt.imports.OrganizeImportsHelper.java

License:Open Source License

private static int internalGetPossibleTypeKinds(ASTNode node) {
    int kind = ALL_TYPES;

    int mask = ALL_TYPES | VOIDTYPE;

    ASTNode parent = node.getParent();// w  ww .jav  a2  s  .  co  m
    while (parent instanceof QualifiedName) {
        if (node.getLocationInParent() == QualifiedName.QUALIFIER_PROPERTY) {
            return REF_TYPES;
        }
        node = parent;
        parent = parent.getParent();
        mask = REF_TYPES;
    }
    while (parent instanceof Type) {
        if (parent instanceof QualifiedType) {
            if (node.getLocationInParent() == QualifiedType.QUALIFIER_PROPERTY) {
                return mask & (REF_TYPES);
            }
            mask &= REF_TYPES;
        } else if (parent instanceof ParameterizedType) {
            if (node.getLocationInParent() == ParameterizedType.TYPE_ARGUMENTS_PROPERTY) {
                return mask & REF_TYPES_AND_VAR;
            }
            mask &= CLASSES | INTERFACES;
        } else if (parent instanceof WildcardType) {
            if (node.getLocationInParent() == WildcardType.BOUND_PROPERTY) {
                return mask & REF_TYPES_AND_VAR;
            }
        }
        node = parent;
        parent = parent.getParent();
    }

    switch (parent.getNodeType()) {
    case ASTNode.TYPE_DECLARATION:
        if (node.getLocationInParent() == TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY) {
            kind = INTERFACES;
        } else if (node.getLocationInParent() == TypeDeclaration.SUPERCLASS_TYPE_PROPERTY) {
            kind = CLASSES;
        }
        break;
    case ASTNode.ENUM_DECLARATION:
        kind = INTERFACES;
        break;
    case ASTNode.METHOD_DECLARATION:
        if (node.getLocationInParent() == MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY) {
            kind = CLASSES;
        } else if (node.getLocationInParent() == MethodDeclaration.RETURN_TYPE2_PROPERTY) {
            kind = ALL_TYPES | VOIDTYPE;
        }
        break;
    case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
        kind = PRIMITIVETYPES | ANNOTATIONS | ENUMS;
        break;
    case ASTNode.INSTANCEOF_EXPRESSION:
        kind = REF_TYPES;
        break;
    case ASTNode.THROW_STATEMENT:
        kind = CLASSES;
        break;
    case ASTNode.CLASS_INSTANCE_CREATION:
        if (((ClassInstanceCreation) parent).getAnonymousClassDeclaration() == null) {
            kind = CLASSES;
        } else {
            kind = CLASSES | INTERFACES;
        }
        break;
    case ASTNode.SINGLE_VARIABLE_DECLARATION:
        int superParent = parent.getParent().getNodeType();
        if (superParent == ASTNode.CATCH_CLAUSE) {
            kind = CLASSES;
        }
        break;
    case ASTNode.TAG_ELEMENT:
        kind = REF_TYPES;
        break;
    case ASTNode.MARKER_ANNOTATION:
    case ASTNode.SINGLE_MEMBER_ANNOTATION:
    case ASTNode.NORMAL_ANNOTATION:
        kind = ANNOTATIONS;
        break;
    case ASTNode.TYPE_PARAMETER:
        if (((TypeParameter) parent).typeBounds().indexOf(node) > 0) {
            kind = INTERFACES;
        } else {
            kind = REF_TYPES_AND_VAR;
        }
        break;
    case ASTNode.TYPE_LITERAL:
        kind = REF_TYPES;
        break;
    default:
    }
    return kind & mask;
}