void preRemoveChildEvent(ASTNode node, ASTNode child, StructuralPropertyDescriptor property) { if (property.isChildProperty()) { NodeRewriteEvent event = getNodeEvent(node, property); event.setNewValue(null); } else if (property.isChildListProperty()) { ListRewriteEvent event = getListEvent(node, property); int i = event.getIndex(child, ListRewriteEvent.NEW); NodeRewriteEvent nodeEvent = (NodeRewriteEvent) event.getChildren()[i]; if (nodeEvent.getOriginalValue() == null) { event.revertChange(nodeEvent); } else { nodeEvent.setNewValue(null); } } }
void preReplaceChildEvent( ASTNode node, ASTNode child, ASTNode newChild, StructuralPropertyDescriptor property) { if (property.isChildProperty()) { NodeRewriteEvent event = getNodeEvent(node, property); event.setNewValue(newChild); if (newChild != null) { markAsMoveOrCopyTarget(node, newChild); } } else if (property.isChildListProperty()) { ListRewriteEvent event = getListEvent(node, property); int i = event.getIndex(child, ListRewriteEvent.NEW); NodeRewriteEvent nodeEvent = (NodeRewriteEvent) event.getChildren()[i]; nodeEvent.setNewValue(newChild); if (newChild != null) { markAsMoveOrCopyTarget(node, newChild); } } }