@@ -4,17 +4,19 @@ import com.intellij.openapi.components.service
4
4
import com.intellij.openapi.project.Project
5
5
import com.intellij.openapi.ui.DialogPanel
6
6
import com.intellij.ui.ContextHelpLabel
7
+ import com.intellij.ui.components.JBLabel
7
8
import com.intellij.ui.layout.CCFlags
8
9
import com.intellij.ui.layout.LayoutBuilder
9
10
import com.intellij.ui.layout.PropertyBinding
10
11
import com.intellij.ui.layout.labelTable
11
12
import com.intellij.ui.layout.panel
12
13
import com.intellij.ui.layout.slider
13
14
import com.intellij.ui.layout.withValueBinding
15
+ import com.intellij.util.castSafelyTo
14
16
import com.intellij.util.ui.UIUtil
17
+ import com.intellij.util.ui.components.BorderLayoutPanel
15
18
import javax.swing.DefaultComboBoxModel
16
19
import javax.swing.JCheckBox
17
- import javax.swing.JLabel
18
20
import javax.swing.JPanel
19
21
import kotlin.reflect.KClass
20
22
import org.utbot.framework.UtSettings
@@ -26,6 +28,7 @@ import org.utbot.framework.plugin.api.CodegenLanguage
26
28
import org.utbot.framework.plugin.api.JavaDocCommentStyle
27
29
import org.utbot.framework.plugin.api.TreatOverflowAsError
28
30
import org.utbot.intellij.plugin.ui.components.CodeGenerationSettingItemRenderer
31
+ import javax.swing.JSlider
29
32
30
33
class SettingsWindow (val project : Project ) {
31
34
private val settings = project.service<Settings >()
@@ -127,20 +130,34 @@ class SettingsWindow(val project: Project) {
127
130
128
131
}
129
132
130
- row(" Code analysis:" ) {
133
+ val fuzzLabel = JBLabel (" Fuzzing" )
134
+ val symLabel = JBLabel (" Symbolic execution" )
135
+ row(" Test generation method:" ) {
131
136
enabled = UtSettings .useFuzzing
132
- val granularity = 60
137
+ val granularity = 20
133
138
slider(0 , granularity, 1 , granularity / 4 )
134
139
.labelTable {
135
- put(0 , JLabel (" Simpler" ))
136
- put(granularity, JLabel (" Deeper" ))
140
+ // clear all labels
137
141
}.withValueBinding(
138
142
PropertyBinding (
139
143
get = { ((1 - settings.fuzzingValue) * granularity).toInt() },
140
144
set = { settings.fuzzingValue = 1 - it / granularity.toDouble() }
141
145
)
142
146
)
143
147
.constraints(CCFlags .growX)
148
+ .component.castSafelyTo<JSlider >()?.apply {
149
+ toolTipText = " Choose the time allocated for each method within tests generation timeout per class"
150
+ addChangeListener {
151
+ fuzzLabel.text = " Fuzzing " + " %.0f %%" .format(100.0 * (granularity - value) / granularity)
152
+ symLabel.text = " %.0f %%" .format(100.0 * value / granularity) + " Symbolic execution"
153
+ }
154
+ }
155
+ }
156
+ row(" " ) {
157
+ BorderLayoutPanel ().apply {
158
+ addToLeft(fuzzLabel)
159
+ addToRight(symLabel)
160
+ }().constraints(CCFlags .growX)
144
161
}
145
162
}
146
163
0 commit comments