Package org.eclipse.jdt.core.dom.rewrite

Examples of org.eclipse.jdt.core.dom.rewrite.ListRewrite.insertFirst()


      final ASTNode node, final ASTRewrite rewrite, final CodeGenerationSettings settings,
      final MethodDeclaration stub) throws BadLocationException
  {
    ChildListPropertyDescriptor descriptor = getPropDescriptor(node);
    ListRewrite rewriter = rewrite.getListRewrite(node, descriptor);
    rewriter.insertFirst(stub, null);

    ITrackedNodePosition position = rewrite.track(stub);

    rewrite.rewriteAST(recoveredDocument, fJavaProject.getOptions(true)).apply(recoveredDocument);
View Full Code Here


        SuperMethodInvocation superCall = createSuperMethodInvocation(rewrite, method);
        ExpressionStatement statement = ast.newExpressionStatement(superCall);
        Block methodBody = method.getBody();
        ListRewrite listRewrite = rewrite.getListRewrite(methodBody, Block.STATEMENTS_PROPERTY);
        if (isInsertFirst()) {
            listRewrite.insertFirst(statement, null);
        } else {
            listRewrite.insertLast(statement, null);
        }
    }
View Full Code Here

    ASTRewrite rewrite = ASTRewrite.create(declaration.getAST());

    ChildListPropertyDescriptor modifiersProperty = declaration.getModifiersProperty();

    ListRewrite listRewrite = rewrite.getListRewrite(declaration, modifiersProperty);
    listRewrite.insertFirst(annotation, null);
   
    TextEdit importEdits = null;
    if (importDeclaration != null) {
      ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
View Full Code Here

    parser.setSource(compilationUnit);
 
    ASTRewrite rewrite = ASTRewrite.create(declaration.getAST());

    ListRewrite listRewrite = rewrite.getListRewrite(declaration, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
    listRewrite.insertFirst(annotation, null);
   
    TextEdit importEdits = null;
    if (importDeclaration != null) {
      ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
      importRewrite.addImport(importDeclaration.getName().getFullyQualifiedName());
View Full Code Here

    ASTRewrite rewrite = ASTRewrite.create(declaration.getAST());
   
    ChildListPropertyDescriptor modifiersProperty = declaration.getModifiersProperty();
   
    ListRewrite listRewrite = rewrite.getListRewrite(declaration, modifiersProperty);
    listRewrite.insertFirst(normalAnnotation, null);

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);

    TextEdit importEdits = null;
    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
View Full Code Here

    parser.setSource(compilationUnit);
   
    ASTRewrite rewrite = ASTRewrite.create(declaration.getAST());
   
    ListRewrite listRewrite = rewrite.getListRewrite(declaration, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
    listRewrite.insertFirst(normalAnnotation, null);

    maintainValuesProperty(normalAnnotation, memberValues, ast, rewrite);

    TextEdit importEdits = null;
    ImportRewrite importRewrite = ImportRewrite.create(compilationUnit, true);
View Full Code Here

    //
    ListRewrite lr = result.getListRewrite(astRoot, CompilationUnit.IMPORTS_PROPERTY);
    ImportDeclaration id = ast.newImportDeclaration();
    id.setStatic(true);
    id.setName(ast.newName("org.testng.AssertJUnit." + m_assert));
    lr.insertFirst(id, null);

    return result;
  }

  public String getName() {
View Full Code Here

    // Add @Test at the class level
    //
    MarkerAnnotation test = ast.newMarkerAnnotation();
    test.setTypeName(ast.newName("Test"));
    ListRewrite lr = result.getListRewrite(visitor.getType(), TypeDeclaration.MODIFIERS2_PROPERTY);
    lr.insertFirst(test, null);

    return result;
  }

  public String getName() {
View Full Code Here

      mvp.setName(ast.newSimpleName("enabled"));
      mvp.setValue(ast.newBooleanLiteral(false));
      test.values().add(mvp);
      result.remove(ignored, null);
      ListRewrite lr = result.getListRewrite(md, MethodDeclaration.MODIFIERS2_PROPERTY);
      lr.insertFirst(test, null);
    }

    //
    // Replace "Assert" with "AssertJUnit", unless the method is already imported statically.
    //
View Full Code Here

      Block block = ast.newBlock();
      block.statements().add(returnStatement);
      md.setBody(block);

      lr.insertFirst(md, null);
    }

    return result;
  }
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.