IJPL-195829 [recent files] Refactor the factory API

Introduce separate overloads for the switcher and recent files,
to hide the implementation detail parameters,
and to make the expectation on other parameters clearer
(for example, that event is null for the recent files,
and onlyEditedFiles is null for the switcher).

This refactoring will help adding a key released handler
needed to fix the issue with events being missed
while suspending code is running.
Because this is only an issue for the switcher,
not for the recent files popup.

GitOrigin-RevId: 3a9b40a2191c563b01721c65767384ab0906a92b
This commit is contained in:
Sergei Tachenov
2025-08-14 13:39:19 +00:00
committed by intellij-monorepo-bot
parent cf70eee6ae
commit cc17d9d701
3 changed files with 33 additions and 10 deletions
@@ -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)