From 755698cf8f579cebc3d1b623d59267775bdb7eb8 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Sun, 21 May 2023 10:04:50 +0200 Subject: [PATCH] IDEA-309767 All opened projects are closed after IDEA restart GitOrigin-RevId: 64eeeaa028197dc13f0a7b3f492d7954dca5163a --- .../intellij/ide/RecentProjectsManagerBase.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt index 8fe6db7e29c4..dd89ac4f9348 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt +++ b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt @@ -505,23 +505,28 @@ open class RecentProjectsManagerBase(coroutineScope: CoroutineScope) : override fun suggestNewProjectLocation() = ProjectUtil.getBaseDir() // open for Rider - protected open fun isValidProjectPath(file: Path) = ProjectUtilCore.isValidProjectPath(file) + @Suppress("MemberVisibilityCanBePrivate") + protected suspend fun isValidProjectPath(file: Path): Boolean { + return withContext(Dispatchers.IO) { ProjectUtilCore.isValidProjectPath(file) } + } private suspend fun openMultiple(openPaths: List>): Boolean { val toOpen = openPaths.mapNotNull { entry -> - val path = Path.of(entry.key) - if (entry.value.frame != null && isValidProjectPath(path)) Pair(path, entry.value) else null + runCatching { + val path = Path.of(entry.key) + if (isValidProjectPath(path)) Pair(path, entry.value) else null + }.getOrLogException(LOG) } + // ok, no non-existent project paths and every info has a frame - val activeInfo = toOpen.maxByOrNull { it.second.activationTimestamp }!!.second + val activeInfo = (toOpen.maxByOrNull { it.second.activationTimestamp } ?: return false).second val taskList = ArrayList>(toOpen.size) subtask("project frame initialization", Dispatchers.EDT) { var activeTask: Pair? = null for ((path, info) in toOpen) { - val frameInfo = info.frame!! val isActive = info == activeInfo - val ideFrame = createNewProjectFrame(frameInfo).create() + val ideFrame = createNewProjectFrame(info.frame).create() info.frameTitle?.let { ideFrame.title = it }