Examples of rewriteAST()


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 (node == null)
      Assert.isTrue(false, "Failed to locate " + elementToRemove.getElementName() + " in " + cu.getElementName()); //$NON-NLS-1$//$NON-NLS-2$
    AST ast = astCU.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
    rewriter.remove(node, null);
     TextEdit edits = rewriter.rewriteAST();
     applyTextEdit(cu, edits);
  }

  private void initASTParser() {
    this.parser = ASTParser.newParser(AST.JLS8);
View Full Code Here

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

        listRewrite.insertLast(node, null);
        System.out.println(originalList);
        System.out.println(listRewrite.getRewrittenList());
      }
    }
    TextEdit rewriteAst = rewriter.rewriteAST(doc, null);
    rewriteAst.apply(doc);
    System.out.println(doc.get());
  }

View Full Code Here

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

            } else {
                rewrite.replace(original, null, editGroup);
            }
        }
       
        TextEdit edits = rewrite.rewriteAST(document, compilationUnit.getJavaProject().getOptions(true));
       
        // computation of the new source code
        edits.apply(document);
        String newSource = document.get();
       
View Full Code Here

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

      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
      importEdits = importRewrite.rewriteImports(null);
    }
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    if (importEdits != null) {
      importEdits.apply(document);
View Full Code Here

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

      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
      importEdits = importRewrite.rewriteImports(null);
    }
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    if (importEdits != null) {
      importEdits.apply(document);
View Full Code Here

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

    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
    importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
    importEdits = importRewrite.rewriteImports(null);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    if (importEdits != null) {
      importEdits.apply(document);
View Full Code Here

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

    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
    importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
    importEdits = importRewrite.rewriteImports(null);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    if (importEdits != null) {
      importEdits.apply(document);
View Full Code Here

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

    ASTRewrite rewrite = ASTRewrite.create(ast);

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    String newSource = document.get();
   
View Full Code Here

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

    ASTRewrite rewrite = ASTRewrite.create(ast);

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);
   
    Map options = compilationUnit.getJavaProject().getOptions(true);
    TextEdit edits = rewrite.rewriteAST(document, options);
   
    // computation of the new source code
    edits.apply(document);
    String newSource = document.get();
   
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.