return result;
}
private void applyDiffPresentation(SourceViewer oldViewer, SourceViewer newViewer,
UpdatableScript.TextualDiff textualDiff) {
TextPresentation oldPresentation = new TextPresentation();
TextPresentation newPresentation = new TextPresentation();
List<Long> chunkNumbers = textualDiff.getChunks();
int posOld = 0;
int posNew = 0;
for (int i = 0; i < chunkNumbers.size(); i += 3) {
int startOld = chunkNumbers.get(i + 0).intValue();
int endOld = chunkNumbers.get(i + 1).intValue();
int endNew = chunkNumbers.get(i + 2).intValue();
int startNew = startOld - posOld + posNew;
if (startOld == endOld) {
// Add
newPresentation.addStyleRange(new StyleRange(startNew, endNew - startNew,
null, colors.get(ColorName.ADDED_BACKGROUND)));
} else if (startNew == endNew) {
// Remove
oldPresentation.addStyleRange(new StyleRange(startOld, endOld - startOld,
null, colors.get(ColorName.ADDED_BACKGROUND)));
} else {
// Replace
newPresentation.addStyleRange(new StyleRange(startNew, endNew - startNew,
null, colors.get(ColorName.CHANGED_BACKGROUND)));
oldPresentation.addStyleRange(new StyleRange(startOld, endOld - startOld,
null, colors.get(ColorName.CHANGED_BACKGROUND)));
}