use of org.eclipse.jdt.internal.core.util.SimpleDocument in project eclipse.jdt.ls by eclipse.
the class TextEditConverter method applySourceModifier.
private String applySourceModifier(String content, ISourceModifier modifier) {
if (StringUtils.isBlank(content) || modifier == null) {
return content;
}
SimpleDocument subDocument = new SimpleDocument(content);
TextEdit newEdit = new MultiTextEdit(0, subDocument.getLength());
ReplaceEdit[] replaces = modifier.getModifications(content);
for (ReplaceEdit replace : replaces) {
newEdit.addChild(replace);
}
try {
newEdit.apply(subDocument, TextEdit.NONE);
} catch (BadLocationException e) {
JavaLanguageServerPlugin.logException("Error applying edit to document", e);
}
return subDocument.get();
}
Aggregations