IDEA-305065 Smart Update does not open project after IDE restart

GitOrigin-RevId: df8f082498b3b49784c30f27f067f4d13e9ea1bd
This commit is contained in:
Dmitry Avdeev
2023-05-19 15:41:38 +02:00
committed by intellij-monorepo-bot
parent 9be2da0258
commit cb745831dd
3 changed files with 10 additions and 1 deletions

View File

@@ -65,4 +65,6 @@ class RecentProjectManagerState : BaseState() {
var lastProjectLocation by string()
var lastOpenedProject by string()
var forceReopenProjects by property(false)
}

View File

@@ -432,10 +432,15 @@ open class RecentProjectsManagerBase(coroutineScope: CoroutineScope) :
return if (path.endsWith(".ipr")) FileUtilRt.getNameWithoutExtension(name) else name
}
fun forceReopenProjects() {
state.forceReopenProjects = true
}
override fun willReopenProjectOnStart(): Boolean {
if (!GeneralSettings.getInstance().isReopenLastProject || AppMode.isDontReopenProjects()) {
if (!state.forceReopenProjects && (!GeneralSettings.getInstance().isReopenLastProject || AppMode.isDontReopenProjects())) {
return false
}
state.forceReopenProjects = false
synchronized(stateLock) {
return state.additionalInfo.values.any { canReopenProject(it) }

View File

@@ -1,5 +1,6 @@
package com.intellij.smartUpdate
import com.intellij.ide.RecentProjectsManagerBase
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
@@ -37,6 +38,7 @@ class IdeRestartStep: SmartUpdateStep {
override fun performUpdateStep(project: Project, e: AnActionEvent?, onSuccess: () -> Unit) {
val updateAction = getUpdateAction()
if (updateAction != null && e != null && updateAction.isRestartRequired) {
RecentProjectsManagerBase.getInstanceEx().forceReopenProjects()
PropertiesComponent.getInstance().setValue(IDE_RESTARTED_KEY, true)
updateAction.actionPerformed(e)
}