List of usage examples for org.eclipse.jdt.core.dom NormalAnnotation resolveAnnotationBinding
public IAnnotationBinding resolveAnnotationBinding()
From source file:com.codenvy.ide.ext.java.server.internal.core.util.DOMFinder.java
License:Open Source License
public boolean visit(NormalAnnotation node) { if (found(node, node) && this.resolveBinding) this.foundBinding = node.resolveAnnotationBinding(); return true;/*from www . j a v a 2s.c om*/ }
From source file:com.google.devtools.j2objc.types.BindingMapBuilder.java
License:Open Source License
@Override public boolean visit(NormalAnnotation node) { put(node, node.resolveAnnotationBinding()); return true; }
From source file:com.google.gwt.eclipse.core.validators.rpc.ValidationSuppressionVisitor.java
License:Open Source License
@Override public boolean visit(NormalAnnotation node) { IAnnotationBinding resolvedAnnotationBinding = node.resolveAnnotationBinding(); processAnnotationBinding(resolvedAnnotationBinding); // Don't visit this node's children; they don't impact the result return false; }
From source file:com.tsc9526.monalisa.plugin.eclipse.generator.SelectMethod.java
License:Open Source License
public void calculateResultClassName() { if (selectAnnotation.isNormalAnnotation()) { NormalAnnotation n = (NormalAnnotation) selectAnnotation; for (IMemberValuePairBinding mvp : n.resolveAnnotationBinding().getAllMemberValuePairs()) { String name = mvp.getName(); if (name.equals("name")) { forceRenameResultClass = true; resultClassName = mvp.getValue().toString().trim(); int x = resultClassName.lastIndexOf("."); if (x > 0) { resultClassPackage = resultClassName.substring(0, x); resultClassName = resultClassName.substring(x + 1); }/*from w ww.j av a 2s.com*/ } else if (name.equals("build")) { buildCode = mvp.getValue().toString(); } } } if (resultClassPackage == null || resultClassPackage.length() == 0) { resultClassPackage = unit.getSubPackageName(); } if (resultClassName == null || resultClassName.length() == 0) { resultClassName = "Result" + firstUpper(md.getName().toString()); } }
From source file:edu.uci.ics.sourcerer.extractor.ast.ReferenceExtractorVisitor.java
License:Open Source License
/** * This method writes:/* w ww . j a v a2 s . c o m*/ *<ul> * <li>For any normal annotation use: * <ul> * <li>Annotated by relation to <code>IRelationWriter</code>.</li> * </ul></li> *</ul> */ @Override public boolean visit(NormalAnnotation 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:/*from w ww. j av a 2 s . c om*/ *<ul> * <li>For any normal annotation use: * <ul> * <li>Annotated by relation to <code>IRelationWriter</code>.</li> * </ul></li> *</ul> */ @Override public boolean visit(NormalAnnotation 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:org.autorefactor.refactoring.rules.AnnotationRefactoring.java
License:Open Source License
@Override public boolean visit(NormalAnnotation node) { final Refactorings r = this.ctx.getRefactorings(); final ASTBuilder b = this.ctx.getASTBuilder(); final List<MemberValuePair> values = values(node); if (values.isEmpty()) { r.replace(node, b.markerAnnotation(b.move(node.getTypeName()))); return DO_NOT_VISIT_SUBTREE; } else if (values.size() == 1) { MemberValuePair pair = values.get(0); if ("value".equals(pair.getName().getIdentifier())) { r.replace(node, b.singleValueAnnotation(b.move(node.getTypeName()), b.move(pair.getValue()))); return DO_NOT_VISIT_SUBTREE; }/* ww w. jav a 2s .c o m*/ } boolean result = VISIT_SUBTREE; Map<String, IMethodBinding> elements = toElementsMap(node.resolveAnnotationBinding()); for (MemberValuePair pair : values) { IMethodBinding elementBinding = elements.get(pair.getName().getIdentifier()); if (equal(elementBinding.getReturnType(), pair.getValue(), elementBinding.getDefaultValue())) { r.remove(pair); result = DO_NOT_VISIT_SUBTREE; } else if (pair.getValue().getNodeType() == ARRAY_INITIALIZER) { ArrayInitializer arrayInit = (ArrayInitializer) pair.getValue(); List<Expression> exprs = expressions(arrayInit); if (exprs.size() == 1) { r.replace(arrayInit, b.move(exprs.get(0))); result = DO_NOT_VISIT_SUBTREE; } } } return result; }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
public NormalAnnotation convert(org.eclipse.jdt.internal.compiler.ast.NormalAnnotation annotation) { final NormalAnnotation normalAnnotation = new NormalAnnotation(this.ast); setTypeNameForAnnotation(annotation, normalAnnotation); int start = annotation.sourceStart; int end = annotation.declarationSourceEnd; org.eclipse.jdt.internal.compiler.ast.MemberValuePair[] memberValuePairs = annotation.memberValuePairs; if (memberValuePairs != null) { for (int i = 0, max = memberValuePairs.length; i < max; i++) { MemberValuePair memberValuePair = convert(memberValuePairs[i]); int memberValuePairEnd = memberValuePair.getStartPosition() + memberValuePair.getLength() - 1; if (end == memberValuePairEnd) { normalAnnotation.setFlags(normalAnnotation.getFlags() | ASTNode.RECOVERED); }//w ww . j a v a 2s . c o m normalAnnotation.values().add(memberValuePair); } } normalAnnotation.setSourceRange(start, end - start + 1); if (this.resolveBindings) { recordNodes(normalAnnotation, annotation); normalAnnotation.resolveAnnotationBinding(); } return normalAnnotation; }
From source file:org.jboss.tools.seam.internal.core.scanner.java.PackageInfoRequestor.java
License:Open Source License
public boolean visit(NormalAnnotation node) { IAnnotationBinding b = node.resolveAnnotationBinding(); if (b != null) { String type = b.getAnnotationType().getQualifiedName(); if (NAMESPACE_ANNOTATION_TYPE.equals(type)) { ValueInfo value = ValueInfo.getValueInfo(node, "value"); ValueInfo prefix = ValueInfo.getValueInfo(node, "prefix"); SeamNamespace ns = new SeamNamespace(); if (value != null) { ns.setURI(value.getValue()); }/*from ww w. j av a 2 s .c om*/ if (prefix != null) { // } namespaces.add(ns); } else if (IMPORT_ANNOTATION_TYPE.equals(type)) { List<String> is = ComponentBuilder.getArrayValue(node); for (String s : is) { SeamImport i = new SeamImport(); i.setSeamPackage(s); imports.add(i); } } } return true; }