if (model != null && parent != null) {
model.beginRecording(textView);
parent.insertBefore(selection, prevSib);
formatter.formatNode(selection);
formatter.formatNode(selection.getParentNode());
model.endRecording(textView);
if (treeViewer != null) {
treeViewer.setSelection(new StructuredSelection(selection));
}
}
}