/* * @see ASTVisitor#visit(TypeDeclaration) */ public boolean visit(TypeDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } if (node.getAST().apiLevel() == AST.JLS2) { printModifiers(node.getModifiers()); } if (node.getAST().apiLevel() >= AST.JLS3) { printModifiers(node.modifiers()); } this.fBuffer.append("class "); // $NON-NLS-1$ node.getName().accept(this); this.fBuffer.append(" "); // $NON-NLS-1$ if (node.getAST().apiLevel() == AST.JLS2) { if (node.getSuperclass() != null) { this.fBuffer.append("extends "); // $NON-NLS-1$ node.getSuperclass().accept(this); this.fBuffer.append(" "); // $NON-NLS-1$ } } if (node.getAST().apiLevel() >= AST.JLS3) { if (node.getSuperclassType() != null) { this.fBuffer.append("extends "); // $NON-NLS-1$ node.getSuperclassType().accept(this); this.fBuffer.append(" "); // $NON-NLS-1$ } } this.fBuffer.append("{"); // $NON-NLS-1$ for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) { BodyDeclaration d = (BodyDeclaration) it.next(); d.accept(this); } this.fBuffer.append("}"); // $NON-NLS-1$ return false; }
/* * @see ASTVisitor#visit(AnonymousClassDeclaration) */ public boolean visit(AnonymousClassDeclaration node) { this.fBuffer.append("{"); // $NON-NLS-1$ for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) { BodyDeclaration b = (BodyDeclaration) it.next(); b.accept(this); } this.fBuffer.append("}"); // $NON-NLS-1$ return false; }
public static Scope perform(BodyDeclaration node, Selection ignore) { CodeScopeBuilder collector = new CodeScopeBuilder(node, ignore); node.accept(collector); return collector.fScope; }