Example usage for org.eclipse.jdt.core.dom PackageDeclaration getAST

List of usage examples for org.eclipse.jdt.core.dom PackageDeclaration getAST

Introduction

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

Prototype

public final AST getAST() 

Source Link

Document

Returns this node's AST.

Usage

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

License:Open Source License

@Override
public boolean visit(PackageDeclaration node) {
    if (node.getAST().apiLevel() >= JLS3) {
        if (node.getJavadoc() != null) {
            node.getJavadoc().accept(this);
        }//from w w w.  ja  v  a 2s . c  o m
        for (Iterator<Annotation> it = node.annotations().iterator(); it.hasNext();) {
            Annotation p = it.next();
            p.accept(this);
            this.fBuffer.append(" ");//$NON-NLS-1$
        }
    }
    this.fBuffer.append("package ");//$NON-NLS-1$
    node.getName().accept(this);
    this.fBuffer.append(";");//$NON-NLS-1$
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(PackageDeclaration node) {
    if (node.getAST().apiLevel() >= AST.JLS3) {
        if (node.getJavadoc() != null) {
            node.getJavadoc().accept(this);
        }//from   w ww. j a v a 2s.c om
        for (Iterator it = node.annotations().iterator(); it.hasNext();) {
            Annotation p = (Annotation) it.next();
            p.accept(this);
            this.buffer.append(" ");//$NON-NLS-1$
        }
    }
    printIndent();
    this.buffer.append("package ");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append(";\n");//$NON-NLS-1$
    return false;
}

From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(PackageDeclaration node) {
    IValue name = values.string(node.getName().getFullyQualifiedName());

    IValueList annotations = new IValueList(values);
    if (node.getAST().apiLevel() >= AST.JLS3) {
        for (Iterator it = node.annotations().iterator(); it.hasNext();) {
            Annotation p = (Annotation) it.next();
            annotations.add(visitChild(p));
        }/*  w ww  .ja  v  a 2  s .c  o m*/
    }

    ownValue = constructRascalNode(node, name, annotations.asList());
    return false;
}

From source file:org.codemucker.jmutate.ast.JAstFlattener.java

License:Open Source License

public boolean visit(PackageDeclaration node) {
    if (node.getAST().apiLevel() >= JLS3) {
        if (node.getJavadoc() != null) {
            node.getJavadoc().accept(this);
        }/*ww w .  j  a  v  a 2 s.  c  o m*/
        for (Iterator it = node.annotations().iterator(); it.hasNext();) {
            Annotation p = (Annotation) it.next();
            p.accept(this);
            this.buffer.append(" ");//$NON-NLS-1$
        }
    }
    printIndent();
    this.buffer.append("package ");//$NON-NLS-1$
    node.getName().accept(this);
    this.buffer.append(";\n");//$NON-NLS-1$
    return false;
}

From source file:org.eclipse.emf.texo.generator.ImportReferenceCollector.java

License:Open Source License

@Override
public boolean visit(final PackageDeclaration node) {
    packageName = node.getName().getFullyQualifiedName();
    if (node.getAST().apiLevel() >= GeneratorUtils.getASTLevel()) {
        doVisitNode(node.getJavadoc());//from  w ww.j  a  va 2  s  .c o  m
        doVisitChildren(node.annotations());
    }
    return false;
}

From source file:org.eclipse.emf.texo.generator.ImportReferencesCollector.java

License:Open Source License

@Override
public boolean visit(final PackageDeclaration node) {
    if (node.getAST().apiLevel() >= AST.JLS3) {
        doVisitNode(node.getJavadoc());// w  w w  .  j  a v a  2s. co m
        doVisitChildren(node.annotations());
    }
    return false;
}

From source file:org.spoofax.interpreter.adapter.ecj.ECJFactory.java

License:LGPL

private PackageDeclaration asPackageDeclaration(IStrategoTerm term) {
    PackageDeclaration x = ((WrappedPackageDeclaration) term).getWrappee();
    return x.getParent() == null && x.getAST() == ast ? x : (PackageDeclaration) ASTNode.copySubtree(ast, x);
}

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  .ja v a  2s .c  o  m*/
 *
 *  @param node The AST node.
 *  @return Whether its children should be further visited.
 */
public boolean visit(PackageDeclaration node) {
    if (node.getAST().apiLevel() >= AST.JLS3) {
        if (node.getJavadoc() != null) {
            node.getJavadoc().accept(this);
        }

        _output(_indent);

        for (Iterator it = node.annotations().iterator(); it.hasNext();) {
            Annotation p = (Annotation) it.next();
            p.accept(this);
            _output(" ");
        }
    } else {
        _output(_indent);
    }

    _output("package ");
    node.getName().accept(this);
    _output(";\n\n");
    return false;
}