Class RewriteEventStore
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite.RewriteEventStore
Stores all rewrite events, descriptions of events and knows which nodes
are copy or move sources or tracked.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
Interface that allows to override the way how children are accessed from a parent.static final class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEvent
(ASTNode parent, StructuralPropertyDescriptor childProperty, RewriteEvent event) void
clear()
createRangeCopy
(ASTNode parent, StructuralPropertyDescriptor childProperty, ASTNode first, ASTNode last, boolean isMove, ASTNode internalPlaceholder, ASTNode replacingNode, org.eclipse.text.edits.TextEditGroup editGroup) Kind is either ORIGINAL, NEW, or BOTHgetChangedPropertieEvents
(ASTNode parent) int
getChangeKind
(ASTNode node) getEvent
(ASTNode parent, StructuralPropertyDescriptor property) org.eclipse.text.edits.TextEditGroup
getEventEditGroup
(RewriteEvent event) getListEvent
(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) getNewValue
(ASTNode parent, StructuralPropertyDescriptor property) getNodeCopySources
(ASTNode node) getNodeEvent
(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) getOriginalValue
(ASTNode parent, StructuralPropertyDescriptor property) getPropertyLocation
(Object value, int kind) final org.eclipse.text.edits.TextEditGroup
getTrackedNodeData
(ASTNode node) boolean
hasChangedProperties
(ASTNode parent) internalGetCopySources
(List copySources, ASTNode node) boolean
static boolean
final boolean
markAsCopySource
(ASTNode parent, StructuralPropertyDescriptor property, ASTNode node, boolean isMove) final void
markAsTracked
(ASTNode node, org.eclipse.text.edits.TextEditGroup editGroup) Marks a node as tracked.void
prepareMovedNodes
(TargetSourceRangeComputer sourceRangeComputer) void
void
setEventEditGroup
(RewriteEvent event, org.eclipse.text.edits.TextEditGroup editGroup) void
void
setNodePropertyMapper
(RewriteEventStore.INodePropertyMapper nodePropertyMapper) Override the default way how to access children from a parent node.void
setTrackedNodeData
(ASTNode node, org.eclipse.text.edits.TextEditGroup editGroup) toString()
-
Field Details
-
DEBUG
public static boolean DEBUGDebug AST rewrite events.If enabled, then
ASTRewrite
andListRewrite
throw anIllegalArgumentException
if a rewrite operation tries to insert an AST node in a place where nodes of this type are not allowed (node type not a subtype of the structural property's type).Disabled by default, since this hasn't been enforced from the beginning, and there are clients (e.g. in JDT UI refactorings) that rely on a bit of leeway here. E.g. the qualifier of a QualifiedName cannot be a MethodInvocation expression or a SimpleType, but that's sometimes the easiest solution for such a change, and ASTRewrite has no problems with it.
-
NEW
public static final int NEW- See Also:
-
ORIGINAL
public static final int ORIGINAL- See Also:
-
BOTH
public static final int BOTH- See Also:
-
-
Constructor Details
-
RewriteEventStore
public RewriteEventStore()
-
-
Method Details
-
setNodePropertyMapper
Override the default way how to access children from a parent node.- Parameters:
nodePropertyMapper
- The newINodePropertyMapper
ornull
. to use the default.
-
clear
public void clear() -
addEvent
public void addEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, RewriteEvent event) -
getEvent
-
getNodeEvent
public NodeRewriteEvent getNodeEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) -
getListEvent
public ListRewriteEvent getListEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) -
getChangeRootIterator
-
hasChangedProperties
-
getPropertyLocation
-
findEvent
Kind is either ORIGINAL, NEW, or BOTH- Returns:
- Returns the event with the given value of
null
.
-
getOriginalValue
-
getNewValue
-
getChangedPropertieEvents
-
getChangeKind
-
getEventEditGroup
-
setEventEditGroup
-
getTrackedNodeData
-
setTrackedNodeData
-
markAsTracked
Marks a node as tracked. The edits added to the group editGroup can be used to get the position of the node after the rewrite operation.- Parameters:
node
- The node to trackeditGroup
- Collects the range markers describing the node position.
-
markAsCopySource
public final RewriteEventStore.CopySourceInfo markAsCopySource(ASTNode parent, StructuralPropertyDescriptor property, ASTNode node, boolean isMove) -
isRangeCopyPlaceholder
-
createRangeCopy
public final RewriteEventStore.CopySourceInfo createRangeCopy(ASTNode parent, StructuralPropertyDescriptor childProperty, ASTNode first, ASTNode last, boolean isMove, ASTNode internalPlaceholder, ASTNode replacingNode, org.eclipse.text.edits.TextEditGroup editGroup) -
getNodeCopySources
-
internalGetCopySources
-
prepareMovedNodes
-
revertMovedNodes
public void revertMovedNodes() -
isInsertBoundToPrevious
-
setInsertBoundToPrevious
-
toString
-
isNewNode
-