diff --git a/platform/platform-impl/api-dump-unreviewed.txt b/platform/platform-impl/api-dump-unreviewed.txt index 964b7808a268..cb9d5f7a4cf3 100644 --- a/platform/platform-impl/api-dump-unreviewed.txt +++ b/platform/platform-impl/api-dump-unreviewed.txt @@ -11575,7 +11575,7 @@ f:com.intellij.openapi.wm.impl.WindowManagerImpl - setWindowShadow(java.awt.Window,com.intellij.openapi.wm.ex.WindowManagerEx$WindowShadowMode):V - suggestParentWindow(com.intellij.openapi.project.Project):java.awt.Window - updateDefaultFrameInfoOnProjectClose(com.intellij.openapi.project.Project):V -- f:withFrameReuseEnabled():java.lang.AutoCloseable +- withFrameReuseEnabled():java.lang.AutoCloseable c:com.intellij.openapi.wm.impl.content.BaseLabel - javax.swing.JLabel - p:myUi:com.intellij.openapi.wm.impl.content.ToolWindowContentUi diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.kt b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.kt index fe2fbc7b01df..0504f8a7bfc8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.kt @@ -63,6 +63,7 @@ import com.intellij.openapi.vfs.impl.ZipHandler import com.intellij.openapi.vfs.impl.jar.TimedZipHandler import com.intellij.openapi.wm.IdeFocusManager import com.intellij.openapi.wm.WindowManager +import com.intellij.openapi.wm.ex.WindowManagerEx import com.intellij.openapi.wm.impl.WindowManagerImpl import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame import com.intellij.platform.PlatformProjectOpenProcessor @@ -1045,7 +1046,7 @@ open class ProjectManagerImpl : ProjectManagerEx(), Disposable { return withContext(Dispatchers.EDT) { try { writeIntentReadAction { - (WindowManager.getInstance() as WindowManagerImpl).withFrameReuseEnabled().use { + (WindowManager.getInstance() as WindowManagerEx).withFrameReuseEnabled().use { closeProject(project, checkCanClose = true) } } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/ex/WindowManagerEx.java b/platform/platform-impl/src/com/intellij/openapi/wm/ex/WindowManagerEx.java index b8a4735201be..31a7cd3d5816 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/ex/WindowManagerEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/ex/WindowManagerEx.java @@ -83,4 +83,9 @@ public abstract class WindowManagerEx extends WindowManager { @ApiStatus.Internal public abstract @NotNull List getProjectFrameHelpers(); + + @ApiStatus.Internal + public @NotNull AutoCloseable withFrameReuseEnabled() { + return () -> {}; + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.kt b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.kt index ab401b5566ff..0af1b04462c2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowManagerImpl.kt @@ -331,7 +331,7 @@ class WindowManagerImpl : WindowManagerEx(), PersistentStateComponentWithModific frameToReuse.getAndSet(null)?.doDispose() } - fun withFrameReuseEnabled(): AutoCloseable { + override fun withFrameReuseEnabled(): AutoCloseable { val oldValue = frameReuseEnabled frameReuseEnabled = true return AutoCloseable { frameReuseEnabled = oldValue } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenMultiProjectImportTest.kt b/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenMultiProjectImportTest.kt index dc423a8e4384..076a7300c36e 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenMultiProjectImportTest.kt +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/indices/MavenMultiProjectImportTest.kt @@ -1,6 +1,7 @@ // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.idea.maven.indices +import com.intellij.ide.GeneralSettings import com.intellij.ide.projectWizard.ProjectWizardTestCase import com.intellij.ide.util.newProjectWizard.AbstractProjectWizard import com.intellij.maven.testFramework.MavenTestCaseLegacy @@ -27,10 +28,16 @@ class MavenMultiProjectImportTest : ProjectWizardTestCase