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

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

Introduction

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

Prototype

public SimpleName getName() 

Source Link

Document

Returns the name of the field accessed in this field access expression.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(FieldAccess node) {
    node.getExpression().accept(this);
    this.fBuffer.append(".");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(FieldAccess node) {
    boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder();
    //      b.setPosition(pos.build());
    b.setKind(boa.types.Ast.Expression.ExpressionKind.VARACCESS);
    node.getExpression().accept(this);
    b.addExpressions(expressions.pop());
    b.setVariable(node.getName().getFullyQualifiedName());
    expressions.push(b.build());/*from   w w w.  j  av a2  s .  c o m*/
    return false;
}

From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java

License:Open Source License

@Override
public boolean visit(final FieldAccess pNode) {
    final IVariableBinding lBinding = (IVariableBinding) pNode.getName().resolveBinding();

    if (lBinding == null) {
        ASTCrawler.log("Null binding 1 for " + pNode.toString());
        return false;
    }// w  w w .j a  va  2  s .c om

    this.addAccessRelation(lBinding);
    final Assignment assignment = ASTCrawler.getAssignment(pNode);
    if (assignment != null) {
        this.addSetsRelation(lBinding);

        if (!(assignment.getOperator() == Assignment.Operator.ASSIGN))
            this.addGetsRelation(lBinding);
    } else
        this.addGetsRelation(lBinding);
    return true;
}

From source file:changetypes.ASTVisitorAtomicChange.java

License:Open Source License

public boolean visit(FieldAccess node) {
    IVariableBinding ivb = node.resolveFieldBinding();
    if (this.mtbStack.isEmpty()) {
        return true;
    }/*  w  w w . j a  v a2s. co  m*/
    IMethodBinding mtb = (IMethodBinding) this.mtbStack.peek();
    try {
        if ((!node.getName().toString().equals("length")) || (ivb.getDeclaringClass() != null)) {
            this.facts.add(
                    Fact.makeAccessesFact(getQualifiedName(node.resolveFieldBinding()), getQualifiedName(mtb)));
        }
    } catch (Exception localException1) {
        System.err.println("Cannot resolve field access \"" + node.getName().toString() + "\"");
    }
    try {
        String simpleMethodName = getSimpleName(mtb);
        if (simpleMethodName.toLowerCase().startsWith("get")) {
            this.facts.add(
                    Fact.makeGetterFact(getQualifiedName(mtb), getQualifiedName(node.resolveFieldBinding())));
        } else if (simpleMethodName.toLowerCase().startsWith("set")) {
            this.facts.add(
                    Fact.makeSetterFact(getQualifiedName(mtb), getQualifiedName(node.resolveFieldBinding())));
        }
    } catch (Exception localException2) {
        System.err.println("Cannot resolve bindings for exceptions");
    }
    return true;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(FieldAccess node) {
    node.getExpression().accept(this);
    this.buffer.append(".");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}

From source file:com.google.dart.java2dart.SyntaxTranslator.java

License:Open Source License

@Override
public boolean visit(org.eclipse.jdt.core.dom.FieldAccess node) {
    PropertyAccess result = propertyAccess(translateExpression(node.getExpression()),
            (SimpleIdentifier) translate(node.getName()));
    context.putNodeBinding(result, node.resolveFieldBinding());
    return done(result);
}

From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java

License:Open Source License

@Override
public boolean visit(FieldAccess node) {
    if (maybePrintArrayLength(node.getName().getIdentifier(), node.getExpression())) {
        return false;
    }/*from ww  w  .j a va 2s  .co  m*/

    Expression expr = node.getExpression();
    if (expr instanceof ArrayAccess) {
        // Since arrays are untyped in Obj-C, add a cast of its element type.
        ArrayAccess access = (ArrayAccess) expr;
        ITypeBinding elementType = Types.getTypeBinding(access.getArray()).getElementType();
        buffer.append(String.format("((%s) ", NameTable.javaRefToCpp(elementType)));
        expr.accept(this);
        buffer.append(')');
    } else {
        printNilCheck(expr, true);
    }
    if (Options.inlineFieldAccess() && isProperty(node.getName())) {
        buffer.append("->");
    } else {
        buffer.append('.');
    }
    node.getName().accept(this);
    return false;
}

From source file:com.google.devtools.j2cpp.types.ImplementationImportCollector.java

License:Open Source License

@Override
public boolean visit(FieldAccess node) {
    addReference(Types.getTypeBinding(node.getName()));
    return true;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(FieldAccess node) {
    node.getExpression().accept(this);
    sb.print('.');
    node.getName().accept(this);
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

private void dotExpressionUpToArgs(Expression expression, Optional<BreakTag> tyargTag) {
    switch (expression.getNodeType()) {
    case ASTNode.FIELD_ACCESS:
        FieldAccess fieldAccess = (FieldAccess) expression;
        visit(fieldAccess.getName());
        break;//from   w  ww  .  ja va2  s .co m
    case ASTNode.METHOD_INVOCATION:
        MethodInvocation methodInvocation = (MethodInvocation) expression;
        if (!methodInvocation.typeArguments().isEmpty()) {
            builder.open(plusFour);
            addTypeArguments(methodInvocation.typeArguments(), ZERO);
            // TODO(jdd): Should indent the name -4.
            builder.breakOp(Doc.FillMode.UNIFIED, "", ZERO, tyargTag);
            builder.close();
        }
        visit(methodInvocation.getName());
        break;
    case ASTNode.QUALIFIED_NAME:
        visit(((QualifiedName) expression).getName());
        break;
    case ASTNode.SIMPLE_NAME:
        visit(((SimpleName) expression));
        break;
    default:
        expression.accept(this);
    }
}