Esempio n. 1
0
 public boolean visit(TypeDeclaration node) {
   if (fBinding.getKind() == IBinding.METHOD) {
     IFunctionBinding binding = (IFunctionBinding) fBinding;
     if (binding.isConstructor() && binding.getDeclaringClass() == node.resolveBinding()) {
       fResult.add(node.getName());
     }
   }
   return true;
 }
 /* (omit javadoc for this method)
  * Method declared on ASTNode.
  */
 ASTNode clone0(AST target) {
   TypeDeclaration result = new TypeDeclaration(target);
   result.setSourceRange(this.getStartPosition(), this.getLength());
   result.setJavadoc((JSdoc) ASTNode.copySubtree(target, getJavadoc()));
   if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
     result.internalSetModifiers(getModifiers());
     result.setSuperclass((Name) ASTNode.copySubtree(target, getSuperclass()));
   }
   result.setName((SimpleName) getName().clone(target));
   if (this.ast.apiLevel >= AST.JLS3) {
     result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers()));
     result.setSuperclassType((Type) ASTNode.copySubtree(target, getSuperclassType()));
   }
   result.bodyDeclarations().addAll(ASTNode.copySubtrees(target, bodyDeclarations()));
   return result;
 }
 /*
  * @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;
 }