From dae1a3507990d4c24ee73aaef01f49afea86bb0e Mon Sep 17 00:00:00 2001 From: Hello-zoka Date: Fri, 8 Nov 2024 17:45:02 +0100 Subject: [PATCH] Returning code changed for market validation --- .../appstarter/ProjectApplicationUtils.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/org/jetbrains/research/testspark/appstarter/ProjectApplicationUtils.kt b/src/main/kotlin/org/jetbrains/research/testspark/appstarter/ProjectApplicationUtils.kt index 4fd7a12fa..73cbad4c6 100644 --- a/src/main/kotlin/org/jetbrains/research/testspark/appstarter/ProjectApplicationUtils.kt +++ b/src/main/kotlin/org/jetbrains/research/testspark/appstarter/ProjectApplicationUtils.kt @@ -13,6 +13,8 @@ import com.intellij.openapi.application.ModalityState import com.intellij.openapi.application.ex.ApplicationManagerEx import com.intellij.openapi.progress.util.ProgressIndicatorBase import com.intellij.openapi.project.Project +import com.intellij.openapi.project.ex.ProjectManagerEx +import com.intellij.openapi.startup.StartupManager import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.vfs.LocalFileSystem @@ -25,6 +27,7 @@ import org.jetbrains.plugins.gradle.GradleCommandLineProjectConfigurator import org.slf4j.LoggerFactory import java.nio.file.Path import java.util.function.Predicate +import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine class ProjectConfiguratorException : Exception { @@ -158,18 +161,14 @@ object ProjectApplicationUtils { private fun closeProject(project: Project) { logger.info("Closing project $project...") - ApplicationManager.getApplication().assertIsNonDispatchThread() - // ToDo: move headless mode to another branch -// ApplicationManager.getApplication().invokeAndWait { -// ProjectManagerEx.getInstanceEx().forceCloseProject(project) -// } + ApplicationManager.getApplication().invokeAndWait { + ProjectManagerEx.getInstanceEx().forceCloseProject(project) + } } private suspend fun waitAllStartupActivitiesPassed(project: Project): Unit = suspendCoroutine { logger.info("Waiting all startup activities passed $project...") - // ToDo: move headless mode to another branch -// StartupManager.getInstance(project).runAfterOpened { it.resume(Unit) } - waitForInvokeLaterActivities() + StartupManager.getInstance(project).runAfterOpened { it.resume(Unit) } } /**