Example usage for org.eclipse.jdt.core.dom FieldAccess EXPRESSION_PROPERTY

List of usage examples for org.eclipse.jdt.core.dom FieldAccess EXPRESSION_PROPERTY

Introduction

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

Prototype

ChildPropertyDescriptor EXPRESSION_PROPERTY

To view the source code for org.eclipse.jdt.core.dom FieldAccess EXPRESSION_PROPERTY.

Click Source Link

Document

The "expression" structural property of this node type (child type: Expression ).

Usage

From source file:org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.java

License:Open Source License

/**
 * @param node/*from  ww w . ja  v a 2 s  .co m*/
 *          the {@link ASTNode} that represents should be qualifier of field.
 * 
 * @return the {@link Expression} ({@link QualifiedName} or {@link FieldAccess}) used as left side
 *         of {@link Assignment} to some field. May return <code>null</code>, if given node is not
 *         left part of {@link Assignment}.
 */
public static Expression getFieldAssignment(ASTNode node) {
    // FieldAccess = value
    if (node.getLocationInParent() == FieldAccess.EXPRESSION_PROPERTY) {
        FieldAccess fieldAccess = (FieldAccess) node.getParent();
        if (fieldAccess.getLocationInParent() == Assignment.LEFT_HAND_SIDE_PROPERTY) {
            return fieldAccess;
        }
    }
    // QualifiedName = value
    if (node.getLocationInParent() == QualifiedName.QUALIFIER_PROPERTY) {
        QualifiedName qualifiedName = (QualifiedName) node.getParent();
        if (qualifiedName.getLocationInParent() == Assignment.LEFT_HAND_SIDE_PROPERTY) {
            return qualifiedName;
        }
    }
    // not an Assignment part
    return null;
}