Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.BodyDeclaration


    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;
  }
View Full Code Here


   */
  public boolean visit(AnonymousClassDeclaration node) {
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
      BodyDeclaration b = (BodyDeclaration) it.next();
      b.accept(this);
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

      }
    }
    if (!node.bodyDeclarations().isEmpty()) {
      this.buffer.append("; ");//$NON-NLS-1$
      for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
        BodyDeclaration d = (BodyDeclaration) it.next();
        d.accept(this);
        // other body declarations include trailing punctuation
      }
    }
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

      }
    }
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
      BodyDeclaration d = (BodyDeclaration) it.next();
      d.accept(this);
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

        _output("@interface ");
        node.getName().accept(this);
        _openBrace();

        for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
            BodyDeclaration d = (BodyDeclaration) it.next();
            d.accept(this);
        }

        _checkComments((node.getStartPosition() + node.getLength()) - 1);
        _closeBrace();
        return false;
View Full Code Here

    public boolean visit(AnonymousClassDeclaration node) {
        _output(" ");
        _openBrace();

        for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) {
            BodyDeclaration b = (BodyDeclaration) it.next();
            b.accept(this);
        }

        _checkComments((node.getStartPosition() + node.getLength()) - 1);
        _closeBrace(false);
        return false;
View Full Code Here

            _output(" ");
        }

        _openBrace();

        BodyDeclaration prev = null;
        Iterator it;

        for (it = node.bodyDeclarations().iterator(); it.hasNext();) {
            BodyDeclaration d = (BodyDeclaration) it.next();

            if (prev instanceof EnumConstantDeclaration) {
                // enum constant declarations do not include punctuation
                if (d instanceof EnumConstantDeclaration) {
                    // enum constant declarations are separated by commas
                    _output(", ");
                } else {
                    // semicolon separates last enum constant declaration from
                    // first class body declarations
                    _output("; ");
                }
            }

            d.accept(this);
        }

        _checkComments((node.getStartPosition() + node.getLength()) - 1);
        _closeBrace();
        return false;
View Full Code Here

        }

        _openBrace();
        _output("\n");

        BodyDeclaration prev = null;
        Iterator it;

        for (it = node.bodyDeclarations().iterator(); it.hasNext();) {
            BodyDeclaration d = (BodyDeclaration) it.next();

            if (prev instanceof EnumConstantDeclaration) {
                // enum constant declarations do not include punctuation
                if (d instanceof EnumConstantDeclaration) {
                    // enum constant declarations are separated by commas
                    _output(", ");
                } else {
                    // semicolon separates last enum constant declaration from
                    // first class body declarations
                    _output("; ");
                }
            }

            d.accept(this);
        }

        _checkComments((node.getStartPosition() + node.getLength()) - 1);
        _closeBrace();
        _output("\n");
View Full Code Here

   *      java.lang.Class, java.util.Map)
   */
  public void addClassAnnotation(String targetClass, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> properties) {
    try {
      CompilationUnit cu = compilationUnitCache.getCompilationUnit(targetClass);
      BodyDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);

      if (isAnnotationAlreadyUsedOnDeclaration(annotation, typeDeclaration)) {
        warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
        return;
      }

      addImportToCompilationUnit(annotation.getCanonicalName(), cu);
      Annotation modifier = createModifier(cu.getAST(), annotation, properties, cu);
      typeDeclaration.modifiers().add(0, modifier);
    } catch (Exception e) {
      warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.2"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
    }
  }
View Full Code Here

    }
  }

  public void removeAbstractModifierFromClass(String targetClass) {
    try {
      BodyDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
      removeAbstractModifier(typeDeclaration.modifiers());
    } catch (Exception e) {
      warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.6"), targetClass)); //$NON-NLS-1$
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.BodyDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.