|
Eclipse JDT Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.core.dom.rewrite.ListRewrite
For describing manipulations to a child list property of an AST node.
This class is not intended to be subclassed.
ASTRewrite.getListRewrite(ASTNode, ChildListPropertyDescriptor)
Method Summary | |
---|---|
ASTNode |
createCopyTarget(ASTNode first,
ASTNode last)
Creates and returns a placeholder node for a true copy of a range of nodes of the current list. |
ASTNode |
createMoveTarget(ASTNode first,
ASTNode last)
Creates and returns a placeholder node for a move of a range of nodes of the current list. |
ASTNode |
createMoveTarget(ASTNode first,
ASTNode last,
ASTNode replacingNode,
TextEditGroup editGroup)
Creates and returns a placeholder node for a move of a range of nodes of the current list. |
ASTRewrite |
getASTRewrite()
Returns the ASTRewrite instance from which this ListRewriter has been created from. |
StructuralPropertyDescriptor |
getLocationInParent()
Returns the property of the parent node for which this list rewriter was created. |
List |
getOriginalList()
Returns the original nodes in the list property managed by this rewriter. |
ASTNode |
getParent()
Returns the parent of the list for which this list rewriter was created. |
List |
getRewrittenList()
Returns the nodes in the revised list property managed by this rewriter. |
void |
insertAfter(ASTNode node,
ASTNode element,
TextEditGroup editGroup)
Inserts the given node into the list after the given element. |
void |
insertAt(ASTNode node,
int index,
TextEditGroup editGroup)
Inserts the given node into the list at the given index. |
void |
insertBefore(ASTNode node,
ASTNode element,
TextEditGroup editGroup)
Inserts the given node into the list before the given element. |
void |
insertFirst(ASTNode node,
TextEditGroup editGroup)
Inserts the given node into the list at the start of the list. |
void |
insertLast(ASTNode node,
TextEditGroup editGroup)
Inserts the given node into the list at the end of the list. |
void |
remove(ASTNode node,
TextEditGroup editGroup)
Removes the given node from its parent's list property in the rewriter. |
void |
replace(ASTNode node,
ASTNode replacement,
TextEditGroup editGroup)
Replaces the given node from its parent's list property in the rewriter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public ASTNode getParent()
getLocationInParent()
public StructuralPropertyDescriptor getLocationInParent()
getParent()
public void remove(ASTNode node, TextEditGroup editGroup)
node
- the node being removededitGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node is null, or if the node is not
part of this rewriter's AST, or if the described modification is invalid
(not a member of this node's original list)public ASTRewrite getASTRewrite()
public void replace(ASTNode node, ASTNode replacement, TextEditGroup editGroup)
ASTRewrite.createCopyTarget(ASTNode)
,
ASTRewrite.createMoveTarget(ASTNode)
,
or ASTRewrite.createStringPlaceholder(String, int)
). The AST itself
is not actually modified in any way; rather, the rewriter just records
a note that this node has been replaced in this list.
node
- the node being replacedreplacement
- the replacement node, or null
if no
replacementeditGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node is null, or if the node is not part
of this rewriter's AST, or if the replacement node is not a new node (or
placeholder), or if the described modification is otherwise invalid
(not a member of this node's original list)public void insertAfter(ASTNode node, ASTNode element, TextEditGroup editGroup)
ASTRewrite.createCopyTarget(ASTNode)
,
ASTRewrite.createMoveTarget(ASTNode)
,
or ASTRewrite.createStringPlaceholder(String, int)
). The AST itself
is not actually modified in any way; rather, the rewriter just records
a note that this node has been inserted into the list.
node
- the node to insertelement
- the element after which the given node is to be insertededitGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node or element is null,
or if the node is not part of this rewriter's AST, or if the inserted node
is not a new node (or placeholder), or if element
is not a member
of the list (original or new), or if the described modification is
otherwise invalidpublic void insertBefore(ASTNode node, ASTNode element, TextEditGroup editGroup)
ASTRewrite.createCopyTarget(ASTNode)
,
ASTRewrite.createMoveTarget(ASTNode)
,
or ASTRewrite.createStringPlaceholder(String, int)
). The AST itself
is not actually modified in any way; rather, the rewriter just records
a note that this node has been inserted into the list.
node
- the node to insertelement
- the element before which the given node is to be insertededitGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node or element is null,
or if the node is not part of this rewriter's AST, or if the inserted node
is not a new node (or placeholder), or if element
is not a member
of the list (original or new), or if the described modification is
otherwise invalidpublic void insertFirst(ASTNode node, TextEditGroup editGroup)
insertAt(node, 0, editGroup)
.
node
- the node to inserteditGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node is null, or if the node is not part
of this rewriter's AST, or if the inserted node is not a new node (or
placeholder), or if the described modification is otherwise invalid
(not a member of this node's original list)insertAt(ASTNode, int, TextEditGroup)
public void insertLast(ASTNode node, TextEditGroup editGroup)
insertAt(node, -1, editGroup)
.
node
- the node to inserteditGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node is null, or if the node is not part
of this rewriter's AST, or if the inserted node is not a new node (or
placeholder), or if the described modification is otherwise invalid
(not a member of this node's original list)insertAt(ASTNode, int, TextEditGroup)
public void insertAt(ASTNode node, int index, TextEditGroup editGroup)
ASTRewrite.createCopyTarget(ASTNode)
,
ASTRewrite.createMoveTarget(ASTNode)
,
or ASTRewrite.createStringPlaceholder(String, int)
). The AST itself
is not actually modified in any way; rather, the rewriter just records
a note that this node has been inserted into the list.
node
- the node to insertindex
- insertion index in the combined list of original and
inserted nodes; -1
indicates insertion as the last elementeditGroup
- the edit group in which to collect the corresponding
text edits, or null
if ungrouped
IllegalArgumentException
- if the node is null, or if the node is not part
of this rewriter's AST, or if the inserted node is not a new node (or
placeholder), or if the described modification is otherwise invalid
(not a member of this node's original list)
IndexOutOfBoundsException
- if the index is negative and not -1,
or if it is larger than the size of the combined listpublic final ASTNode createCopyTarget(ASTNode first, ASTNode last)
first
- the node that starts the rangelast
- the node that ends the range
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 copied range is overlapping with an other moved or copied range.public final ASTNode createMoveTarget(ASTNode first, ASTNode last)
first
- the node that starts the rangelast
- the node that ends the range
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.public final ASTNode createMoveTarget(ASTNode first, ASTNode last, ASTNode replacingNode, TextEditGroup editGroup)
first
- the node that starts the rangelast
- the node that ends the rangereplacingNode
- a node that is set at the location of the moved nodes
or null
to remove all nodeseditGroup
- the edit group in which to collect the corresponding
text edits fro a replace, or null
if ungrouped
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.public List getOriginalList()
public List getRewrittenList()
|
Eclipse JDT Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |