mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: cleanup - inline method
This commit is contained in:
@@ -160,6 +160,7 @@ public class ChangeListsIndexes {
|
||||
return new BaseRevision(data.vcsKey, data.revision, path);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<BaseRevision> getAffectedFilesUnderVcs() {
|
||||
final List<BaseRevision> result = new ArrayList<>();
|
||||
for (Map.Entry<FilePath, Data> entry : myMap.entrySet()) {
|
||||
|
||||
@@ -17,26 +17,25 @@ package com.intellij.openapi.vcs.changes;
|
||||
|
||||
import com.intellij.openapi.vcs.changes.ui.PlusMinusModify;
|
||||
import com.intellij.util.BeforeAfter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChangesDelta {
|
||||
private final PlusMinusModify<BaseRevision> myDeltaListener;
|
||||
private boolean myInitialized;
|
||||
|
||||
public ChangesDelta(final PlusMinusModify<BaseRevision> deltaListener) {
|
||||
public ChangesDelta(@NotNull PlusMinusModify<BaseRevision> deltaListener) {
|
||||
myDeltaListener = deltaListener;
|
||||
}
|
||||
|
||||
// true -> something changed
|
||||
public boolean notifyPathsChanged(final ChangeListsIndexes was, final ChangeListsIndexes became) {
|
||||
List<BaseRevision> wasAffected = was.getAffectedFilesUnderVcs();
|
||||
if (! myInitialized) {
|
||||
sendPlus(wasAffected);
|
||||
if (!myInitialized) {
|
||||
myInitialized = true;
|
||||
for (BaseRevision pair : was.getAffectedFilesUnderVcs()) {
|
||||
myDeltaListener.plus(pair);
|
||||
}
|
||||
return true; //+-
|
||||
}
|
||||
|
||||
@@ -48,18 +47,12 @@ public class ChangesDelta {
|
||||
for (BaseRevision pair : toRemove) {
|
||||
myDeltaListener.minus(pair);
|
||||
}
|
||||
sendPlus(toAdd);
|
||||
for (BaseRevision pair : toAdd) {
|
||||
myDeltaListener.plus(pair);
|
||||
}
|
||||
for (BeforeAfter<BaseRevision> beforeAfter : toModify) {
|
||||
myDeltaListener.modify(beforeAfter.getBefore(), beforeAfter.getAfter());
|
||||
}
|
||||
return ! toRemove.isEmpty() || ! toAdd.isEmpty();
|
||||
}
|
||||
|
||||
private void sendPlus(final Collection<BaseRevision> toAdd) {
|
||||
if (toAdd != null) {
|
||||
for (BaseRevision pair : toAdd) {
|
||||
myDeltaListener.plus(pair);
|
||||
}
|
||||
}
|
||||
return !toRemove.isEmpty() || !toAdd.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user