use of com.intellij.diff.tools.util.base.HighlightPolicy in project intellij-community by JetBrains.
the class TwosideTextDiffProviderBase method compare.
@Nullable
@Override
public List<LineFragment> compare(@NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull ProgressIndicator indicator) {
IgnorePolicy ignorePolicy = getIgnorePolicy();
HighlightPolicy highlightPolicy = getHighlightPolicy();
if (!highlightPolicy.isShouldCompare())
return null;
ComparisonPolicy policy = ignorePolicy.getComparisonPolicy();
boolean innerFragments = highlightPolicy.isFineFragments();
boolean squashFragments = highlightPolicy.isShouldSquash();
boolean trimFragments = ignorePolicy.isShouldTrimChunks();
indicator.checkCanceled();
List<LineFragment> fragments = doCompare(text1, text2, ignorePolicy, innerFragments, indicator);
indicator.checkCanceled();
return ComparisonManager.getInstance().processBlocks(fragments, text1, text2, policy, squashFragments, trimFragments);
}
use of com.intellij.diff.tools.util.base.HighlightPolicy 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