Example usage for org.eclipse.jdt.core.dom NameQualifiedType NAME_PROPERTY

List of usage examples for org.eclipse.jdt.core.dom NameQualifiedType NAME_PROPERTY

Introduction

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

Prototype

ChildPropertyDescriptor NAME_PROPERTY

To view the source code for org.eclipse.jdt.core.dom NameQualifiedType NAME_PROPERTY.

Click Source Link

Document

The "name" structural property of this node type (child type: SimpleName ).

Usage

From source file:org.eclipse.che.jdt.dom.ASTNodes.java

License:Open Source License

/**
 * For {@link Name} or {@link org.eclipse.jdt.core.dom.Type} nodes, returns the topmost {@link org.eclipse.jdt.core.dom.Type} node
 * that shares the same type binding as the given node.
 *
 * @param node//  ww w.  ja  v a2s.c o m
 *         an ASTNode
 * @return the normalized {@link org.eclipse.jdt.core.dom.Type} node or the original node
 */
public static ASTNode getNormalizedNode(ASTNode node) {
    ASTNode current = node;
    // normalize name
    if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
        current = current.getParent();
    }
    // normalize type
    if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())
            || SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())
            || NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) {
        current = current.getParent();
    }
    // normalize parameterized types
    if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
        current = current.getParent();
    }
    return current;
}