@@ -20,16 +20,11 @@ import com.intellij.ui.dsl.builder.bindSelected
20
20
import com.intellij.ui.dsl.builder.bindText
21
21
import com.intellij.ui.dsl.builder.columns
22
22
import com.intellij.ui.dsl.builder.panel
23
- import com.intellij.ui.layout.ComponentPredicate
24
23
import kotlin.reflect.KMutableProperty0
25
24
import org.utbot.cpp.clion.plugin.UTBot
26
25
import org.utbot.cpp.clion.plugin.listeners.UTBotSettingsChangedListener
27
- import org.utbot.cpp.clion.plugin.ui.ObservableValue
28
26
import org.utbot.cpp.clion.plugin.ui.sourceFoldersView.UTBotProjectViewPaneForSettings
29
27
import org.utbot.cpp.clion.plugin.utils.commandLineEditor
30
- import org.utbot.cpp.clion.plugin.utils.isWindows
31
- import org.utbot.cpp.clion.plugin.utils.path
32
- import org.utbot.cpp.clion.plugin.utils.toWslFormatIfNeeded
33
28
import java.awt.Dimension
34
29
35
30
class UTBotConfigurable (private val myProject : Project ) : BoundConfigurable(
@@ -39,10 +34,9 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
39
34
private val panel by lazy { createMainPanel() }
40
35
41
36
private val settings: UTBotProjectStoredSettings = myProject.service()
42
- private lateinit var portTextfield : JBTextField
37
+ private lateinit var portTextField : JBTextField
43
38
private lateinit var serverNameTextField: JBTextField
44
39
45
- private val isLocalOrWsl = ObservableValue (settings.isLocalOrWslScenario)
46
40
47
41
init {
48
42
myProject.messageBus.connect()
@@ -76,45 +70,19 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
76
70
private fun Panel.createConnectionSettings () {
77
71
row(UTBot .message(" settings.project.port" )) {
78
72
intTextField().bindIntText(projectIndependentSettings::port).applyToComponent {
79
- portTextfield = this
73
+ portTextField = this
80
74
maximumSize = TEXT_FIELD_MAX_SIZE
81
75
}
82
76
}.rowComment(UTBot .message(" deployment.utbotPort.description" ))
83
77
84
- row {
85
- checkBox(" Local or WSL scenario" )
86
- .bindSelected(settings::isLocalOrWslScenario)
87
- .applyToComponent {
88
- this .addActionListener {
89
- isLocalOrWsl.value = ! isLocalOrWsl.value
90
- }
91
- }
92
- }
93
-
94
- val enabledIfNotLocalOrWslScenario = object : ComponentPredicate () {
95
- override fun invoke (): Boolean = ! isLocalOrWsl.value
96
- override fun addListener (listener : (Boolean ) -> Unit ) =
97
- isLocalOrWsl.addOnChangeListener { value -> listener(! value) }
98
- }
99
-
100
78
row(UTBot .message(" settings.project.serverName" )) {
101
79
textField().bindText(projectIndependentSettings::serverName).applyToComponent {
102
80
serverNameTextField = this
103
- isLocalOrWsl.addOnChangeListener { newValue ->
104
- if (newValue)
105
- this .text = " localhost"
106
- }
107
- }.enabledIf(enabledIfNotLocalOrWslScenario)
81
+ }
108
82
}.rowComment(UTBot .message(" deployment.utbotHost.description" ))
109
83
110
84
row(UTBot .message(" settings.project.remotePath" )) {
111
85
textField().bindText(settings::remotePath).columns(COLUMNS_LARGE )
112
- .applyToComponent {
113
- isLocalOrWsl.addOnChangeListener { newValue ->
114
- if (newValue)
115
- this .text = if (isWindows) myProject.path.toWslFormatIfNeeded() else " "
116
- }
117
- }.enabledIf(enabledIfNotLocalOrWslScenario)
118
86
}.rowComment(UTBot .message(" deployment.remotePath.description" ))
119
87
}
120
88
@@ -223,7 +191,7 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
223
191
224
192
override fun apply () {
225
193
val wereConnectionSettingsModified =
226
- portTextfield .text != projectIndependentSettings.port.toString() || serverNameTextField.text != projectIndependentSettings.serverName
194
+ portTextField .text != projectIndependentSettings.port.toString() || serverNameTextField.text != projectIndependentSettings.serverName
227
195
panel.apply ()
228
196
myProject.settings.fireUTBotSettingsChanged()
229
197
if (wereConnectionSettingsModified)
0 commit comments