vcs: deprecate Consumer<VcsDirtyScopeManager> in CLM.invokeAfterUpdate()

follow-up: 4cfac80064
This commit is contained in:
Aleksey Pivovarov
2018-01-25 18:27:32 +03:00
parent 56ae46e607
commit 2d04c9070a
6 changed files with 13 additions and 17 deletions
@@ -50,6 +50,7 @@ public abstract class ChangeListManager implements ChangeListModification {
@Nullable String title,
@Nullable ModalityState state);
@Deprecated
public abstract void invokeAfterUpdate(@NotNull Runnable afterUpdate,
@NotNull InvokeAfterUpdateMode mode,
@Nullable String title,
@@ -341,7 +341,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
@NotNull InvokeAfterUpdateMode mode,
@Nullable String title,
@Nullable ModalityState state) {
myUpdater.invokeAfterUpdate(afterUpdate, mode, title, null, state);
invokeAfterUpdate(afterUpdate, mode, title, null, state);
}
@Override
@@ -350,7 +350,10 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
@Nullable String title,
@Nullable Consumer<VcsDirtyScopeManager> dirtyScopeManagerFiller,
@Nullable ModalityState state) {
myUpdater.invokeAfterUpdate(afterUpdate, mode, title, dirtyScopeManagerFiller, state);
if (dirtyScopeManagerFiller != null && !myProject.isDisposed()) {
dirtyScopeManagerFiller.consume(VcsDirtyScopeManager.getInstance(myProject));
}
myUpdater.invokeAfterUpdate(afterUpdate, mode, title, state);
}
@Override
@@ -23,7 +23,6 @@ import com.intellij.openapi.progress.SomeQueue;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.util.Consumer;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.io.storage.HeavyProcessLatch;
import org.jetbrains.annotations.NotNull;
@@ -172,15 +171,10 @@ public class UpdateRequestsQueue {
public void invokeAfterUpdate(@NotNull Runnable afterUpdate,
@NotNull InvokeAfterUpdateMode mode,
@Nullable String title,
@Nullable Consumer<VcsDirtyScopeManager> dirtyScopeManagerFiller,
@Nullable ModalityState state) {
LOG.debug("invokeAfterUpdate for project: " + myProject.getName());
final CallbackData data = CallbackData.create(myProject, mode, afterUpdate, title, state);
if (dirtyScopeManagerFiller != null && !myProject.isDisposed()) {
dirtyScopeManagerFiller.consume(VcsDirtyScopeManager.getInstance(myProject));
}
boolean stopped;
synchronized (myLock) {
stopped = myStopped;
@@ -348,6 +348,7 @@ public class CommitHelper {
myAction.finish();
if (!myProject.isDisposed()) {
// after vcs refresh is completed, outdated notifiers should be removed if some exists...
VcsDirtyScopeManager.getInstance(myProject).filePathsDirty(getPathsToRefresh(), null);
ChangeListManager clManager = ChangeListManager.getInstance(myProject);
clManager.invokeAfterUpdate(
() -> {
@@ -359,8 +360,7 @@ public class CommitHelper {
// in background since commit must have authorized
cache.refreshAllCachesAsync(false, true);
cache.refreshIncomingChangesAsync();
}, InvokeAfterUpdateMode.SILENT, null, vcsDirtyScopeManager -> vcsDirtyScopeManager.filePathsDirty(getPathsToRefresh(), null),
null);
}, InvokeAfterUpdateMode.SILENT, null, null);
LocalHistory.getInstance().putSystemLabel(myProject, myActionName + ": " + myCommitMessage);
}
@@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.InvokeAfterUpdateMode;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
@@ -83,6 +84,7 @@ public class SvnRootsDetector {
if (clearState) {
// clear what was reported before (could be for currently-not-existing roots)
myNestedCopiesHolder.getAndClear();
VcsDirtyScopeManager.getInstance(myVcs.getProject()).filesDirty(null, basicVfRoots);
}
clManager.invokeAfterUpdate(() -> {
final List<RootUrlInfo> nestedRoots = new ArrayList<>();
@@ -110,11 +112,7 @@ public class SvnRootsDetector {
myMapping.applyDetectionResult(myResult);
callback.run();
}, InvokeAfterUpdateMode.SILENT_CALLBACK_POOLED, null, vcsDirtyScopeManager -> {
if (clearState) {
vcsDirtyScopeManager.filesDirty(null, basicVfRoots);
}
}, null);
}, InvokeAfterUpdateMode.SILENT_CALLBACK_POOLED, null, null);
}
private static void putWcDbFilesToVfs(@NotNull Collection<RootUrlInfo> infos) {
@@ -253,6 +253,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable {
// for changes to be detected, we need switch to background change list manager update thread and back to dispatch thread
// so callback is used; ok to be called after VCS update markup closed: no remote operations
VcsDirtyScopeManager.getInstance(myProject).filePathsDirty(files, null);
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.invokeAfterUpdate(
() -> {
@@ -263,8 +264,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable {
CommitChangeListDialog.commitChanges(myProject, changes, null, null, myMerger.getComment());
prepareAndShowResults();
}, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, myTitle, vcsDirtyScopeManager -> vcsDirtyScopeManager.filePathsDirty(files, null),
null);
}, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, myTitle, null);
}
@NotNull