if (numRegions < regions.length) {
regions = Arrays.copyOf(regions, numRegions);
}
// Calculate formatting changes for the regions after the refactoring changes.
final ICProject project = tu.getCProject();
final Map<String, Object> options = new HashMap<String, Object>(project.getOptions(true));
options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
// Allow all comments to be indented.
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.FALSE);
final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
code = document.get();