private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childListProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childListProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childListProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childListProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childListProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove, ASTNode replacingNode, TextEditGroup editGroup) { if (first == null || last == null) { throw new IllegalArgumentException(); } NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } Block internalPlaceHolder= nodeStore.createCollapsePlaceholder(); CopySourceInfo info= getRewriteStore().createRangeCopy(this.parent, this.childProperty, first, last, isMove, internalPlaceHolder, replacingNode, editGroup); nodeStore.markAsCopyTarget(placeholder, info); return placeholder; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }
/** * Creates and returns a node that represents a sequence of nodes. * Each of the given nodes must be either be brand new (not part of the original AST), or * a placeholder node (for example, one created by {@link #createCopyTarget(ASTNode)} * or {@link #createStringPlaceholder(String, int)}), or another group node. * The type of the returned node is unspecified. The returned node can be used * to replace an existing node (or as an element of another group node). * When the document is rewritten, the source code for each of the given nodes is * inserted, in order, into the output document at the position corresponding to the * group (indentation is adjusted). * * @param targetNodes the nodes to go in the group * @return the new group node * @throws IllegalArgumentException if the targetNodes is <code>null</code> or empty * @since 3.1 */ public final ASTNode createGroupNode(ASTNode[] targetNodes) { if (targetNodes == null || targetNodes.length == 0) { throw new IllegalArgumentException(); } Block res= getNodeStore().createCollapsePlaceholder(); ListRewrite listRewrite= getListRewrite(res, Block.STATEMENTS_PROPERTY); for (int i= 0; i < targetNodes.length; i++) { listRewrite.insertLast(targetNodes[i], null); } return res; }