Fix inverted logic of isNotConfiguredNotificationRequired

This commit is contained in:
Dmitry Jemerov
2018-03-09 12:02:56 +01:00
parent fa39cec94b
commit a29d693dc5
2 changed files with 6 additions and 17 deletions
@@ -115,7 +115,7 @@ fun getConfigurableModulesWithKotlinFiles(project: Project): List<ModuleSourceRo
fun showConfigureKotlinNotificationIfNeeded(module: Module) { fun showConfigureKotlinNotificationIfNeeded(module: Module) {
val moduleGroup = module.toModuleGroup() val moduleGroup = module.toModuleGroup()
if (isNotConfiguredNotificationRequired(moduleGroup)) return if (!isNotConfiguredNotificationRequired(moduleGroup)) return
ConfigureKotlinNotificationManager.notify(module.project) ConfigureKotlinNotificationManager.notify(module.project)
} }
@@ -123,7 +123,7 @@ fun showConfigureKotlinNotificationIfNeeded(module: Module) {
fun showConfigureKotlinNotificationIfNeeded(project: Project, excludeModules: List<Module> = emptyList()) { fun showConfigureKotlinNotificationIfNeeded(project: Project, excludeModules: List<Module> = emptyList()) {
val notificationString = DumbService.getInstance(project).runReadActionInSmartMode(Computable { val notificationString = DumbService.getInstance(project).runReadActionInSmartMode(Computable {
val modules = getConfigurableModulesWithKotlinFiles(project).exclude(excludeModules) val modules = getConfigurableModulesWithKotlinFiles(project).exclude(excludeModules)
if (modules.all(::isNotConfiguredNotificationRequired)) if (modules.none(::isNotConfiguredNotificationRequired))
null null
else else
ConfigureKotlinNotification.getNotificationString(project, excludeModules) ConfigureKotlinNotification.getNotificationString(project, excludeModules)
@@ -137,7 +137,7 @@ fun showConfigureKotlinNotificationIfNeeded(project: Project, excludeModules: Li
} }
fun isNotConfiguredNotificationRequired(moduleGroup: ModuleSourceRootGroup): Boolean { fun isNotConfiguredNotificationRequired(moduleGroup: ModuleSourceRootGroup): Boolean {
return !SuppressNotificationState.isKotlinNotConfiguredSuppressed(moduleGroup) && isModuleConfigured(moduleGroup) return !SuppressNotificationState.isKotlinNotConfiguredSuppressed(moduleGroup) && !isModuleConfigured(moduleGroup)
} }
fun getAbleToRunConfigurators(project: Project): Collection<KotlinProjectConfigurator> { fun getAbleToRunConfigurators(project: Project): Collection<KotlinProjectConfigurator> {
@@ -1,17 +1,6 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* * that can be found in the license/LICENSE.txt file.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package org.jetbrains.kotlin.idea.configuration package org.jetbrains.kotlin.idea.configuration
@@ -76,7 +65,7 @@ fun checkHideNonConfiguredNotifications(project: Project) {
if (!checkInProgress.compareAndSet(false, true)) return@executeOnPooledThread if (!checkInProgress.compareAndSet(false, true)) return@executeOnPooledThread
DumbService.getInstance(project).waitForSmartMode() DumbService.getInstance(project).waitForSmartMode()
if (getConfigurableModulesWithKotlinFiles(project).all(::isNotConfiguredNotificationRequired)) { if (getConfigurableModulesWithKotlinFiles(project).none(::isNotConfiguredNotificationRequired)) {
ApplicationManager.getApplication().invokeLater { ApplicationManager.getApplication().invokeLater {
ConfigureKotlinNotificationManager.expireOldNotifications(project) ConfigureKotlinNotificationManager.expireOldNotifications(project)
checkInProgress.set(false) checkInProgress.set(false)