TextRegion regionToFormat = new TextRegion(replacementNode.getOffset(), replacementNode.getLength());
// Override temporarily to have formatting turned on
// GAH - this is just ridiculous internal DSL junk to set a single boolean
options = SaveOptions.newBuilder().format().getOptions();
ReplaceRegion r = domFormatter.format(
root, regionToFormat,
formattingContextFactory.create(obj.eResource().getContents().get(0), formatting(options)));
// String text = serialize(obj.eContainer(), options, new TextRegion(node.getOffset(), node.getLength()));
return new ReplaceRegion(node.getTotalOffset(), node.getTotalLength(), r.getText());
}
finally {
if(alreadyEnteredResourceScope)
resourceScope.exit();
}