[perfTesting] IJ-CR-157659 IJPL-178987 Introduce a perfTesting.frontend module with frontend-specific command provider

The new module will contain commands that access UI components that were split for remdev compatibility. Be it a monolith IDE or a Split one, this module will exist in the monolith or frontend process accordingly.

(cherry picked from commit 3f41cd7b7202ed3c4bfdd52b7138034dc7cd63f2)

GitOrigin-RevId: ea312ccb715138bd9314f74e789d1349de66eea5
This commit is contained in:
Nikita Katkov
2025-03-12 20:12:02 +01:00
committed by intellij-monorepo-bot
parent 826cbd1587
commit 4d6fd4e7dd
8 changed files with 58 additions and 8 deletions

1
.idea/modules.xml generated
View File

@@ -625,6 +625,7 @@
<module fileurl="file://$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" filepath="$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" />
<module fileurl="file://$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" filepath="$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/frontend/intellij.performanceTesting.frontend.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/frontend/intellij.performanceTesting.frontend.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/vcs/intellij.performanceTesting.vcs.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/vcs/intellij.performanceTesting.vcs.iml" />

View File

@@ -1,3 +1,6 @@
- name: lib/modules/intellij.performanceTesting.frontend.jar
contentModules:
- name: intellij.performanceTesting.frontend
- name: lib/performanceTesting.jar
projectLibraries:
- name: assertJ

View File

@@ -13,6 +13,7 @@
<content>
<module name="intellij.performanceTesting.remoteDriver"/>
<module name="intellij.performanceTesting.vcs"/>
<module name="intellij.performanceTesting.frontend"/>
</content>
<dependencies>

View File

@@ -92,7 +92,6 @@ public final class BaseCommandProvider implements CommandProvider {
Map.entry(ConditionalMemoryDumpCommand.PREFIX, ConditionalMemoryDumpCommand::new),
Map.entry(AcceptDecompileNotice.PREFIX, AcceptDecompileNotice::new),
Map.entry(InstallCustomJBR.PREFIX, InstallCustomJBR::new),
Map.entry(ShowRecentFilesCommand.PREFIX, ShowRecentFilesCommand::new),
Map.entry(ShowEvaluateExpressionCommand.PREFIX, ShowEvaluateExpressionCommand::new),
Map.entry(EvaluateExpressionCompletionCommand.PREFIX, EvaluateExpressionCompletionCommand::new),
Map.entry(CollectFilesNotMarkedAsIndex.PREFIX, CollectFilesNotMarkedAsIndex::new),

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.performanceTesting" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.platform.recentFiles.frontend" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.lang" />
</component>
</module>

View File

@@ -0,0 +1,10 @@
<idea-plugin>
<dependencies>
<module name="intellij.platform.frontend"/>
<module name="intellij.platform.recentFiles.frontend"/>
</dependencies>
<extensions defaultExtensionNs="com.jetbrains.performancePlugin">
<commandProvider implementation="com.intellij.performanceTesting.frontend.FrontendCommandProvider"/>
</extensions>
</idea-plugin>

View File

@@ -0,0 +1,13 @@
package com.intellij.performanceTesting.frontend
import com.jetbrains.performancePlugin.CommandProvider
import com.jetbrains.performancePlugin.CreateCommand
import com.intellij.performanceTesting.frontend.commands.ShowRecentFilesCommand
internal class FrontendCommandProvider : CommandProvider {
override fun getCommands(): Map<String, CreateCommand> {
return mapOf(
ShowRecentFilesCommand.PREFIX to CreateCommand(::ShowRecentFilesCommand),
)
}
}

View File

@@ -1,10 +1,11 @@
package com.jetbrains.performancePlugin.commands
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.jetbrains.performancePlugin.commands.PerformanceCommandCoroutineAdapter
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
@@ -13,7 +14,7 @@ import org.jetbrains.annotations.NonNls
/**
* Usage: %showRecentFiles <seconds to wait before close>
*/
class ShowRecentFilesCommand(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) {
internal class ShowRecentFilesCommand(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) {
companion object {
const val NAME: @NonNls String = "showRecentFiles"
@@ -23,12 +24,16 @@ class ShowRecentFilesCommand(text: String, line: Int) : PerformanceCommandCorout
override suspend fun doExecute(context: PlaybackContext) {
val secondsToWaitBeforeClose = extractCommandArgument(PREFIX).runCatching { this.toInt() }.getOrDefault(5)
withContext(Dispatchers.EDT) {
val switcher = Switcher.SWITCHER_KEY.get(context.project)?.cbShowOnlyEditedFiles?.apply { isSelected = !isSelected }
?: createAndShowNewSwitcherSuspend(false, null, IdeBundle.message("title.popup.recent.files"), context.project)
delay(secondsToWaitBeforeClose * 1000L)
if (switcher is Switcher.SwitcherPanel) {
switcher.cancel()
val alreadyOpenedSwitcher = Switcher.SWITCHER_KEY.get(context.project)
if (alreadyOpenedSwitcher != null) {
alreadyOpenedSwitcher.cbShowOnlyEditedFiles?.apply { isSelected = !isSelected }
}
else {
createAndShowNewSwitcherSuspend(false, null, IdeBundle.message("title.popup.recent.files"), context.project)
}
delay(secondsToWaitBeforeClose * 1000L)
Switcher.SWITCHER_KEY.get(context.project)?.cancel()
}
}