Java 类org.eclipse.jdt.core.dom.AnnotationTypeDeclaration 实例源码
项目:Eclipse-Postfix-Code-Completion
文件:ModifierRewrite.java
private ListRewrite evaluateListRewrite(ASTRewrite rewrite, ASTNode declNode) {
switch (declNode.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return rewrite.getListRewrite(declNode, MethodDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.FIELD_DECLARATION:
return rewrite.getListRewrite(declNode, FieldDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_EXPRESSION:
return rewrite.getListRewrite(declNode, VariableDeclarationExpression.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_STATEMENT:
return rewrite.getListRewrite(declNode, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return rewrite.getListRewrite(declNode, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, TypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_DECLARATION:
return rewrite.getListRewrite(declNode, EnumDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_CONSTANT_DECLARATION:
return rewrite.getListRewrite(declNode, EnumConstantDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY);
default:
throw new IllegalArgumentException("node has no modifiers: " + declNode.getClass().getName()); //$NON-NLS-1$
}
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:ASTFlattener.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
if (node.getJavadoc() != null) {
node.getJavadoc().accept(this);
}
printModifiers(node.modifiers());
this.fBuffer.append("@interface ");//$NON-NLS-1$
node.getName().accept(this);
this.fBuffer.append(" {");//$NON-NLS-1$
for (Iterator<BodyDeclaration> it= node.bodyDeclarations().iterator(); it.hasNext();) {
BodyDeclaration d= it.next();
d.accept(this);
}
this.fBuffer.append("}");//$NON-NLS-1$
return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:ModifierRewrite.java
private ListRewrite evaluateListRewrite(ASTRewrite rewrite, ASTNode declNode) {
switch (declNode.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return rewrite.getListRewrite(declNode, MethodDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.FIELD_DECLARATION:
return rewrite.getListRewrite(declNode, FieldDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_EXPRESSION:
return rewrite.getListRewrite(declNode, VariableDeclarationExpression.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_STATEMENT:
return rewrite.getListRewrite(declNode, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return rewrite.getListRewrite(declNode, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, TypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_DECLARATION:
return rewrite.getListRewrite(declNode, EnumDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_CONSTANT_DECLARATION:
return rewrite.getListRewrite(declNode, EnumConstantDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY);
default:
throw new IllegalArgumentException("node has no modifiers: " + declNode.getClass().getName()); //$NON-NLS-1$
}
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:NaiveASTFlattener.java
public boolean visit(AnnotationTypeDeclaration node) {
if (node.getJavadoc() != null) {
node.getJavadoc().accept(this);
}
printIndent();
printModifiers(node.modifiers());
this.buffer.append("@interface ");//$NON-NLS-1$
node.getName().accept(this);
this.buffer.append(" {");//$NON-NLS-1$
for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
BodyDeclaration d = (BodyDeclaration) it.next();
d.accept(this);
}
this.buffer.append("}\n");//$NON-NLS-1$
return false;
}
项目:repositoryminer
文件:FileVisitor.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
AbstractAnnotation absAnnotation = new AbstractAnnotation();
if (packageName != null) {
absAnnotation.setName(packageName+'.'+node.getName().getFullyQualifiedName());
} else {
absAnnotation.setName(node.getName().getFullyQualifiedName());
}
TypeVisitor visitor = new TypeVisitor();
node.accept(visitor);
absAnnotation.setMethods(visitor.getMethods());
absAnnotation.setFields(visitor.getFields());
absAnnotation.setStartPosition(node.getStartPosition());
absAnnotation.setEndPosition(node.getStartPosition() + node.getLength() - 1);
absAnnotation.setMembers(visitor.getAnnotationMembers());
types.add(absAnnotation);
return true;
}
项目:eclipse.jdt.ls
文件:SnippetFinder.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
if (++fTypes > 1) {
return false;
}
return super.visit(node);
}
项目:eclipse.jdt.ls
文件:FlowAnalyzer.java
@Override
public void endVisit(AnnotationTypeDeclaration node) {
if (skipNode(node)) {
return;
}
GenericSequentialFlowInfo info = processSequential(node, node.bodyDeclarations());
info.setNoReturn();
}
项目:eclipse.jdt.ls
文件:AbstractExceptionAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
// Don't dive into a local type.
if (node.isLocalTypeDeclaration()) {
return false;
}
return true;
}
项目:eclipse.jdt.ls
文件:NewAnnotationMemberProposal.java
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot= ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl= astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl= null;
if (typeDecl != null) {
newTypeDecl= typeDecl;
} else {
astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl= astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
AnnotationTypeDeclaration newAnnotationTypeDecl= (AnnotationTypeDeclaration) newTypeDecl;
ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub= getStub(rewrite, newAnnotationTypeDecl);
List<BodyDeclaration> members= newAnnotationTypeDecl.bodyDeclarations();
int insertIndex= members.size();
ListRewrite listRewriter= rewrite.getListRewrite(newAnnotationTypeDecl, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
项目:eclipse.jdt.ls
文件:NewAnnotationMemberProposal.java
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls= targetTypeDecl.bodyDeclarations();
for (int i= 0; i < methodDecls.size(); i++) {
Object curr= methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
项目:che
文件:ModifierRewrite.java
private ListRewrite evaluateListRewrite(ASTRewrite rewrite, ASTNode declNode) {
switch (declNode.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return rewrite.getListRewrite(declNode, MethodDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.FIELD_DECLARATION:
return rewrite.getListRewrite(declNode, FieldDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_EXPRESSION:
return rewrite.getListRewrite(declNode, VariableDeclarationExpression.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_STATEMENT:
return rewrite.getListRewrite(declNode, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return rewrite.getListRewrite(declNode, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, TypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_DECLARATION:
return rewrite.getListRewrite(declNode, EnumDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_CONSTANT_DECLARATION:
return rewrite.getListRewrite(declNode, EnumConstantDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
return rewrite.getListRewrite(
declNode, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY);
default:
throw new IllegalArgumentException(
"node has no modifiers: " + declNode.getClass().getName()); // $NON-NLS-1$
}
}
项目:che
文件:NewAnnotationMemberProposal.java
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot = ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl = astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl = null;
if (typeDecl != null) {
newTypeDecl = typeDecl;
} else {
astRoot = ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl = astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
AnnotationTypeDeclaration newAnnotationTypeDecl = (AnnotationTypeDeclaration) newTypeDecl;
ASTRewrite rewrite = ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub = getStub(rewrite, newAnnotationTypeDecl);
List<BodyDeclaration> members = newAnnotationTypeDecl.bodyDeclarations();
int insertIndex = members.size();
ListRewrite listRewriter =
rewrite.getListRewrite(
newAnnotationTypeDecl, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
项目:che
文件:NewAnnotationMemberProposal.java
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls = targetTypeDecl.bodyDeclarations();
for (int i = 0; i < methodDecls.size(); i++) {
Object curr = methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
项目:jdt2famix
文件:AstVisitor.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
ITypeBinding binding = node.resolveBinding();
if (binding == null) {
logNullBinding("annotation type declaration", node.getName(), ((CompilationUnit) node.getRoot()).getLineNumber(node.getStartPosition()));
return false;
}
Type type = importer.ensureTypeFromTypeBinding(binding);
type.setIsStub(false);
importer.createSourceAnchor(type, node, (CompilationUnit) node.getRoot());
importer.pushOnContainerStack(type);
importer.ensureCommentFromBodyDeclaration(type, node);
return true;
}
项目:Eclipse-Postfix-Code-Completion
文件:FlowAnalyzer.java
@Override
public void endVisit(AnnotationTypeDeclaration node) {
if (skipNode(node))
return;
GenericSequentialFlowInfo info= processSequential(node, node.bodyDeclarations());
info.setNoReturn();
}
项目:Eclipse-Postfix-Code-Completion
文件:AbstractExceptionAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
// Don't dive into a local type.
if (node.isLocalTypeDeclaration())
return false;
return true;
}
项目:Eclipse-Postfix-Code-Completion
文件:NewAnnotationMemberProposal.java
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot= ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl= astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl= null;
if (typeDecl != null) {
newTypeDecl= typeDecl;
} else {
astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl= astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
AnnotationTypeDeclaration newAnnotationTypeDecl= (AnnotationTypeDeclaration) newTypeDecl;
ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub= getStub(rewrite, newAnnotationTypeDecl);
List<BodyDeclaration> members= newAnnotationTypeDecl.bodyDeclarations();
int insertIndex= members.size();
ListRewrite listRewriter= rewrite.getListRewrite(newAnnotationTypeDecl, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
项目:Eclipse-Postfix-Code-Completion
文件:NewAnnotationMemberProposal.java
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls= targetTypeDecl.bodyDeclarations();
for (int i= 0; i < methodDecls.size(); i++) {
Object curr= methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
项目:Eclipse-Postfix-Code-Completion
文件:JavaHistoryActionImpl.java
final ASTNode getBodyContainer(CompilationUnit root, IMember parent) throws JavaModelException {
ISourceRange sourceRange= parent.getNameRange();
ASTNode parentNode= NodeFinder.perform(root, sourceRange);
do {
if (parentNode instanceof TypeDeclaration || parentNode instanceof EnumDeclaration || parentNode instanceof AnnotationTypeDeclaration)
return parentNode;
parentNode= parentNode.getParent();
} while (parentNode != null);
return null;
}
项目:Eclipse-Postfix-Code-Completion
文件:CreateTypeMemberOperation.java
protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent) {
switch (parent.getNodeType()) {
case ASTNode.COMPILATION_UNIT:
return CompilationUnit.TYPES_PROPERTY;
case ASTNode.ENUM_DECLARATION:
return EnumDeclaration.BODY_DECLARATIONS_PROPERTY;
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY;
default:
return TypeDeclaration.BODY_DECLARATIONS_PROPERTY;
}
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:FlowAnalyzer.java
@Override
public void endVisit(AnnotationTypeDeclaration node) {
if (skipNode(node))
return;
GenericSequentialFlowInfo info= processSequential(node, node.bodyDeclarations());
info.setNoReturn();
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:AbstractExceptionAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
// Don't dive into a local type.
if (node.isLocalTypeDeclaration())
return false;
return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:NewAnnotationMemberProposal.java
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot= ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl= astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl= null;
if (typeDecl != null) {
newTypeDecl= typeDecl;
} else {
astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl= astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub= getStub(rewrite, (AnnotationTypeDeclaration) newTypeDecl);
ChildListPropertyDescriptor property= ASTNodes.getBodyDeclarationsProperty(newTypeDecl);
List<? extends ASTNode> members= (List<? extends ASTNode>) newTypeDecl.getStructuralProperty(property);
int insertIndex= members.size();
ListRewrite listRewriter= rewrite.getListRewrite(newTypeDecl, property);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:NewAnnotationMemberProposal.java
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls= targetTypeDecl.bodyDeclarations();
for (int i= 0; i < methodDecls.size(); i++) {
Object curr= methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:JavaHistoryActionImpl.java
final ASTNode getBodyContainer(CompilationUnit root, IMember parent) throws JavaModelException {
ISourceRange sourceRange= parent.getNameRange();
ASTNode parentNode= NodeFinder.perform(root, sourceRange);
do {
if (parentNode instanceof TypeDeclaration || parentNode instanceof EnumDeclaration || parentNode instanceof AnnotationTypeDeclaration)
return parentNode;
parentNode= parentNode.getParent();
} while (parentNode != null);
return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38
文件:CreateTypeMemberOperation.java
protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent) {
switch (parent.getNodeType()) {
case ASTNode.COMPILATION_UNIT:
return CompilationUnit.TYPES_PROPERTY;
case ASTNode.ENUM_DECLARATION:
return EnumDeclaration.BODY_DECLARATIONS_PROPERTY;
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY;
default:
return TypeDeclaration.BODY_DECLARATIONS_PROPERTY;
}
}
项目:eclipse-optimus
文件:JavaCodeHelper.java
/**
* Return a Body Declaration Property according to the {@code type} type.
*
* @param type
* A Body Declaration type
* @return a Body Declaration Property according to the {@code type} type.
*/
public static ChildListPropertyDescriptor getBodyDeclarationProperty(Class<?> type) {
if (type.equals(TypeDeclaration.class)) {
return TypeDeclaration.BODY_DECLARATIONS_PROPERTY;
} else if (type.equals(EnumDeclaration.class)) {
return EnumDeclaration.BODY_DECLARATIONS_PROPERTY;
} else if (type.equals(AnnotationTypeDeclaration.class)) {
return AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY;
}
return null;
}
项目:RefDiff
文件:BindingsRecoveryAstVisitor.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return false;
}
项目:RefDiff
文件:BindingsRecoveryAstVisitor.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return false;
}
项目:eclipse.jdt.ls
文件:SnippetFinder.java
@Override
public void endVisit(AnnotationTypeDeclaration node) {
--fTypes;
super.endVisit(node);
}
项目:eclipse.jdt.ls
文件:LocalTypeAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return visitType(node);
}
项目:eclipse.jdt.ls
文件:ExtractMethodAnalyzer.java
boolean isValidDestination(ASTNode node) {
boolean isInterface = node instanceof TypeDeclaration && ((TypeDeclaration) node).isInterface();
return !(node instanceof AnnotationTypeDeclaration) && !(isInterface && !JavaModelUtil.is18OrHigher(fCUnit.getJavaProject()));
}
项目:eclipse.jdt.ls
文件:ExtractMethodRefactoring.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return visitType(node);
}
项目:eclipse.jdt.ls
文件:ReturnTypeSubProcessor.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return false;
}
项目:che
文件:JdtFlags.java
private static boolean isInterfaceOrAnnotation(ASTNode node) {
boolean isInterface =
(node instanceof TypeDeclaration) && ((TypeDeclaration) node).isInterface();
boolean isAnnotation = node instanceof AnnotationTypeDeclaration;
return isInterface || isAnnotation;
}
项目:che
文件:ASTNodeSearchUtil.java
public static AnnotationTypeDeclaration getAnnotationTypeDeclarationNode(
IType iType, CompilationUnit cuNode) throws JavaModelException {
return (AnnotationTypeDeclaration)
ASTNodes.getParent(getNameNode(iType, cuNode), AnnotationTypeDeclaration.class);
}
项目:che
文件:SourceAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return false;
}
项目:che
文件:SourceAnalyzer.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return visitType(node);
}
项目:che
文件:SourceAnalyzer.java
@Override
public void endVisit(AnnotationTypeDeclaration node) {
fTypeCounter--;
}
项目:che
文件:TargetProvider.java
@Override
public boolean visit(AnnotationTypeDeclaration node) {
return visitType();
}