From 2d04c9070aec45cf70ce928f835cc3ac8932202c Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sun, 14 Jan 2018 21:55:37 +0300 Subject: [PATCH] vcs: deprecate `Consumer` in `CLM.invokeAfterUpdate()` follow-up: 4cfac8006412037e5fc17f478dce7ac25d641348 --- .../intellij/openapi/vcs/changes/ChangeListManager.java | 1 + .../openapi/vcs/changes/ChangeListManagerImpl.java | 7 +++++-- .../intellij/openapi/vcs/changes/UpdateRequestsQueue.java | 6 ------ .../com/intellij/openapi/vcs/changes/ui/CommitHelper.java | 4 ++-- .../src/org/jetbrains/idea/svn/SvnRootsDetector.java | 8 +++----- .../idea/svn/integrate/SvnIntegrateChangesTask.java | 4 ++-- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListManager.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListManager.java index 57cd66e0a38a..a0ef8120da04 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListManager.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListManager.java @@ -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, diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index cc52a20fc423..538cdcfd947a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -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 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 diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java index bc77f23c1199..db59053527eb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdateRequestsQueue.java @@ -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 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; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java index 5db238623f8b..e71ac4ba8926 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java @@ -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); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java index fef9c060e37f..7f528127f8f7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRootsDetector.java @@ -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 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 infos) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java index 69aa890bd45d..4a006bfb7c0b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java @@ -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