use of com.intellij.diff.util.MergeConflictType in project intellij-community by JetBrains.
the class SimpleThreesideTextDiffProvider method compare.
@NotNull
public List<FineMergeLineFragment> compare(@NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull CharSequence text3, @NotNull ProgressIndicator indicator) {
IgnorePolicy ignorePolicy = getIgnorePolicy();
HighlightPolicy highlightPolicy = getHighlightPolicy();
ComparisonPolicy comparisonPolicy = ignorePolicy.getComparisonPolicy();
List<CharSequence> sequences = ContainerUtil.list(text1, text2, text3);
List<LineOffsets> lineOffsets = ContainerUtil.map(sequences, LineOffsets::create);
indicator.checkCanceled();
List<MergeLineFragment> lineFragments = ComparisonManager.getInstance().compareLines(text1, text2, text3, comparisonPolicy, indicator);
indicator.checkCanceled();
List<FineMergeLineFragment> result = new ArrayList<>(lineFragments.size());
for (MergeLineFragment fragment : lineFragments) {
MergeConflictType conflictType = DiffUtil.getLineMergeType(fragment, sequences, lineOffsets, comparisonPolicy);
MergeInnerDifferences innerDifferences;
if (highlightPolicy.isFineFragments()) {
List<CharSequence> chunks = getChunks(fragment, sequences, lineOffsets, conflictType);
innerDifferences = DiffUtil.compareThreesideInner(chunks, comparisonPolicy, indicator);
} else {
innerDifferences = null;
}
result.add(new FineMergeLineFragmentImpl(fragment, conflictType, innerDifferences));
}
return result;
}
Aggregations