use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project elk by eclipse.
the class GraphvizDotSerializer method serialize.
@Override
protected void serialize(EObject obj, Appendable appendable, SaveOptions options) throws IOException {
ITextRegionAccess regionAccess = serializeToRegions(obj);
FormatterRequest request = formatterRequestProvider.get();
MapBasedPreferenceValues preferences = new MapBasedPreferenceValues(Maps.<String, String>newLinkedHashMap());
preferences.put(FormatterPreferenceKeys.maxLineWidth, MAX_LINE_LENGTH);
request.setPreferences(preferences);
request.setFormatUndefinedHiddenRegionsOnly(!options.isFormatting());
request.setTextRegionAccess(regionAccess);
IFormatter2 formatter2 = formatter2Provider.get();
List<ITextReplacement> replacements = formatter2.format(request);
regionAccess.getRewriter().renderToAppendable(replacements, appendable);
}
Aggregations