@Override public Statement createMoveTargetForOrigStmt() { return (Statement) this.blockRewrite.createMoveTarget(this.origStmt, this.origStmt, null, this.group); } @Override
@Override public Statement createMoveTargetForOrigStmt() { return (Statement) this.blockRewrite.createMoveTarget(this.origStmt, this.origStmt, null, this.group); } @Override
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the * current list. * The placeholder node can either be inserted as new or used to replace an * existing node. When the document is rewritten, a copy of the source code * for the given node range is inserted into the output document at the position * corresponding to the placeholder (indentation is adjusted). * * @param first the node that starts the range * @param last the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException An exception is thrown if the first or last node * are <code>null</code>, if a node is not a child of the current list or if the first node * is not before the last node. An <code>IllegalArgumentException</code> is * also thrown if the moved range is overlapping with an other moved or copied range. * * @since 3.1 */ public final ASTNode createMoveTarget(ASTNode first, ASTNode last) { return createMoveTarget(first, last, null, null); }
/** * Creates and returns a placeholder node for a move of a range of nodes of the current list.<br> * The placeholder node can either be inserted as new or used to replace an existing node.<br> * When the document is rewritten, a copy of the source code for the given node range is inserted * into the output document at the position corresponding to the placeholder (indentation is * adjusted). * * @param <T> * the type of the provided node * @param first * the node that starts the range * @param last * the node that ends the range * @return the new placeholder node * @throws IllegalArgumentException * An exception is thrown if the first or last node are null, if a node is not a child * of the current list or if the first node is not before the last node. An * IllegalArgumentException is also thrown if the moved range is overlapping with an * other moved or copied range. * @see ListRewrite#createMoveTarget(ASTNode, ASTNode) */ @SuppressWarnings("unchecked") public <T extends ASTNode> T createMoveTarget(T first, T last) { return (T) getListRewrite(first).createMoveTarget(first, last); }
@Override public void insertIfStatement(IfStatement ifStmt, Block thenBlock) { // when stmt declares a local variable (see RearrangeStrategy.create(..)) we need to move all // subsequent statements into the then-block to ensure that the existing declared local is visible: List<ASTNode> blockStmts= this.block.statements(); int stmtIdx= blockStmts.indexOf(this.origStmt); int lastIdx= blockStmts.size()-1; if (stmtIdx != -1 && stmtIdx < lastIdx) { thenBlock.statements() .add(this.blockRewrite.createMoveTarget(blockStmts.get(stmtIdx+1), blockStmts.get(lastIdx), null, this.group)); } super.insertIfStatement(ifStmt, thenBlock); } }
@Override public void insertIfStatement(IfStatement ifStmt, Block thenBlock) { // when stmt declares a local variable (see RearrangeStrategy.create(..)) we need to move all // subsequent statements into the then-block to ensure that the existing declared local is visible: List<ASTNode> blockStmts= this.block.statements(); int stmtIdx= blockStmts.indexOf(this.origStmt); int lastIdx= blockStmts.size()-1; if (stmtIdx != -1 && stmtIdx < lastIdx) { thenBlock.statements() .add(this.blockRewrite.createMoveTarget(blockStmts.get(stmtIdx+1), blockStmts.get(lastIdx), null, this.group)); } super.insertIfStatement(ifStmt, thenBlock); } }
fSelectedNodes[0].getParent(), (ChildListPropertyDescriptor)fSelectedNodes[0].getLocationInParent()); ASTNode toMove= source.createMoveTarget( fSelectedNodes[0], fSelectedNodes[fSelectedNodes.length - 1], replacementNode, null);
List<Statement> list = ((Block) replacement).statements(); int lastIndex = list.size() - 1; moveTarget = listRewrite.createMoveTarget(list.get(0), list.get(lastIndex)); } else { moveTarget = rewrite.createMoveTarget(replacement);
List<Statement> list= ((Block)replacement).statements(); int lastIndex= list.size() - 1; moveTarget= listRewrite.createMoveTarget(list.get(0), list.get(lastIndex)); } else { moveTarget= rewrite.createMoveTarget(replacement);
List<Statement> list= ((Block)replacement).statements(); int lastIndex= list.size() - 1; moveTarget= listRewrite.createMoveTarget(list.get(0), list.get(lastIndex)); } else { moveTarget= rewrite.createMoveTarget(replacement);
fSelectedNodes[0].getParent(), (ChildListPropertyDescriptor)fSelectedNodes[0].getLocationInParent()); ASTNode toMove= source.createMoveTarget( fSelectedNodes[0], fSelectedNodes[fSelectedNodes.length - 1], replacementNode, null);
selectedNodes[0].getParent(), (ChildListPropertyDescriptor)selectedNodes[0].getLocationInParent()); ASTNode toMove= source.createMoveTarget( selectedNodes[0], selectedNodes[selectedNodes.length - 1], replacementNode, substitute);
} else { ListRewrite source = fRewriter.getListRewrite(selectedNodes[0].getParent(), (ChildListPropertyDescriptor) selectedNodes[0].getLocationInParent()); ASTNode toMove = source.createMoveTarget(selectedNodes[0], selectedNodes[selectedNodes.length - 1], replacementNode, substitute); statements.insertLast(toMove, substitute);
selectedNodes[0].getParent(), (ChildListPropertyDescriptor)selectedNodes[0].getLocationInParent()); ASTNode toMove= source.createMoveTarget( selectedNodes[0], selectedNodes[selectedNodes.length - 1], replacementNode, substitute);
selectedNodes[0].getParent(), (ChildListPropertyDescriptor)selectedNodes[0].getLocationInParent()); ASTNode toMove= source.createMoveTarget( selectedNodes[0], selectedNodes[selectedNodes.length - 1], replacementNode, substitute);