diff --git a/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/SwitcherActions.kt b/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/SwitcherActions.kt index 3d56f9b7aca9..2eebb49fbdc0 100644 --- a/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/SwitcherActions.kt +++ b/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/SwitcherActions.kt @@ -2,7 +2,6 @@ package com.intellij.platform.recentFiles.frontend import com.intellij.featureStatistics.FeatureUsageTracker -import com.intellij.ide.IdeBundle.message import com.intellij.ide.actions.shouldUseFallbackSwitcher import com.intellij.ide.lightEdit.LightEditCompatible import com.intellij.openapi.actionSystem.ActionUpdateThread @@ -51,7 +50,7 @@ abstract class BaseSwitcherAction(val forward: Boolean?) : DumbAwareAction(), Ac } else { FeatureUsageTracker.getInstance().triggerFeatureUsed("switcher") - createAndShowNewSwitcher(null, event, message("window.title.switcher"), project) + createAndShowNewSwitcher(event, project) } } } @@ -80,7 +79,7 @@ internal abstract class BaseRecentFilesAction(private val onlyEditedFiles: Boole existingPanel.cbShowOnlyEditedFiles?.apply { isSelected = !isSelected } } else { - createAndShowNewSwitcher(onlyEditedFiles, null, message("title.popup.recent.files"), project) + createAndShowNewRecentFiles(onlyEditedFiles, project) } } } diff --git a/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/switcherFactory.kt b/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/switcherFactory.kt index d4b932389979..f8256b852649 100644 --- a/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/switcherFactory.kt +++ b/platform/recentFiles/frontend/src/com/intellij/platform/recentFiles/frontend/switcherFactory.kt @@ -1,6 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.recentFiles.frontend +import com.intellij.ide.IdeBundle.message import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.EDT import com.intellij.openapi.project.Project @@ -14,14 +15,38 @@ import kotlinx.coroutines.withContext import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.Nls -internal fun createAndShowNewSwitcher(onlyEditedFiles: Boolean?, event: AnActionEvent?, @Nls title: String, project: Project) { +internal fun createAndShowNewSwitcher(event: AnActionEvent, project: Project) { RecentFilesCoroutineScopeProvider.getInstance(project).coroutineScope.launch { - createAndShowNewSwitcherSuspend(onlyEditedFiles, event, title, project) + createAndShowNewSwitcherSuspend(event, project) } } +internal fun createAndShowNewRecentFiles(onlyEditedFiles: Boolean, project: Project) { + RecentFilesCoroutineScopeProvider.getInstance(project).coroutineScope.launch { + createAndShowNewRecentFilesSuspend(onlyEditedFiles, project) + } +} + +private suspend fun createAndShowNewSwitcherSuspend(event: AnActionEvent, project: Project): SwitcherPanel { + return createAndShow( + onlyEditedFiles = null, + event = event, + title = message("window.title.switcher"), + project = project, + ) +} + @ApiStatus.Internal -suspend fun createAndShowNewSwitcherSuspend(onlyEditedFiles: Boolean?, event: AnActionEvent?, @Nls title: String, project: Project): SwitcherPanel { +suspend fun createAndShowNewRecentFilesSuspend(onlyEditedFiles: Boolean, project: Project): SwitcherPanel { + return createAndShow( + onlyEditedFiles = onlyEditedFiles, + event = null, + title = message("title.popup.recent.files"), + project = project, + ) +} + +private suspend fun createAndShow(onlyEditedFiles: Boolean?, event: AnActionEvent?, @Nls title: String, project: Project): SwitcherPanel { val parameters = SwitcherLaunchEventParameters(event?.inputEvent) val remoteApi = FileSwitcherApi.getInstance() val frontendModel = FrontendRecentFilesModel.getInstanceAsync(project) @@ -34,4 +59,4 @@ suspend fun createAndShowNewSwitcherSuspend(onlyEditedFiles: Boolean?, event: An frontendModel = frontendModel, remoteApi = remoteApi) } -} \ No newline at end of file +} diff --git a/plugins/performanceTesting/frontend/src/com/intellij/performanceTesting/frontend/commands/ShowRecentFilesCommand.kt b/plugins/performanceTesting/frontend/src/com/intellij/performanceTesting/frontend/commands/ShowRecentFilesCommand.kt index 838a71384508..b3a388f40bea 100644 --- a/plugins/performanceTesting/frontend/src/com/intellij/performanceTesting/frontend/commands/ShowRecentFilesCommand.kt +++ b/plugins/performanceTesting/frontend/src/com/intellij/performanceTesting/frontend/commands/ShowRecentFilesCommand.kt @@ -1,11 +1,10 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.performanceTesting.frontend.commands -import com.intellij.ide.IdeBundle import com.intellij.openapi.application.EDT import com.intellij.openapi.ui.playback.PlaybackContext import com.intellij.platform.recentFiles.frontend.Switcher -import com.intellij.platform.recentFiles.frontend.createAndShowNewSwitcherSuspend +import com.intellij.platform.recentFiles.frontend.createAndShowNewRecentFilesSuspend import com.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -30,7 +29,7 @@ internal class ShowRecentFilesCommand(text: String, line: Int) : PerformanceComm alreadyOpenedSwitcher.cbShowOnlyEditedFiles?.apply { isSelected = !isSelected } } else { - createAndShowNewSwitcherSuspend(false, null, IdeBundle.message("title.popup.recent.files"), context.project) + createAndShowNewRecentFilesSuspend(false, context.project) } delay(secondsToWaitBeforeClose * 1000L)