mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
ASPR-3010 Recommended plugin installation on IDEA startup (fix required plugins downloads)
This commit is contained in:
@@ -170,7 +170,7 @@ class OpenIdeStartupWizardService(private val coroutineScope: CoroutineScope) :
|
||||
icon = AllIcons.Language.GO,
|
||||
plugins = listOf(
|
||||
WizardPluginImpl(
|
||||
id = "org.jetbrains.plugins.go",
|
||||
id = "com.haulmont.go",
|
||||
icon = AllIcons.Plugins.PluginLogo,
|
||||
name = "Go [beta]",
|
||||
description = ImportSettingsBundle.message("plugin.description.go"),
|
||||
|
||||
@@ -67,12 +67,20 @@ object PluginInstallationUtil {
|
||||
}
|
||||
|
||||
var shouldRestart = false
|
||||
val progressPerPlugin = 0.9 / pluginsToInstall.size.coerceAtLeast(1)
|
||||
val installedDuringSession = mutableSetOf<PluginId>()
|
||||
val queue = ArrayDeque(pluginsToInstall)
|
||||
var currentProgress = 0.1
|
||||
|
||||
for (plugin in pluginsToInstall) {
|
||||
while (queue.isNotEmpty()) {
|
||||
if (progressIndicator.isCanceled) break
|
||||
|
||||
val plugin = queue.removeFirst()
|
||||
if (plugin.pluginId in installedDuringSession || PluginManagerCore.isPluginInstalled(plugin.pluginId)) {
|
||||
continue
|
||||
}
|
||||
|
||||
val progressPerPlugin = 0.9 / (queue.size + 1).coerceAtLeast(1)
|
||||
|
||||
progressIndicator.text = ImportSettingsBundle.message("plugin-installation.progress.downloading", plugin.name)
|
||||
|
||||
// Load and set plugin icon
|
||||
@@ -94,13 +102,28 @@ object PluginInstallationUtil {
|
||||
}
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
downloader.prepareToInstall(null)
|
||||
val prepareToInstall = downloader.prepareToInstall(null)
|
||||
if (prepareToInstall) {
|
||||
|
||||
val depIds = downloader.descriptor
|
||||
.dependencies
|
||||
.filter { !it.isOptional }
|
||||
.map { it.pluginId }
|
||||
.filter { it !in installedDuringSession && !PluginManagerCore.isPluginInstalled(it) }
|
||||
|
||||
if (depIds.isNotEmpty()) {
|
||||
val depDescriptors = MarketplaceRequests.loadLastCompatiblePluginDescriptors(depIds.toSet(), null, true)
|
||||
queue.addAll(depDescriptors)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val appliedWithoutRestart = withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) {
|
||||
downloader.installDynamically(null)
|
||||
}
|
||||
|
||||
installedDuringSession.add(plugin.pluginId)
|
||||
|
||||
if (!appliedWithoutRestart) {
|
||||
shouldRestart = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user