Floating notification shouldn't be shown during import
It depends on up to date check that is correct only after all caches are updated after import
This commit is contained in:
+4
@@ -52,6 +52,10 @@ sealed class GradleBuildRoot(
|
|||||||
fun fileChanged(filePath: String, ts: Long) {
|
fun fileChanged(filePath: String, ts: Long) {
|
||||||
lastModifiedFiles.fileChanged(ts, filePath)
|
lastModifiedFiles.fileChanged(ts, filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isImportingInProgress(): Boolean {
|
||||||
|
return importing.get() != ImportingStatus.updated
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class WithoutScriptModels(
|
sealed class WithoutScriptModels(
|
||||||
|
|||||||
+1
-2
@@ -104,8 +104,7 @@ abstract class GradleBuildRootsLocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val importing: Boolean
|
private val importing: Boolean
|
||||||
get() = nearest != null &&
|
get() = nearest != null && nearest.isImportingInProgress()
|
||||||
nearest.importing.get() != GradleBuildRoot.ImportingStatus.updated
|
|
||||||
|
|
||||||
private val isImported: Boolean
|
private val isImported: Boolean
|
||||||
get() = script != null
|
get() = script != null
|
||||||
|
|||||||
+2
-5
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRoot.Importin
|
|||||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||||
import org.jetbrains.kotlin.psi.KtFile
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
|
||||||
import org.jetbrains.plugins.gradle.config.GradleSettingsListenerAdapter
|
import org.jetbrains.plugins.gradle.config.GradleSettingsListenerAdapter
|
||||||
import org.jetbrains.plugins.gradle.service.GradleInstallationManager
|
import org.jetbrains.plugins.gradle.service.GradleInstallationManager
|
||||||
import org.jetbrains.plugins.gradle.settings.*
|
import org.jetbrains.plugins.gradle.settings.*
|
||||||
@@ -91,15 +90,13 @@ class GradleBuildRootsManager(val project: Project) : GradleBuildRootsLocator(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun isConfigurationLoadingInProgress(file: KtFile): Boolean {
|
override fun isConfigurationLoadingInProgress(file: KtFile): Boolean {
|
||||||
return when (val root = findScriptBuildRoot(file.originalFile.virtualFile)?.nearest) {
|
return findScriptBuildRoot(file.originalFile.virtualFile)?.nearest?.isImportingInProgress() ?: return false
|
||||||
is GradleBuildRoot -> root.importing.get() != updated
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate") // used in GradleImportHelper.kt.201
|
@Suppress("MemberVisibilityCanBePrivate") // used in GradleImportHelper.kt.201
|
||||||
fun isConfigurationOutOfDate(file: VirtualFile): Boolean {
|
fun isConfigurationOutOfDate(file: VirtualFile): Boolean {
|
||||||
val script = getScriptInfo(file) ?: return false
|
val script = getScriptInfo(file) ?: return false
|
||||||
|
if (script.buildRoot.isImportingInProgress()) return false
|
||||||
return !script.model.inputs.isUpToDate(project, file)
|
return !script.model.inputs.isUpToDate(project, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user