Examples of rewriteAST()


Examples of org.aspectj.org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

      if (rewrite == null) {
        return null;
      }
     
      Document document= new Document(content);
      return rewrite.rewriteAST(document, null);
    } finally {
      done();
    }
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

       
    ASTRewrite rewriter= sortCompilationUnit(ast, null);
    if (rewriter == null)
      return document.get();
   
    TextEdit edits = rewriter.rewriteAST(document, null);
   
    RangeMarker[] markers = null;
    if (this.positions != null) {
      markers = new RangeMarker[this.positions.length];
      for (int i = 0, max = this.positions.length; i < max; i++) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

      Assert.isTrue(false, "Failed to locate " + elementToRemove.getElementName() + " in " + cu.getElementName()); //$NON-NLS-1$//$NON-NLS-2$
    IDocument document = getDocument(cu);
    AST ast = astCU.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
    rewriter.remove(node, null);
     TextEdit edits = rewriter.rewriteAST(document, null);
     try {
       edits.apply(document);
     } catch (BadLocationException e) {
       throw new JavaModelException(e, IJavaModelStatusConstants.INVALID_CONTENTS);
     }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

            CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
            AST ast = astCU.getAST();
            ASTRewrite rewrite = ASTRewrite.create(ast);
            updatePackageStatement(astCU, newFragName, rewrite);
            IDocument document = getDocument(cu);
            TextEdit edits = rewrite.rewriteAST(document, null);
            try {
              edits.apply(document);
            } catch (BadLocationException e) {
              throw new JavaModelException(e, IJavaModelStatusConstants.INVALID_CONTENTS);
            }     
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

      String source = icu.getSource();
      Document document = new Document(source);

      // computation of the text edits
      TextEdit edits = rewrite.rewriteAST(document, icu.getJavaProject()
          .getOptions(true));

      // computation of the new source code
      if (edits != null) {
        edits.apply(document);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

            this.parser.setSource(cu);
            CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
            AST ast = astCU.getAST();
            ASTRewrite rewrite = ASTRewrite.create(ast);
            updatePackageStatement(astCU, newFragName, rewrite, cu);
            TextEdit edits = rewrite.rewriteAST();
            applyTextEdit(cu, edits);
            cu.save(null, false);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

      CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
      AST ast = astCU.getAST();
      ASTRewrite rewrite = ASTRewrite.create(ast);
      updateTypeName(cu, astCU, cu.getElementName(), newName, rewrite);
      updatePackageStatement(astCU, destPackageName, rewrite, cu);
      return rewrite.rewriteAST();
    }
  }
  private void updatePackageStatement(CompilationUnit astCU, String[] pkgName, ASTRewrite rewriter, ICompilationUnit cu) throws JavaModelException {
    boolean defaultPackage = pkgName.length == 0;
    AST ast = astCU.getAST();
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

      if (rewrite == null) {
        return null;
      }

      Document document= new Document(content);
      return rewrite.rewriteAST(document, cu.getJavaProject().getOptions(true));
    } finally {
      done();
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

    ASTRewrite rewriter= sortCompilationUnit(ast, null);
    if (rewriter == null)
      return document.get();

    TextEdit edits = rewriter.rewriteAST(document, unit.getJavaProject().getOptions(true));

    RangeMarker[] markers = null;
    if (this.positions != null) {
      markers = new RangeMarker[this.positions.length];
      for (int i = 0, max = this.positions.length; i < max; i++) {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST()

            this.parser.setSource(cu);
            CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
            AST ast = astCU.getAST();
            ASTRewrite rewrite = ASTRewrite.create(ast);
            updatePackageStatement(astCU, newFragName, rewrite, cu);
            TextEdit edits = rewrite.rewriteAST();
            applyTextEdit(cu, edits);
            cu.save(null, false);
          }
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.