From 4a361ebe606309e15b8811099c23fc3d2d083df7 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 12 Oct 2015 16:18:43 +0300 Subject: [PATCH] Hide update plugin popup right after Intall was clicked to prevent multiple downloads --- .../src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt index 422e47ac58a..0d3b7cd2327 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginUpdater.kt @@ -155,12 +155,14 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos NotificationType.INFORMATION) { notification, event -> val descriptor = descriptorToInstall ?: PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin")) if (descriptor != null) { + notification.expire() + val pluginDownloader = PluginDownloader.createDownloader(descriptor, hostToInstallFrom, null) ProgressManager.getInstance().run(object : Task.Backgroundable(null, "Downloading plugins", true) { override fun run(indicator: ProgressIndicator) { if (pluginDownloader.prepareToInstall(indicator)) { - val descriptor = pluginDownloader.getDescriptor() - if (descriptor != null) { + val pluginDescriptor = pluginDownloader.getDescriptor() + if (pluginDescriptor != null) { pluginDownloader.install() ApplicationManager.getApplication().invokeLater { @@ -169,7 +171,10 @@ class KotlinPluginUpdater(val propertiesComponent: PropertiesComponent) : Dispos } } } + } + override fun onCancel() { + notifyPluginUpdateAvailable(newVersion, descriptorToInstall, hostToInstallFrom) } }) }