Don't show "Configure Kotlin" notification with an empty list of configurators (context: KT-16070)
This commit is contained in:
+4
-1
@@ -24,7 +24,10 @@ import org.jetbrains.kotlin.idea.configuration.ui.notifications.ConfigureKotlinN
|
|||||||
|
|
||||||
object ConfigureKotlinNotificationManager: KotlinSingleNotificationManager<ConfigureKotlinNotification> {
|
object ConfigureKotlinNotificationManager: KotlinSingleNotificationManager<ConfigureKotlinNotification> {
|
||||||
fun notify(project: Project, excludeModules: List<Module> = emptyList()) {
|
fun notify(project: Project, excludeModules: List<Module> = emptyList()) {
|
||||||
notify(project, ConfigureKotlinNotification(project, excludeModules))
|
val notificationString = ConfigureKotlinNotification.getNotificationString(project, excludeModules)
|
||||||
|
if (notificationString != null) {
|
||||||
|
notify(project, ConfigureKotlinNotification(project, excludeModules, notificationString))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -42,9 +42,6 @@ class ConfigureKotlinNotification(
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
constructor(project: Project, excludeModules: List<Module>)
|
|
||||||
: this(project, excludeModules, getNotificationString(project, excludeModules))
|
|
||||||
|
|
||||||
override fun equals(o: Any?): Boolean {
|
override fun equals(o: Any?): Boolean {
|
||||||
if (this === o) return true
|
if (this === o) return true
|
||||||
if (o !is ConfigureKotlinNotification) return false
|
if (o !is ConfigureKotlinNotification) return false
|
||||||
@@ -59,13 +56,15 @@ class ConfigureKotlinNotification(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getNotificationString(project: Project, excludeModules: Collection<Module>): String {
|
fun getNotificationString(project: Project, excludeModules: Collection<Module>): String? {
|
||||||
val modules = getNonConfiguredModulesWithKotlinFiles(project, excludeModules)
|
val modules = getNonConfiguredModulesWithKotlinFiles(project, excludeModules)
|
||||||
|
|
||||||
val isOnlyOneModule = modules.size == 1
|
val isOnlyOneModule = modules.size == 1
|
||||||
|
|
||||||
val modulesString = if (isOnlyOneModule) "'${modules.first().name}' module" else "modules"
|
val modulesString = if (isOnlyOneModule) "'${modules.first().name}' module" else "modules"
|
||||||
val links = getAbleToRunConfigurators(project).joinToString(separator = "<br/>") {
|
val ableToRunConfigurators = getAbleToRunConfigurators(project)
|
||||||
|
if (ableToRunConfigurators.isEmpty()) return null
|
||||||
|
val links = ableToRunConfigurators.joinToString(separator = "<br/>") {
|
||||||
configurator -> getLink(configurator, isOnlyOneModule)
|
configurator -> getLink(configurator, isOnlyOneModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user