Runnable (boolean isContentsEqual, CharSequence @NotNull [] texts, @NotNull List<ToggleableLineRange> toggleableLineRanges) { List<SimpleDiffChange> changes = new ArrayList<>(); for (ToggleableLineRange toggleableLineRange : toggleableLineRanges) { LineFragmentData data = toggleableLineRange.getFragmentData(); boolean isSkipped = data.isSkipped(); boolean isExcluded = data.isExcluded(myAllowExcludeChangesFromCommit); for (LineFragment fragment : toggleableLineRange.getFragments()) { changes.add(new MySimpleDiffChange(changes.size(), fragment, isExcluded, isSkipped, data.getChangelistId(), data.isPartiallyExcluded(), data.getExclusionState())); } } Runnable applyChanges = apply(changes, isContentsEqual); Runnable applyGutterExcludeOperations = applyGutterOperations(toggleableLineRanges); return () -> { applyChanges.run(); applyGutterExcludeOperations.run(); }; }