public static boolean isListRewriteOnGeneratedNode(org.eclipse.jdt.core.dom.rewrite.ListRewrite rewrite) { return isGenerated(rewrite.getParent()); }
/** * Creates a new instance for describing manipulations of * the given AST. * * @param ast the AST whose nodes will be rewritten * @return the new rewriter instance */ public static ASTRewrite create(AST ast) { return new ASTRewrite(ast); }
/** * Returns all static imports that are recorded to be added. * * @return the static imports recorded to be added. */ public String[] getAddedStaticImports() { return filterFromList(this.addedImports, STATIC_PREFIX); }
private void addMethod(ListRewrite rewriter, ASTNode insertion, MethodDeclaration stub, BodyDeclaration replace) { if (replace != null) { rewriter.replace(replace, stub, null); } else { if (insertion != null) rewriter.insertBefore(stub, insertion, null); else rewriter.insertLast(stub, null); } }
private boolean insertExpressionAsParameter(SuperConstructorInvocation sci, ASTRewrite rewrite, ICompilationUnit cu, TextEditGroup group) throws JavaModelException { final Expression expression= createEnclosingInstanceCreationString(sci, cu); if (expression == null) return false; rewrite.getListRewrite(sci, SuperConstructorInvocation.ARGUMENTS_PROPERTY).insertFirst(expression, group); return true; }
private void addHelper(ListRewrite rewriter, ASTNode insertion, MethodDeclaration stub) { if (insertion != null) rewriter.insertBefore(stub, insertion, null); else rewriter.insertFirst(stub, null); }
private void insertTag(TagElement tag, TagElement previousTag, ListRewrite tagsRewrite) { if (previousTag == null) tagsRewrite.insertFirst(tag, fDescription); else tagsRewrite.insertAfter(tag, previousTag, fDescription); }
ModifyBlock(Statement origStmt, Block enclosingBlock, ASTRewrite rewrite, TextEditGroup group) { super(origStmt, enclosingBlock, group); // we're going to modify this block, create the rewrite for this task: this.blockRewrite= rewrite.getListRewrite(enclosingBlock, Block.STATEMENTS_PROPERTY); } @Override
@Override public Statement createMoveTargetForOrigStmt() { return (Statement) this.blockRewrite.createMoveTarget(this.origStmt, this.origStmt, null, this.group); } @Override
@Override public Statement createMoveTargetForOrigStmt() { return (Statement) this.rewrite.createMoveTarget(this.origStmt); // group is unused } @Override
/** * Returns the AST. * * @return the AST */ public AST getAST() { return rewrite.getAST(); }
private void annotateList(List annotations, IAnnotationBinding [] annotationBindings, AST ast, ImportRewriteContext context, TypeLocation location, ITypeBinding type) { if (context == null) context= this.defaultContext; annotationBindings = context.removeRedundantTypeAnnotations(annotationBindings, location, type); for (int i = 0; i< annotationBindings.length; i++) { Annotation annotation = addAnnotation(annotationBindings[i], ast, context); if (annotation != null) annotations.add(annotation); } }
@Override public Statement createMoveTargetForOrigStmt() { return (Statement) this.blockRewrite.createMoveTarget(this.origStmt, this.origStmt, null, this.group); } @Override
/** * Returns all static imports that are recorded to be added. * * @return the static imports recorded to be added. */ public String[] getAddedStaticImports() { return filterFromList(this.addedImports, STATIC_PREFIX); }
/** * Creates a new instance for describing manipulations of * the given AST. * * @param ast the AST whose nodes will be rewritten * @return the new rewriter instance */ public static ASTRewrite create(AST ast) { return new ASTRewrite(ast); }
/** * Returns all non-static imports that are recorded to be added. * * @return the imports recorded to be added. */ public String[] getAddedImports() { return filterFromList(this.addedImports, NORMAL_PREFIX); }
/** * Returns all non-static imports that are recorded to be removed. * * @return the imports recorded to be removed. */ public String[] getRemovedImports() { return filterFromList(this.removedImports, NORMAL_PREFIX); }
/** * Returns all non-static imports that are recorded to be added. * * @return the imports recorded to be added. */ public String[] getAddedImports() { return filterFromList(this.addedImports, NORMAL_PREFIX); }
/** * Returns all static imports that are recorded to be removed. * * @return the static imports recorded to be removed. */ public String[] getRemovedStaticImports() { return filterFromList(this.removedImports, STATIC_PREFIX); }
/** * Returns all non-static imports that are recorded to be added. * * @return the imports recorded to be added. */ public String[] getAddedImports() { return filterFromList(this.addedImports, NORMAL_PREFIX); }