From e20b9b46fc259816256b9699b5fc432c86e4f5a1 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Mon, 11 Jul 2022 12:58:35 +0300 Subject: [PATCH] Empty tooltips are shown on Java plugin popup #420 --- .../plugin/ui/GenerateTestsDialogWindow.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt index a91b00c0c9..9860d43381 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt @@ -156,13 +156,15 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m @Suppress("UNCHECKED_CAST") private val itemsToHelpTooltip = hashMapOf( - (codegenLanguages as ComboBox) to ContextHelpLabel.create(""), - (testFrameworks as ComboBox) to ContextHelpLabel.create(""), - (mockStrategies as ComboBox) to ContextHelpLabel.create(""), - (staticsMocking as ComboBox) to ContextHelpLabel.create(""), - (parametrizedTestSources as ComboBox) to ContextHelpLabel.create("") + (codegenLanguages as ComboBox) to createHelpLabel(), + (testFrameworks as ComboBox) to createHelpLabel(), + (mockStrategies as ComboBox) to createHelpLabel(), + (staticsMocking as ComboBox) to createHelpLabel(), + (parametrizedTestSources as ComboBox) to createHelpLabel() ) + private fun createHelpLabel() = JBLabel(AllIcons.General.ContextHelp) + init { title = "Generate tests with UtBot" setResizable(false) @@ -253,11 +255,11 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m private fun Row.makePanelWithHelpTooltip( mainComponent: JComponent, - contextHelpLabel: ContextHelpLabel? + label: JBLabel? ): CellBuilder = component(Panel().apply { add(mainComponent, BorderLayout.LINE_START) - contextHelpLabel?.let { add(it, BorderLayout.LINE_END) } + label?.let { add(it, BorderLayout.LINE_END) } }) private fun findSdkVersion(): JavaVersion? { @@ -957,7 +959,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m } } -private fun ComboBox.setHelpTooltipTextChanger(helpLabel: ContextHelpLabel) { +private fun ComboBox.setHelpTooltipTextChanger(helpLabel: JBLabel) { addActionListener { event -> val comboBox = event.source as ComboBox<*> val item = comboBox.item as CodeGenerationSettingItem