mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: inline method
GitOrigin-RevId: bc053dbcc6f967c1af346ced11bc687daff22632
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a292c88f3e
commit
724bdba465
@@ -194,11 +194,11 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
StringUtil.equals(texts[0], texts[1]);
|
||||
|
||||
if (lineFragments == null) {
|
||||
return apply(createCompareData(null, isContentsEqual));
|
||||
return apply(null, isContentsEqual);
|
||||
}
|
||||
else {
|
||||
List<SimpleDiffChange> changes = ContainerUtil.map(lineFragments, fragment -> new SimpleDiffChange(this, fragment));
|
||||
return apply(createCompareData(changes, isContentsEqual));
|
||||
return apply(changes, isContentsEqual);
|
||||
}
|
||||
}
|
||||
catch (DiffTooBigException e) {
|
||||
@@ -214,28 +214,23 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected CompareData createCompareData(@Nullable List<SimpleDiffChange> changes,
|
||||
boolean isContentsEqual) {
|
||||
protected Runnable apply(@Nullable List<SimpleDiffChange> changes,
|
||||
boolean isContentsEqual) {
|
||||
List<SimpleDiffChange> nonSkipped = changes != null ? ContainerUtil.filter(changes, it -> !it.isSkipped()) : null;
|
||||
FoldingModelSupport.Data foldingState = myFoldingModel.createState(nonSkipped, getFoldingModelSettings());
|
||||
return new CompareData(changes, isContentsEqual, foldingState);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Runnable apply(@NotNull CompareData data) {
|
||||
return () -> {
|
||||
myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
|
||||
|
||||
clearDiffPresentation();
|
||||
|
||||
myIsContentsEqual = data.isContentsEqual();
|
||||
if (data.isContentsEqual()) {
|
||||
myIsContentsEqual = isContentsEqual;
|
||||
if (isContentsEqual) {
|
||||
boolean equalCharsets = TextDiffViewerUtil.areEqualCharsets(getContents());
|
||||
boolean equalSeparators = TextDiffViewerUtil.areEqualLineSeparators(getContents());
|
||||
myPanel.addNotification(DiffNotifications.createEqualContents(equalCharsets, equalSeparators));
|
||||
}
|
||||
|
||||
List<SimpleDiffChange> changes = data.getChanges();
|
||||
if (changes != null) {
|
||||
for (int i = 0; i < changes.size(); i++) {
|
||||
SimpleDiffChange change = changes.get(i);
|
||||
@@ -246,7 +241,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
myDiffChanges.addAll(changes);
|
||||
}
|
||||
|
||||
myFoldingModel.install(data.getFoldingState(), myRequest, getFoldingModelSettings());
|
||||
myFoldingModel.install(foldingState, myRequest, getFoldingModelSettings());
|
||||
|
||||
myInitialScrollHelper.onRediff();
|
||||
|
||||
@@ -789,34 +784,6 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
}
|
||||
}
|
||||
|
||||
private static class CompareData {
|
||||
@Nullable private final List<SimpleDiffChange> myChanges;
|
||||
private final boolean myIsContentsEqual;
|
||||
@Nullable private final FoldingModelSupport.Data myFoldingState;
|
||||
|
||||
private CompareData(@Nullable List<SimpleDiffChange> changes,
|
||||
boolean isContentsEqual,
|
||||
@Nullable FoldingModelSupport.Data state) {
|
||||
myChanges = changes;
|
||||
myIsContentsEqual = isContentsEqual;
|
||||
myFoldingState = state;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<SimpleDiffChange> getChanges() {
|
||||
return myChanges;
|
||||
}
|
||||
|
||||
public boolean isContentsEqual() {
|
||||
return myIsContentsEqual;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FoldingModelSupport.Data getFoldingState() {
|
||||
return myFoldingState;
|
||||
}
|
||||
}
|
||||
|
||||
public class ModifierProvider extends KeyboardModifierListener {
|
||||
public void init() {
|
||||
init(myPanel, SimpleDiffViewer.this);
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
}
|
||||
|
||||
if (myTextDiffProvider.isHighlightingDisabled()) {
|
||||
return apply(createCompareData(null, ranges.isEmpty()));
|
||||
return apply(null, ranges.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ public class SimpleLocalChangeListDiffViewer extends SimpleDiffViewer {
|
||||
changes.addAll(ContainerUtil.map(rangeFragments, fragment -> new MySimpleDiffChange(fragment, isExcluded, isSkipped, localRange.getChangelistId(), isExcludedFromCommit)));
|
||||
}
|
||||
|
||||
return apply(createCompareData(changes, isContentsEqual));
|
||||
return apply(changes, isContentsEqual);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user