mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[external-system] IJPL-170: Also wait until startup activities are invoked during the project open
GitOrigin-RevId: 7c88385e4401d1a5d7592e02303f30f9c011bce6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6e867b5bbd
commit
bbe2c63c2c
+25
-1
@@ -1,9 +1,33 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.externalSystem.util
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.observable.AbstractInProgressService
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class ExternalSystemInProgressService(scope: CoroutineScope) : AbstractInProgressService(scope)
|
||||
class ExternalSystemInProgressService(scope: CoroutineScope) : AbstractInProgressService(scope) {
|
||||
@Volatile
|
||||
private var isUnlinkedActivityStarted: Boolean = false
|
||||
@Volatile
|
||||
private var isExternalProjectActivityStarted: Boolean = false
|
||||
|
||||
fun unlinkedActivityStarted() {
|
||||
isUnlinkedActivityStarted = true
|
||||
}
|
||||
|
||||
fun externalSystemActivityStarted() {
|
||||
isExternalProjectActivityStarted = true
|
||||
}
|
||||
|
||||
private fun isUnlinkedActivityPending() : Boolean{
|
||||
return !ApplicationManager.getApplication().isUnitTestMode && !isUnlinkedActivityStarted
|
||||
}
|
||||
|
||||
override fun isInProgress(): Boolean {
|
||||
return super.isInProgress() ||
|
||||
isUnlinkedActivityPending() ||
|
||||
!isExternalProjectActivityStarted
|
||||
}
|
||||
}
|
||||
+1
@@ -45,6 +45,7 @@ class UnlinkedProjectStartupActivity : ProjectActivity {
|
||||
|
||||
override suspend fun execute(project: Project) {
|
||||
project.serviceAsync<ExternalSystemInProgressService>().trackConfigurationActivity {
|
||||
project.serviceAsync<ExternalSystemInProgressService>().unlinkedActivityStarted()
|
||||
loadProjectIfSingleUnlinkedProjectFound(project)
|
||||
val projectRoots = installProjectRootsScanner(project)
|
||||
installUnlinkedProjectScanner(project, projectRoots)
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ import kotlinx.coroutines.withContext
|
||||
internal class ExternalSystemStartupActivity : ProjectActivity {
|
||||
|
||||
override suspend fun execute(project: Project) = project.serviceAsync<ExternalSystemInProgressService>().trackConfigurationActivity {
|
||||
project.serviceAsync<ExternalSystemInProgressService>().externalSystemActivityStarted()
|
||||
val esProjectsManager = readAction {
|
||||
ExternalProjectsManagerImpl.getInstance(project)
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ abstract class AbstractInProgressService(private val scope: CoroutineScope) {
|
||||
}
|
||||
}
|
||||
|
||||
fun isInProgress(): Boolean {
|
||||
open fun isInProgress(): Boolean {
|
||||
return inProgress != 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user