mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: move helper classes to upper level
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.diff.util;
|
||||
|
||||
public class IntPair {
|
||||
public final int val1;
|
||||
public final int val2;
|
||||
|
||||
public IntPair(int val1, int val2) {
|
||||
this.val1 = val1;
|
||||
this.val2 = val2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
IntPair pair = (IntPair)o;
|
||||
|
||||
if (val1 != pair.val1) return false;
|
||||
if (val2 != pair.val2) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = val1;
|
||||
result = 31 * result + val2;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + val1 + ", " + val2 + "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.diff.util;
|
||||
|
||||
public class LineRange {
|
||||
public final int start;
|
||||
public final int end;
|
||||
|
||||
public LineRange(int start, int end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public boolean contains(int start, int end) {
|
||||
return this.start <= start && this.end >= end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
LineRange range = (LineRange)o;
|
||||
|
||||
if (start != range.start) return false;
|
||||
if (end != range.end) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = start;
|
||||
result = 31 * result + end;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + start + ", " + end + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.diff.util;
|
||||
|
||||
public class Range {
|
||||
public final int start1;
|
||||
public final int end1;
|
||||
public final int start2;
|
||||
public final int end2;
|
||||
|
||||
public Range(int start1, int end1, int start2, int end2) {
|
||||
this.start1 = start1;
|
||||
this.end1 = end1;
|
||||
this.start2 = start2;
|
||||
this.end2 = end2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Range range = (Range)o;
|
||||
|
||||
if (start1 != range.start1) return false;
|
||||
if (end1 != range.end1) return false;
|
||||
if (start2 != range.start2) return false;
|
||||
if (end2 != range.end2) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = start1;
|
||||
result = 31 * result + end1;
|
||||
result = 31 * result + start2;
|
||||
result = 31 * result + end2;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + start1 + ", " + end1 + ") - [" + start2 + ", " + end2 + ")";
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ package com.intellij.diff.comparison;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterable;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
package com.intellij.diff.comparison;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.ChangeBuilder;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.IntPair;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
import com.intellij.diff.fragments.LineFragmentImpl;
|
||||
import com.intellij.diff.util.IntPair;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.diff.comparison.iterables.DiffIterable;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.*;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.fragments.DiffFragment;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
|
||||
@@ -19,8 +19,8 @@ import com.intellij.diff.comparison.ByChar.Char;
|
||||
import com.intellij.diff.comparison.ByLine.Line;
|
||||
import com.intellij.diff.comparison.ByLine.LineWrapper;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.fragments.DiffFragment;
|
||||
import com.intellij.diff.fragments.DiffFragmentImpl;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
import com.intellij.diff.fragments.LineFragmentImpl;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
|
||||
@@ -18,8 +18,8 @@ package com.intellij.diff.comparison;
|
||||
import com.intellij.diff.comparison.ByWord.InlineChunk;
|
||||
import com.intellij.diff.comparison.ByWord.NewlineChunk;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.comparison.iterables.FairDiffIterable;
|
||||
import com.intellij.diff.fragments.MergeLineFragment;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.diff.util.ThreeSide;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.IntPair;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.IntPair;
|
||||
import com.intellij.diff.util.Range;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
+1
-44
@@ -18,6 +18,7 @@ package com.intellij.diff.comparison.iterables;
|
||||
import com.intellij.diff.comparison.DiffTooBigException;
|
||||
import com.intellij.diff.fragments.DiffFragment;
|
||||
import com.intellij.diff.fragments.DiffFragmentImpl;
|
||||
import com.intellij.diff.util.Range;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -311,48 +312,4 @@ public class DiffIterableUtil {
|
||||
return create(myFirstChange, myLength1, myLength2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Range {
|
||||
public final int start1;
|
||||
public final int end1;
|
||||
public final int start2;
|
||||
public final int end2;
|
||||
|
||||
public Range(int start1, int end1, int start2, int end2) {
|
||||
this.start1 = start1;
|
||||
this.end1 = end1;
|
||||
this.start2 = start2;
|
||||
this.end2 = end2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class IntPair {
|
||||
public final int val1;
|
||||
public final int val2;
|
||||
|
||||
public IntPair(int val1, int val2) {
|
||||
this.val1 = val1;
|
||||
this.val2 = val2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
IntPair pair = (IntPair)o;
|
||||
|
||||
if (val1 != pair.val1) return false;
|
||||
if (val2 != pair.val2) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = val1;
|
||||
result = 31 * result + val2;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.diff.comparison.iterables;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.Range;
|
||||
import com.intellij.diff.util.Range;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.diff.actions.BufferedLineIterator;
|
||||
import com.intellij.diff.actions.NavigationContextChecker;
|
||||
import com.intellij.diff.actions.impl.OpenInEditorWithMouseAction;
|
||||
import com.intellij.diff.comparison.DiffTooBigException;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.IntPair;
|
||||
import com.intellij.diff.contents.DiffContent;
|
||||
import com.intellij.diff.contents.DocumentContent;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
@@ -34,13 +33,10 @@ import com.intellij.diff.tools.util.base.HighlightPolicy;
|
||||
import com.intellij.diff.tools.util.base.IgnorePolicy;
|
||||
import com.intellij.diff.tools.util.base.TextDiffViewerBase;
|
||||
import com.intellij.diff.tools.util.twoside.TwosideTextDiffViewer;
|
||||
import com.intellij.diff.util.DiffUserDataKeys;
|
||||
import com.intellij.diff.util.DiffUserDataKeysEx;
|
||||
import com.intellij.diff.util.*;
|
||||
import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.diff.util.DiffUtil.DocumentData;
|
||||
import com.intellij.diff.util.DiffUtil.EditorsVisiblePositions;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.Separator;
|
||||
@@ -219,7 +215,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
data.getRangeHighlighter(), content.getContentType(),
|
||||
convertor.createConvertor1(), null);
|
||||
|
||||
return apply(editorData, blocks, convertor, Collections.singletonList(new IntPair(0, data.getLines())), false);
|
||||
return apply(editorData, blocks, convertor, Collections.singletonList(new LineRange(0, data.getLines())), false);
|
||||
}
|
||||
|
||||
if (myActualContent2 == null) {
|
||||
@@ -245,7 +241,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
data.getRangeHighlighter(), content.getContentType(),
|
||||
convertor.createConvertor2(), null);
|
||||
|
||||
return apply(editorData, blocks, convertor, Collections.singletonList(new IntPair(0, data.getLines())), false);
|
||||
return apply(editorData, blocks, convertor, Collections.singletonList(new LineRange(0, data.getLines())), false);
|
||||
}
|
||||
|
||||
final DocumentContent content1 = myActualContent1;
|
||||
@@ -290,7 +286,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
FileType fileType = content2.getContentType() == null ? content1.getContentType() : content2.getContentType();
|
||||
|
||||
LineNumberConvertor convertor = builder.getConvertor();
|
||||
List<IntPair> changedLines = builder.getChangedLines();
|
||||
List<LineRange> changedLines = builder.getChangedLines();
|
||||
boolean isEqual = builder.isEqual();
|
||||
|
||||
CombinedEditorData editorData = new CombinedEditorData(builder.getText(), data.getHighlighter(), data.getRangeHighlighter(), fileType,
|
||||
@@ -355,7 +351,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
private Runnable apply(@NotNull final CombinedEditorData data,
|
||||
@NotNull final List<ChangedBlock> blocks,
|
||||
@NotNull final LineNumberConvertor convertor,
|
||||
@NotNull final List<IntPair> changedLines,
|
||||
@NotNull final List<LineRange> changedLines,
|
||||
final boolean isEqual) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
@@ -1078,15 +1074,15 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
|
||||
super(new EditorEx[]{editor}, disposable);
|
||||
}
|
||||
|
||||
public void install(@Nullable List<IntPair> changedLines,
|
||||
public void install(@Nullable List<LineRange> changedLines,
|
||||
@NotNull UserDataHolder context,
|
||||
@NotNull FoldingModelSupport.Settings settings) {
|
||||
Iterator<int[]> it = map(changedLines, new Function<IntPair, int[]>() {
|
||||
Iterator<int[]> it = map(changedLines, new Function<LineRange, int[]>() {
|
||||
@Override
|
||||
public int[] fun(IntPair line) {
|
||||
public int[] fun(LineRange line) {
|
||||
return new int[]{
|
||||
line.val1,
|
||||
line.val2};
|
||||
line.start,
|
||||
line.end};
|
||||
}
|
||||
});
|
||||
install(it, context, settings);
|
||||
|
||||
+4
-4
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.intellij.diff.tools.fragmented;
|
||||
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil.IntPair;
|
||||
import com.intellij.diff.fragments.DiffFragment;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
import com.intellij.diff.util.LineRange;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -38,7 +38,7 @@ public class OnesideFragmentBuilder {
|
||||
@NotNull private final List<ChangedBlock> myBlocks = new ArrayList<ChangedBlock>();
|
||||
@NotNull private final List<HighlightRange> myRanges = new ArrayList<HighlightRange>();
|
||||
@NotNull private final LineNumberConvertor.Builder myConvertor = new LineNumberConvertor.Builder();
|
||||
@NotNull private final List<IntPair> myChangedLines = new ArrayList<IntPair>();
|
||||
@NotNull private final List<LineRange> myChangedLines = new ArrayList<LineRange>();
|
||||
|
||||
public OnesideFragmentBuilder(@NotNull List<LineFragment> fragments,
|
||||
@NotNull Document document1,
|
||||
@@ -141,7 +141,7 @@ public class OnesideFragmentBuilder {
|
||||
appendText(side, offset1, offset2, lines, startLine1, startLine2);
|
||||
int linesAfter = totalLines;
|
||||
|
||||
myChangedLines.add(new IntPair(linesBefore, linesAfter));
|
||||
myChangedLines.add(new LineRange(linesBefore, linesAfter));
|
||||
}
|
||||
|
||||
private void appendText(@NotNull Side side, int offset1, int offset2, int lines, int startLine1, int startLine2) {
|
||||
@@ -199,7 +199,7 @@ public class OnesideFragmentBuilder {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<IntPair> getChangedLines() {
|
||||
public List<LineRange> getChangedLines() {
|
||||
return myChangedLines;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.diff.tools.util;
|
||||
import com.intellij.diff.util.DiffDividerDrawUtil;
|
||||
import com.intellij.diff.util.DiffDrawUtil;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.diff.util.LineRange;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -740,25 +741,6 @@ public class FoldingModelSupport {
|
||||
};
|
||||
}
|
||||
|
||||
private static class LineRange {
|
||||
public final int start;
|
||||
public final int end;
|
||||
|
||||
public LineRange(int start, int end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public boolean contains(int start, int end) {
|
||||
return this.start <= start && this.end >= end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + start + ", " + end + ')';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Settings {
|
||||
public final int range;
|
||||
public final boolean defaultExpanded;
|
||||
|
||||
+5
-5
@@ -19,8 +19,8 @@ import com.intellij.diff.comparison.AutoTestCase;
|
||||
import com.intellij.diff.comparison.ComparisonManager;
|
||||
import com.intellij.diff.comparison.ComparisonManagerImpl;
|
||||
import com.intellij.diff.comparison.ComparisonPolicy;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
import com.intellij.diff.util.LineRange;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
@@ -98,7 +98,7 @@ public class OnesideFragmentBuilderAutoTest extends AutoTestCase {
|
||||
CharSequence text = builder.getText();
|
||||
List<ChangedBlock> blocks = builder.getBlocks();
|
||||
LineNumberConvertor convertor = builder.getConvertor();
|
||||
List<DiffIterableUtil.IntPair> changedLines = builder.getChangedLines();
|
||||
List<LineRange> changedLines = builder.getChangedLines();
|
||||
List<HighlightRange> ranges = builder.getRanges();
|
||||
|
||||
// both documents - before and after - should be subsequence of result text.
|
||||
@@ -181,9 +181,9 @@ public class OnesideFragmentBuilderAutoTest extends AutoTestCase {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isLineChanged(int line, @NotNull List<DiffIterableUtil.IntPair> changedLines) {
|
||||
for (DiffIterableUtil.IntPair changedLine : changedLines) {
|
||||
if (changedLine.val1 <= line && changedLine.val2 > line) return true;
|
||||
private static boolean isLineChanged(int line, @NotNull List<LineRange> changedLines) {
|
||||
for (LineRange changedLine : changedLines) {
|
||||
if (changedLine.start <= line && changedLine.end > line) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ package com.intellij.diff.tools.fragmented;
|
||||
import com.intellij.diff.comparison.ComparisonManager;
|
||||
import com.intellij.diff.comparison.ComparisonManagerImpl;
|
||||
import com.intellij.diff.comparison.ComparisonPolicy;
|
||||
import com.intellij.diff.comparison.iterables.DiffIterableUtil;
|
||||
import com.intellij.diff.fragments.LineFragment;
|
||||
import com.intellij.diff.util.IntPair;
|
||||
import com.intellij.diff.util.Side;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
@@ -60,7 +60,7 @@ public class OnesideFragmentBuilderTest extends UsefulTestCase {
|
||||
|
||||
assertFalse(builder.isEqual());
|
||||
assertEquals(builder.getText().toString(), "A\nB\nC\nD\n");
|
||||
assertEquals(builder.getChangedLines(), Collections.singletonList(new DiffIterableUtil.IntPair(1, 3)));
|
||||
assertEquals(builder.getChangedLines(), Collections.singletonList(new IntPair(1, 3)));
|
||||
|
||||
assertEquals(builder.getBlocks().size(), 1);
|
||||
ChangedBlock block = builder.getBlocks().get(0);
|
||||
|
||||
Reference in New Issue
Block a user