@@ -2,12 +2,22 @@ package org.utbot.intellij.plugin.js
2
2
3
3
import com.intellij.lang.javascript.refactoring.ui.JSMemberSelectionTable
4
4
import com.intellij.lang.javascript.refactoring.util.JSMemberInfo
5
+ import com.intellij.openapi.ui.ComboBox
5
6
import com.intellij.openapi.ui.DialogPanel
6
7
import com.intellij.openapi.ui.DialogWrapper
8
+ import com.intellij.ui.ContextHelpLabel
9
+ import com.intellij.ui.components.Panel
10
+ import com.intellij.ui.layout.CellBuilder
11
+ import com.intellij.ui.layout.Row
7
12
import com.intellij.ui.layout.panel
8
13
import com.intellij.util.ui.JBUI
14
+ import org.utbot.framework.codegen.TestFramework
15
+ import org.utbot.framework.plugin.api.CodeGenerationSettingItem
16
+ import org.utbot.intellij.plugin.ui.components.TestFolderComboWithBrowseButton
17
+ import java.awt.BorderLayout
18
+ import javax.swing.DefaultComboBoxModel
9
19
import javax.swing.JComponent
10
-
20
+ import javax.swing.JPanel
11
21
12
22
class JsDialogWindow (val model : JsTestsModel ): DialogWrapper(model.project) {
13
23
@@ -20,27 +30,40 @@ class JsDialogWindow(val model: JsTestsModel): DialogWrapper(model.project) {
20
30
}
21
31
}
22
32
23
- private val testSourceFolderField = JsTestFolderComboWithBrowseButton (model)
33
+ private val testSourceFolderField = TestFolderComboWithBrowseButton (model)
34
+
35
+ private val testFrameworks = ComboBox (DefaultComboBoxModel (TestFramework .allItems.toTypedArray()))
24
36
25
37
private lateinit var panel: DialogPanel
26
38
39
+ @Suppress(" UNCHECKED_CAST" )
40
+ private val itemsToHelpTooltip = hashMapOf(
41
+ (testFrameworks as ComboBox <CodeGenerationSettingItem >) to ContextHelpLabel .create(" " ),
42
+ )
43
+
27
44
init {
28
45
title = " Generate tests with UtBot"
29
46
setResizable(false )
30
47
init ()
31
48
}
32
49
50
+ @Suppress(" UNCHECKED_CAST" )
33
51
override fun createCenterPanel (): JComponent {
34
52
panel = panel {
35
53
row(" Test source root:" ) {
36
54
component(testSourceFolderField)
37
55
}
56
+ row(" Test framework:" ) {
57
+ makePanelWithHelpTooltip(
58
+ testFrameworks as ComboBox <CodeGenerationSettingItem >,
59
+ itemsToHelpTooltip[testFrameworks]
60
+ )
61
+ }
38
62
row(" Generate test methods for:" ) {}
39
63
row {
40
64
scrollPane(functionsTable)
41
65
}
42
66
}
43
- initDefaultValues()
44
67
checkBoxUpdate()
45
68
return panel
46
69
}
@@ -58,11 +81,14 @@ class JsDialogWindow(val model: JsTestsModel): DialogWrapper(model.project) {
58
81
}
59
82
}
60
83
61
- private fun initDefaultValues () {
62
- }
63
-
64
- private fun setListeners () {
65
- }
66
-
67
84
private fun checkMembers (members : Collection <JSMemberInfo >) = members.forEach { it.isChecked = true }
85
+
86
+ private fun Row.makePanelWithHelpTooltip (
87
+ mainComponent : JComponent ,
88
+ contextHelpLabel : ContextHelpLabel ?
89
+ ): CellBuilder <JPanel > =
90
+ component(Panel ().apply {
91
+ add(mainComponent, BorderLayout .LINE_START )
92
+ contextHelpLabel?.let { add(it, BorderLayout .LINE_END ) }
93
+ })
68
94
}
0 commit comments