From f316d3bb46dcdbbbcafb5d97e36642e5f088fd12 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Fri, 24 Oct 2014 19:43:01 +0400 Subject: [PATCH] [vcs] IDEA-95947 Don't notify about the same unregistered root twice --- .../openapi/vcs/roots/VcsRootProblemNotifier.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootProblemNotifier.java index fcafc513fcb8..3b8100978094 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootProblemNotifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/roots/VcsRootProblemNotifier.java @@ -28,12 +28,14 @@ import com.intellij.openapi.vcs.VcsDirectoryMapping; import com.intellij.openapi.vcs.VcsNotifier; import com.intellij.openapi.vcs.VcsRootError; import com.intellij.util.Function; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.event.HyperlinkEvent; import java.util.ArrayList; import java.util.Collection; +import java.util.Set; import static com.intellij.openapi.util.text.StringUtil.pluralize; @@ -46,6 +48,7 @@ public class VcsRootProblemNotifier { private final @NotNull Project myProject; private final @NotNull VcsConfiguration mySettings; + @NotNull private final Set myReportedUnregisteredRoots = ContainerUtil.newHashSet(); private @Nullable Notification myNotification; private final @NotNull Object NOTIFICATION_LOCK = new Object(); @@ -78,6 +81,11 @@ public class VcsRootProblemNotifier { String title = makeTitle(unregisteredRoots, invalidRoots); String description = makeDescription(unregisteredRoots, invalidRoots); + if (myReportedUnregisteredRoots.containsAll(unregisteredRoots) && invalidRoots.isEmpty()) { + return; + } + myReportedUnregisteredRoots.addAll(unregisteredRoots); + synchronized (NOTIFICATION_LOCK) { expireNotification(); NotificationListener listener = new MyNotificationListener(myProject, mySettings);