Example usage for org.eclipse.jdt.core.dom MemberValuePair accept

List of usage examples for org.eclipse.jdt.core.dom MemberValuePair accept

Introduction

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

Prototype

public final void accept(ASTVisitor visitor) 

Source Link

Document

Accepts the given visitor on a visit of the current node.

Usage

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

License:Open Source License

@Override
public boolean visit(NormalAnnotation node) {
    this.fBuffer.append("@");//$NON-NLS-1$
    node.getTypeName().accept(this);
    this.fBuffer.append("(");//$NON-NLS-1$
    for (Iterator<MemberValuePair> it = node.values().iterator(); it.hasNext();) {
        MemberValuePair p = it.next();
        p.accept(this);
        if (it.hasNext()) {
            this.fBuffer.append(",");//$NON-NLS-1$
        }//from www . j  a v a  2s .c o m
    }
    this.fBuffer.append(")");//$NON-NLS-1$
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(NormalAnnotation node) {
    this.buffer.append("@");//$NON-NLS-1$
    node.getTypeName().accept(this);
    this.buffer.append("(");//$NON-NLS-1$
    for (Iterator it = node.values().iterator(); it.hasNext();) {
        MemberValuePair p = (MemberValuePair) it.next();
        p.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }//ww  w .  j  a v a 2 s.  c  om
    }
    this.buffer.append(")");//$NON-NLS-1$
    return false;
}

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

License:Apache License

@Override
public boolean visit(NormalAnnotation node) {
    sb.print("@");
    node.getTypeName().accept(this);
    sb.print("(");
    for (Iterator<MemberValuePair> it = node.getValues().iterator(); it.hasNext();) {
        MemberValuePair p = (MemberValuePair) it.next();
        p.accept(this);
        if (it.hasNext()) {
            sb.print(',');
        }/*from ww w.j av  a2  s.c o m*/
    }
    sb.print(")");
    return false;
}

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

License:Apache License

/** Visitor method for {@link NormalAnnotation}s. */
@Override// w w w.j  a v a2s .  c o  m
public boolean visit(NormalAnnotation node) {
    sync(node);
    builder.open(ZERO);
    token("@");
    node.getTypeName().accept(this);
    builder.open(plusTwo, MAX_LINES_FOR_ANNOTATION_ELEMENT_VALUE_PAIRS);
    token("(");
    builder.breakOp();
    boolean first = true;

    // Format the member value pairs one-per-line if any of them are
    // initialized with arrays.
    boolean hasArrayInitializer = false;
    for (MemberValuePair value : (List<MemberValuePair>) node.values()) {
        if (value.getValue().getNodeType() == ASTNode.ARRAY_INITIALIZER) {
            hasArrayInitializer = true;
            break;
        }
    }

    for (MemberValuePair value : (List<MemberValuePair>) node.values()) {
        if (!first) {
            token(",");
            if (hasArrayInitializer) {
                builder.forcedBreak();
            } else {
                builder.breakOp(" ");
            }
        }
        value.accept(this);
        first = false;
    }
    builder.breakOp(FillMode.UNIFIED, "", minusTwo, Optional.<BreakTag>absent());
    token(")");
    builder.close();
    builder.close();
    return false;
}

From source file:ptolemy.backtrack.eclipse.ast.ASTFormatter.java

License:Open Source License

/** Visit an ast node, and return whether its children should be further
 *  visited.//from  www  .j a va 2s. c  om
 *
 *  @param node The AST node.
 *  @return Whether its children should be further visited.
 */
public boolean visit(NormalAnnotation node) {
    _output("@");
    node.getTypeName().accept(this);
    _output("(");

    for (Iterator it = node.values().iterator(); it.hasNext();) {
        MemberValuePair p = (MemberValuePair) it.next();
        p.accept(this);

        if (it.hasNext()) {
            _output(", ");
        }
    }

    _output(")");
    return false;
}