/** * Creates and returns a placeholder node for a source string that is to be inserted into * the output document at the position corresponding to the placeholder. * The string will be inserted without being reformatted beyond correcting * the indentation level. The placeholder node can either be inserted as new or * used to replace an existing node. * * @param code the string to be inserted; lines should should not have extra indentation * @param nodeType the ASTNode type that corresponds to the passed code. * @return the new placeholder node * @throws IllegalArgumentException if the code is null, or if the node * type is invalid */ public final ASTNode createStringPlaceholder(String code, int nodeType) { if (code == null) { throw new IllegalArgumentException(); } ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType); if (placeholder == null) { throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$ } getNodeStore().markAsStringPlaceholder(placeholder, code); return placeholder; }
/** * Creates and returns a placeholder node for a source string that is to be inserted into * the output document at the position corresponding to the placeholder. * The string will be inserted without being reformatted beyond correcting * the indentation level. The placeholder node can either be inserted as new or * used to replace an existing node. * * @param code the string to be inserted; lines should should not have extra indentation * @param nodeType the ASTNode type that corresponds to the passed code. * @return the new placeholder node * @throws IllegalArgumentException if the code is null, or if the node * type is invalid */ public final ASTNode createStringPlaceholder(String code, int nodeType) { if (code == null) { throw new IllegalArgumentException(); } ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType); if (placeholder == null) { throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$ } getNodeStore().markAsStringPlaceholder(placeholder, code); return placeholder; }
/** * Creates and returns a placeholder node for a source string that is to be inserted into * the output document at the position corresponding to the placeholder. * The string will be inserted without being reformatted beyond correcting * the indentation level. The placeholder node can either be inserted as new or * used to replace an existing node. * * @param code the string to be inserted; lines should should not have extra indentation * @param nodeType the ASTNode type that corresponds to the passed code. * @return the new placeholder node * @throws IllegalArgumentException if the code is null, or if the node * type is invalid */ public final ASTNode createStringPlaceholder(String code, int nodeType) { if (code == null) { throw new IllegalArgumentException(); } ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType); if (placeholder == null) { throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$ } getNodeStore().markAsStringPlaceholder(placeholder, code); return placeholder; }
/** * Creates and returns a placeholder node for a source string that is to be inserted into * the output document at the position corresponding to the placeholder. * The string will be inserted without being reformatted beyond correcting * the indentation level. The placeholder node can either be inserted as new or * used to replace an existing node. * * @param code the string to be inserted; lines should should not have extra indentation * @param nodeType the ASTNode type that corresponds to the passed code. * @return the new placeholder node * @throws IllegalArgumentException if the code is null, or if the node * type is invalid */ public final ASTNode createStringPlaceholder(String code, int nodeType) { if (code == null) { throw new IllegalArgumentException(); } ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType); if (placeholder == null) { throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$ } getNodeStore().markAsStringPlaceholder(placeholder, code); return placeholder; }
/** * Creates and returns a placeholder node for a source string that is to be inserted into * the output document at the position corresponding to the placeholder. * The string will be inserted without being reformatted beyond correcting * the indentation level. The placeholder node can either be inserted as new or * used to replace an existing node. * * @param code the string to be inserted; lines should should not have extra indentation * @param nodeType the ASTNode type that corresponds to the passed code. * @return the new placeholder node * @throws IllegalArgumentException if the code is null, or if the node * type is invalid */ public final ASTNode createStringPlaceholder(String code, int nodeType) { if (code == null) { throw new IllegalArgumentException(); } ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType); if (placeholder == null) { throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$ } getNodeStore().markAsStringPlaceholder(placeholder, code); 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 node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().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 node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().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; }
private ASTNode createTargetNode(ASTNode node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().markAsCopyTarget(placeholder, info); return placeholder; }
private ASTNode createTargetNode(ASTNode node, boolean isMove) { if (node == null) { throw new IllegalArgumentException(); } validateIsExistingNode(node); validateIsCorrectAST(node); CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove); ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType()); if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$ } getNodeStore().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; }