IDEA-309767 All opened projects are closed after IDEA restart

GitOrigin-RevId: 64eeeaa028197dc13f0a7b3f492d7954dca5163a
This commit is contained in:
Vladimir Krivosheev
2023-05-21 10:23:17 +00:00
committed by intellij-monorepo-bot
parent 62f16f26a4
commit 755698cf8f
@@ -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<Entry<String, RecentProjectMetaInfo>>): 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<Pair<Path, OpenProjectTask>>(toOpen.size)
subtask("project frame initialization", Dispatchers.EDT) {
var activeTask: Pair<Path, OpenProjectTask>? = 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
}