Example usage for org.eclipse.jdt.core.dom MarkerAnnotation getTypeName

List of usage examples for org.eclipse.jdt.core.dom MarkerAnnotation getTypeName

Introduction

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

Prototype

public Name getTypeName() 

Source Link

Document

Returns the annotation type name of this annotation.

Usage

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

License:Open Source License

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

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(MarkerAnnotation node) {
    this.buffer.append("@");//$NON-NLS-1$
    node.getTypeName().accept(this);
    return false;
}

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

License:Apache License

@Override
public boolean visit(MarkerAnnotation node) {
    sb.print('@');
    node.getTypeName().accept(this);
    return false;
}

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

License:Apache License

/** Visitor method for {@link MarkerAnnotation}s. */
@Override/*from ww w.  j a va  2 s.c o  m*/
public boolean visit(MarkerAnnotation node) {
    sync(node);
    builder.open(ZERO);
    token("@");
    node.getTypeName().accept(this);
    builder.close();
    return false;
}

From source file:com.halware.nakedide.eclipse.ext.annot.ast.AbstractAnnotationEvaluatorOrModifier.java

License:Open Source License

private void updateSingleMemberAnnotation(ICompilationUnit compilationUnit, BodyDeclaration declaration,
        Object value) throws JavaModelException, MalformedTreeException, BadLocationException {

    SingleMemberAnnotation singleMemberAnnotation = annotation(declaration, SingleMemberAnnotation.class);
    if (singleMemberAnnotation != null) {
        AST ast = singleMemberAnnotation.getAST();
        if (value != QualifiedNameValue.DEFAULT_VALUE) {
            Expression replacement = value != null ? AstUtils.createExpression(ast, value) : null;

            AstUtils.rewriteReplace(compilationUnit, singleMemberAnnotation.getValue(), replacement);
            return;
        } else {/*w w w  .  j  a v a2  s. c  om*/
            MarkerAnnotation replacementAnnotation = ast.newMarkerAnnotation();
            replacementAnnotation
                    .setTypeName(ast.newName(singleMemberAnnotation.getTypeName().getFullyQualifiedName()));
            AstUtils.rewriteReplace(compilationUnit, singleMemberAnnotation, replacementAnnotation);
            return;
        }
    }
    MarkerAnnotation markerAnnotation = annotation(declaration, MarkerAnnotation.class);
    if (markerAnnotation != null) {
        AST ast = markerAnnotation.getAST();
        if (value != QualifiedNameValue.DEFAULT_VALUE) {
            SingleMemberAnnotation replacementAnnotation = ast.newSingleMemberAnnotation();
            replacementAnnotation
                    .setTypeName(ast.newName(markerAnnotation.getTypeName().getFullyQualifiedName()));
            Expression memberValueExpression = value != null ? AstUtils.createExpression(ast, value) : null;
            replacementAnnotation.setValue(memberValueExpression);
            AstUtils.rewriteReplace(compilationUnit, markerAnnotation, replacementAnnotation);
        } else {
            // nothing to do
        }
    }

}

From source file:edu.uci.ics.sourcerer.extractor.ast.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes://from  ww  w. j av  a2s  .  com
 *<ul>
 *  <li>For any marker annotation use:
 *  <ul>
 *    <li>Annotated by relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(MarkerAnnotation node) {
    // Get the fqn
    String fqn = null;
    IAnnotationBinding binding = node.resolveAnnotationBinding();
    if (binding == null) {
        fqn = getUnknownFqn(node.getTypeName().getFullyQualifiedName());
    } else {
        ITypeBinding typeBinding = binding.getAnnotationType();
        if (typeBinding == null) {
            fqn = getUnknownFqn(binding.getName());
        } else {
            fqn = getTypeFqn(typeBinding);
        }
    }

    // Write the annotates relation
    relationWriter.writeAnnotatedBy(fqnStack.getFqn(), fqn, getLocation(node));

    return true;
}

From source file:edu.uci.ics.sourcerer.tools.java.extractor.eclipse.ReferenceExtractorVisitor.java

License:Open Source License

/**
 * This method writes:// w w  w  . j a  v  a  2s  . c  om
 *<ul>
 *  <li>For any marker annotation use:
 *  <ul>
 *    <li>Annotated by relation to <code>IRelationWriter</code>.</li>
 *  </ul></li>
 *</ul>
 */
@Override
public boolean visit(MarkerAnnotation node) {
    // Get the fqn
    String fqn = null;
    IAnnotationBinding binding = node.resolveAnnotationBinding();
    if (binding == null) {
        fqn = createUnknownFqn(node.getTypeName().getFullyQualifiedName());
    } else {
        ITypeBinding typeBinding = binding.getAnnotationType();
        if (typeBinding == null) {
            fqn = createUnknownFqn(binding.getName());
        } else {
            fqn = getTypeFqn(typeBinding);
        }
    }

    // Write the annotates relation
    relationWriter.writeRelation(Relation.ANNOTATED_BY, fqnStack.getFqn(), fqn, createLocation(node));

    return true;
}

From source file:egovframework.mgt.fit.library.parser.visitor.AnnotationParsingVisitor.java

License:Apache License

/**
 *  ?  ?./*from  w ww .  j a  v a2  s  . c o m*/
 * @return   
 */
@Override
public boolean visit(MarkerAnnotation node) {
    if (node.getNodeType() == ASTNode.MARKER_ANNOTATION) {
        if (node.getParent().getNodeType() == parentType) {
            AnnotationUnit au = new AnnotationUnit();
            au.setName(node.getTypeName().getFullyQualifiedName());

            unit.addAnnotation(au);
        }
    }

    return super.visit(node);
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.MarkerAnnotation node) {
    Annotation element = (Annotation) this.binding.get(node);
    this.initializeNode(element, node);
    if (this.binding.get(node.getTypeName()) != null) {
        element.setType((NamedElementRef) this.binding.get(node.getTypeName()));
    }/*from   www  .  ja  v  a  2s .  com*/
}

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

License:Open Source License

public boolean visit(MarkerAnnotation node) {
    IValue typeName = values.string(node.getTypeName().getFullyQualifiedName());
    ownValue = constructRascalNode(node, typeName);
    return false;
}