final List<ASTModification> modifications = getModifications(node, ModificationKind.APPEND_CHILD);
if (modifications.isEmpty()) {
return;
}
final ChangeGeneratorWriterVisitor writer = new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
final ReplaceEdit anchor = getAppendAnchor(node);
Assert.isNotNull(anchor);
IASTNode precedingNode = getLastNodeBeforeAppendPoint(node);
for (final ASTModification modification : modifications) {
final IASTNode newNode = modification.getNewNode();
if (precedingNode != null) {
if (ASTWriter.requireBlankLineInBetween(precedingNode, newNode)) {
writer.newLine();
}
} else if (node instanceof ICPPASTNamespaceDefinition) {
writer.newLine();
}
precedingNode = null;
newNode.accept(writer);
}
if (node instanceof ICPPASTNamespaceDefinition) {
writer.newLine();
}
addToRootEdit(node);
final String code = writer.toString();
if (!code.isEmpty()) {
addChildEdit(new InsertEdit(anchor.getOffset(), code));
}
addChildEdit(new ReplaceEdit(anchor.getOffset(), anchor.getLength(), anchor.getText()));
processedOffset = endOffset(node);
}