Search in sources :

Example 46 with TypeDeclaration

use of org.eclipse.jdt.core.dom.TypeDeclaration in project eclipse-pmd by acanda.

the class SuppressWarningsQuickFix method findBodyDeclaration.

private BodyDeclaration findBodyDeclaration(final ASTNode node) {
    final BodyDeclaration[] bodyDeclaration = new BodyDeclaration[1];
    node.accept(new ASTVisitor() {

        @Override
        public boolean visit(final EnumDeclaration node) {
            bodyDeclaration[0] = node;
            return false;
        }

        @Override
        public boolean visit(final TypeDeclaration node) {
            bodyDeclaration[0] = node;
            return false;
        }

        @Override
        public boolean visit(final AnnotationTypeDeclaration node) {
            bodyDeclaration[0] = node;
            return false;
        }
    });
    return bodyDeclaration[0];
}
Also used : AnnotationTypeDeclaration(org.eclipse.jdt.core.dom.AnnotationTypeDeclaration) BodyDeclaration(org.eclipse.jdt.core.dom.BodyDeclaration) AnnotationTypeDeclaration(org.eclipse.jdt.core.dom.AnnotationTypeDeclaration) AbstractTypeDeclaration(org.eclipse.jdt.core.dom.AbstractTypeDeclaration) TypeDeclaration(org.eclipse.jdt.core.dom.TypeDeclaration) ASTVisitor(org.eclipse.jdt.core.dom.ASTVisitor) EnumDeclaration(org.eclipse.jdt.core.dom.EnumDeclaration)

Aggregations

TypeDeclaration (org.eclipse.jdt.core.dom.TypeDeclaration)46 ASTNode (org.eclipse.jdt.core.dom.ASTNode)30 MethodDeclaration (org.eclipse.jdt.core.dom.MethodDeclaration)23 AbstractTypeDeclaration (org.eclipse.jdt.core.dom.AbstractTypeDeclaration)22 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)18 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)13 SimpleName (org.eclipse.jdt.core.dom.SimpleName)12 Type (org.eclipse.jdt.core.dom.Type)12 FieldDeclaration (org.eclipse.jdt.core.dom.FieldDeclaration)11 BodyDeclaration (org.eclipse.jdt.core.dom.BodyDeclaration)10 AnnotationTypeDeclaration (org.eclipse.jdt.core.dom.AnnotationTypeDeclaration)9 ArrayList (java.util.ArrayList)8 AST (org.eclipse.jdt.core.dom.AST)8 SimpleType (org.eclipse.jdt.core.dom.SimpleType)7 VariableDeclarationFragment (org.eclipse.jdt.core.dom.VariableDeclarationFragment)7 ArrayType (org.eclipse.jdt.core.dom.ArrayType)6 Block (org.eclipse.jdt.core.dom.Block)6 Expression (org.eclipse.jdt.core.dom.Expression)6 ITypeBinding (org.eclipse.jdt.core.dom.ITypeBinding)6 Javadoc (org.eclipse.jdt.core.dom.Javadoc)6