Examples of rewriteAST()


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

  protected void addEdits(IDocument document, TextEdit editRoot) throws CoreException {
//    super.addEdits(document, editRoot);
    ASTRewrite rewrite = m_rewriter;
    if (rewrite != null) {
      try {
        TextEdit edit= rewrite.rewriteAST();
        editRoot.addChild(edit);
      } catch (IllegalArgumentException e) {
        throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
      }
    }
View Full Code Here

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

//    AST ast = context.getASTRoot().getAST();
    AST ast = astRoot.getAST();
    ASTRewrite rewriter = new AnnotationRewriter().createRewriter(astRoot, ast);
    try {
      TextEdit edit = rewriter.rewriteAST();
      result = new TextFileChange(resource.getName(), (IFile) resource);
      result.setEdit(edit);
    } catch (JavaModelException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
View Full Code Here

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

        listRewrite.insertFirst(pair, null);
      }

      astRewrite.getListRewrite(decl, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(annotation, null);

      edit.addChild(astRewrite.rewriteAST());

      int oldLength = document.getLength();
      // int oldCurserPos = document.getCursorPosition();
      edit.apply(document);
View Full Code Here

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

    annotation.setTypeName(astRewrite.getAST().newSimpleName("RequestMapping"));
    astRewrite.getListRewrite(decl, TypeDeclaration.MODIFIERS2_PROPERTY).insertFirst(annotation, null);

    ITrackedNodePosition tracker = astRewrite.track(annotation.getTypeName());
    edit.addChild(astRewrite.rewriteAST());

    edit.apply(document);

    setReplacementOffset(tracker.getStartPosition() + annotation.getTypeName().getFullyQualifiedName().length() + 1);
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.rewrite.ASTRewrite.rewriteAST()

    }
   

    classListRewrite.insertAfter(method, fCoveringDeclarationFinder.getCoveringMethodDeclaration(), newMethodEdit);
   
    TextEdit fullDocumentEdit = rewriter.rewriteAST(document, null);

    anotherChange.addEdit(fullDocumentEdit);
   
    return anotherChange;
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.rewrite.ASTRewrite.rewriteAST()

        Block.STATEMENTS_PROPERTY);
    ASTNode placeHolder = rewrite.createStringPlaceholder("//mycomment",
        ASTNode.COMMENT);
    listRewrite.insertFirst(placeHolder, null);

    TextEdit textEdits = rewrite.rewriteAST(document, null);
    textEdits.apply(document);
    checkResult("<?php\n class A { \n  //mycomment\n  public function foo(int $a){}\n }?> ");
  }

  public void testException() throws Exception {
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.rewrite.ASTRewrite.rewriteAST()

    rewrite.replace(
        allthrows.get(0),
        rewrite.createGroupNode(new ASTNode[] { allthrows.get(0),
            program.getAST().newBreakStatement() }), null);
    rewrite.rewriteAST(document, null).apply(document);

    checkResult("<?php\n function A() { throw new Exception(); break; }");

  }
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.rewrite.ASTRewrite.rewriteAST()

      throws CoreException {
    super.addEdits(document, editRoot);
    ASTRewrite rewrite = getRewrite();
    if (rewrite != null) {
      try {
        TextEdit edit = rewrite.rewriteAST(document, null);
        editRoot.addChild(edit);
      } catch (IllegalArgumentException e) {
        throw new CoreException(DLTKUIStatus.createError(IStatus.ERROR,
            e));
      }
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.