Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Empty tooltips are shown on Java plugin popup #420
  • Loading branch information
Vassiliy-Kudryashov committed Jul 11, 2022
commit e20b9b46fc259816256b9699b5fc432c86e4f5a1
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m

@Suppress("UNCHECKED_CAST")
private val itemsToHelpTooltip = hashMapOf(
(codegenLanguages as ComboBox<CodeGenerationSettingItem>) to ContextHelpLabel.create(""),
(testFrameworks as ComboBox<CodeGenerationSettingItem>) to ContextHelpLabel.create(""),
(mockStrategies as ComboBox<CodeGenerationSettingItem>) to ContextHelpLabel.create(""),
(staticsMocking as ComboBox<CodeGenerationSettingItem>) to ContextHelpLabel.create(""),
(parametrizedTestSources as ComboBox<CodeGenerationSettingItem>) to ContextHelpLabel.create("")
(codegenLanguages as ComboBox<CodeGenerationSettingItem>) to createHelpLabel(),
(testFrameworks as ComboBox<CodeGenerationSettingItem>) to createHelpLabel(),
(mockStrategies as ComboBox<CodeGenerationSettingItem>) to createHelpLabel(),
(staticsMocking as ComboBox<CodeGenerationSettingItem>) to createHelpLabel(),
(parametrizedTestSources as ComboBox<CodeGenerationSettingItem>) to createHelpLabel()
)

private fun createHelpLabel() = JBLabel(AllIcons.General.ContextHelp)

init {
title = "Generate tests with UtBot"
setResizable(false)
Expand Down Expand Up @@ -253,11 +255,11 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m

private fun Row.makePanelWithHelpTooltip(
mainComponent: JComponent,
contextHelpLabel: ContextHelpLabel?
label: JBLabel?
): CellBuilder<JPanel> =
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? {
Expand Down Expand Up @@ -957,7 +959,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
}
}

private fun ComboBox<CodeGenerationSettingItem>.setHelpTooltipTextChanger(helpLabel: ContextHelpLabel) {
private fun ComboBox<CodeGenerationSettingItem>.setHelpTooltipTextChanger(helpLabel: JBLabel) {
addActionListener { event ->
val comboBox = event.source as ComboBox<*>
val item = comboBox.item as CodeGenerationSettingItem
Expand Down