List of usage examples for org.eclipse.jdt.core.dom FieldAccess getLocationInParent
public final StructuralPropertyDescriptor getLocationInParent()
null
if this is a root node. From source file:org.eclipse.wb.internal.core.utils.ast.AstNodeUtils.java
License:Open Source License
/** * @param node//from w w w .ja v a 2 s. c om * 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; }