From 8fc377b3b33bef3ec25475b30fdedde0a596ce10 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 20 Jul 2018 15:01:05 +0300 Subject: [PATCH] Do not spam for same compiler version during the session (KT-25546) Otherwise it might be too distracting when auto-import feature is enabled. --- .../outdatedBundledCompilerNotification.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/outdatedBundledCompilerNotification.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/outdatedBundledCompilerNotification.kt index adc6e4f4d96..ad0d05d1e9d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/outdatedBundledCompilerNotification.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/outdatedBundledCompilerNotification.kt @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.idea.KotlinPluginUtil import org.jetbrains.kotlin.idea.actions.ConfigurePluginUpdatesAction import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.psi.UserDataProperty +import java.util.concurrent.ConcurrentHashMap import javax.swing.event.HyperlinkEvent var Module.externalCompilerVersion: String? by UserDataProperty(Key.create("EXTERNAL_COMPILER_VERSION")) @@ -71,6 +72,8 @@ fun notifyOutdatedBundledCompilerIfNecessary(project: Project) { ) } +private var alreadyNotified = ConcurrentHashMap() + fun createOutdatedBundledCompilerMessage(project: Project, bundledCompilerVersion: String = KotlinCompilerVersion.VERSION): String? { val bundledCompilerMajorVersion = MajorVersion.create(bundledCompilerVersion) ?: return null @@ -98,6 +101,14 @@ fun createOutdatedBundledCompilerMessage(project: Project, bundledCompilerVersio return null } + val lastProjectNotified = alreadyNotified[project.name] + if (lastProjectNotified == maxCompilerInfo.externalCompilerVersion) { + if (!ApplicationManager.getApplication().isUnitTestMode) { + return null + } + } + alreadyNotified[project.name] = maxCompilerInfo.externalCompilerVersion + val selectedNewerModulesInfos = selectedModulesForPopup(project, maxCompilerInfo, newerModuleCompilerInfos) if (selectedNewerModulesInfos.isEmpty()) { return null