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

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


      boolean isStatic) {
    ListRewrite lr = rewriter.getListRewrite(astRoot, CompilationUnit.IMPORTS_PROPERTY);
    ImportDeclaration id = ast.newImportDeclaration();
    id.setStatic(isStatic);
    id.setName(ast.newName(imp));
    lr.insertFirst(id, null);
  }

  /**
   * Add the given annotation if the method is non null
   */
 
View Full Code Here


        }
      }
    }

    // Add the annotation
    lr.insertFirst(a, null);
  }

  public String getName() {
    return "Convert to TestNG (Annotations)";
 
View Full Code Here

    //
    for (MethodDeclaration md : visitor.getPublicMethods()) {
      ListRewrite lr = result.getListRewrite(md, MethodDeclaration.MODIFIERS2_PROPERTY);
      MarkerAnnotation test = ast.newMarkerAnnotation();
      test.setTypeName(ast.newSimpleName("Test"));
      lr.insertFirst(test, null);
    }

    return result;
  }
View Full Code Here

    else {
      property = MethodDeclaration.MODIFIERS2_PROPERTY;
    }

    ListRewrite listRewrite = astRewrite.getListRewrite(decl, property);
    listRewrite.insertFirst(annotation, null);

    return astRewrite;
  }

  // private static String getDisplayName(String qualifier) {
View Full Code Here

    pathVariableName.setLiteralValue(variable.getVariableName());
    annotation.setValue(pathVariableName);
    addLinkedPosition(new StringLiteralTrackedPosition(astRewrite.track(pathVariableName)), false, "variableName");

    ListRewrite listRewrite = astRewrite.getListRewrite(paramDecl, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
    listRewrite.insertFirst(annotation, null);

    listRewrite = astRewrite.getListRewrite(methodDecl, MethodDeclaration.PARAMETERS_PROPERTY);
    listRewrite.insertLast(paramDecl, null);

    return astRewrite;
View Full Code Here

        pair.setName(annotationAST.newSimpleName("method"));

        QualifiedName valueName = annotationAST.newQualifiedName(annotationAST.newSimpleName("RequestMethod"),
            annotationAST.newSimpleName(methodTypeString));
        pair.setValue(valueName);
        listRewrite.insertFirst(pair, null);
      }

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

      edit.addChild(astRewrite.rewriteAST());
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.