Search in sources :

Example 6 with LineFragment

use of com.intellij.openapi.diff.impl.fragments.LineFragment in project intellij-community by JetBrains.

the class SimpleDiffPanelState method addMarkup.

private LineBlocks addMarkup(final List<LineFragment> lines) {
    ApplicationManager.getApplication().runWriteAction(() -> {
        final FragmentHighlighterImpl fragmentHighlighter = new FragmentHighlighterImpl(myAppender1, myAppender2);
        for (Iterator<LineFragment> iterator = lines.iterator(); iterator.hasNext(); ) {
            LineFragment line = iterator.next();
            fragmentHighlighter.setIsLast(!iterator.hasNext());
            line.highlight(fragmentHighlighter);
        }
    });
    ArrayList<LineFragment> allLineFragments = new ArrayList<>();
    for (LineFragment lineFragment : lines) {
        allLineFragments.add(lineFragment);
        lineFragment.addAllDescendantsTo(allLineFragments);
    }
    myFragmentList = FragmentListImpl.fromList(allLineFragments);
    return LineBlocks.fromLineFragments(allLineFragments);
}
Also used : LineFragment(com.intellij.openapi.diff.impl.fragments.LineFragment) FragmentHighlighterImpl(com.intellij.openapi.diff.impl.fragments.FragmentHighlighterImpl) ArrayList(java.util.ArrayList)

Aggregations

LineFragment (com.intellij.openapi.diff.impl.fragments.LineFragment)6 TextRange (com.intellij.openapi.util.TextRange)3 DiffFragment (com.intellij.openapi.diff.ex.DiffFragment)2 TextDiffTypeEnum (com.intellij.openapi.diff.impl.util.TextDiffTypeEnum)2 ArrayList (java.util.ArrayList)2 Fragment (com.intellij.openapi.diff.impl.fragments.Fragment)1 FragmentHighlighterImpl (com.intellij.openapi.diff.impl.fragments.FragmentHighlighterImpl)1 DiffString (com.intellij.openapi.diff.impl.string.DiffString)1 TextDiffType (com.intellij.openapi.diff.impl.util.TextDiffType)1 Editor (com.intellij.openapi.editor.Editor)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 FilesTooBigForDiffException (com.intellij.util.diff.FilesTooBigForDiffException)1 NotNull (org.jetbrains.annotations.NotNull)1