Package org.aspectj.org.eclipse.jdt.core.dom

Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTVisitor


    TargetSourceRangeComputer sourceRangeComputer= getExtendedSourceRangeComputer();
    this.eventStore.prepareMovedNodes(sourceRangeComputer);
   
    // AspectJ extension - ask the factory in ASTRewriteAnalyzer for a visitor rather than building it directly.
    // ASTRewriteAnalyzer visitor= new ASTRewriteAnalyzer(content, lineInfo, lineDelim, result, this.eventStore, this.nodeStore, commentNodes, options, sourceRangeComputer);
    ASTVisitor visitor = ASTRewriteAnalyzer.getAnalyzerVisitor(content, lineInfo, lineDelim, result, this.eventStore, this.nodeStore, commentNodes, options, sourceRangeComputer);
    // End AspectJ Extension
   
    rootNode.accept(visitor); // throws IllegalArgumentException
   
    this.eventStore.revertMovedNodes();
View Full Code Here


    return document.get();
  }
 
 
  private ASTRewrite sortCompilationUnit(org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit ast, final TextEditGroup group) {
    ast.accept(new ASTVisitor() {
      public boolean visit(org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit compilationUnit) {
        List types = compilationUnit.types();
        for (Iterator iter = types.iterator(); iter.hasNext();) {
          AbstractTypeDeclaration typeDeclaration = (AbstractTypeDeclaration) iter.next();
          typeDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(typeDeclaration.getStartPosition()));
          compilationUnit.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(typeDeclaration)));
        }
        return true;
      }
      public boolean visit(AnnotationTypeDeclaration annotationTypeDeclaration) {
        List bodyDeclarations = annotationTypeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          annotationTypeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(AnonymousClassDeclaration anonymousClassDeclaration) {
        List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          anonymousClassDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }
     
      public boolean visit(TypeDeclaration typeDeclaration) {
        List bodyDeclarations = typeDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          typeDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        return true;
      }

      public boolean visit(EnumDeclaration enumDeclaration) {
        List bodyDeclarations = enumDeclaration.bodyDeclarations();
        for (Iterator iter = bodyDeclarations.iterator(); iter.hasNext();) {
          BodyDeclaration bodyDeclaration = (BodyDeclaration) iter.next();
          bodyDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(bodyDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(bodyDeclaration)));
        }
        List enumConstants = enumDeclaration.enumConstants();
        for (Iterator iter = enumConstants.iterator(); iter.hasNext();) {
          EnumConstantDeclaration enumConstantDeclaration = (EnumConstantDeclaration) iter.next();
          enumConstantDeclaration.setProperty(CompilationUnitSorter.RELATIVE_ORDER, new Integer(enumConstantDeclaration.getStartPosition()));
          enumDeclaration.setProperty(CONTAINS_MALFORMED_NODES, Boolean.valueOf(isMalformed(enumConstantDeclaration)));
        }       
        return true;
      }
    });
   
    final ASTRewrite rewriter= ASTRewrite.create(ast.getAST());
    final boolean[] hasChanges= new boolean[] {false};
   
    ast.accept(new ASTVisitor() {
   
      private void sortElements(List elements, ListRewrite listRewrite) {
        if (elements.size() == 0)
          return;
       
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.dom.ASTVisitor

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.