@@ -7,57 +7,45 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
7
7
import com.intellij.openapi.options.BoundConfigurable
8
8
import com.intellij.openapi.options.SearchableConfigurable
9
9
import com.intellij.openapi.ui.emptyText
10
- import com.intellij.openapi.util.ClearableLazyValue
11
10
import com.intellij.ui.components.JBTextField
12
11
import com.intellij.ui.dsl.builder.Align
13
12
import com.intellij.ui.dsl.builder.bindText
14
13
import com.intellij.ui.dsl.builder.panel
15
14
import com.intellij.ui.layout.applyToComponent
16
- import software.aws.toolkits.jetbrains.ui.ValidatingPanel
17
15
import software.aws.toolkits.resources.message
18
16
import java.nio.file.Path
19
17
20
18
class ToolConfigurable : BoundConfigurable (message("executableCommon.configurable.title")), SearchableConfigurable {
21
19
private val settings = ToolSettings .getInstance()
22
20
private val manager = ToolManager .getInstance()
23
- private val panel = ClearableLazyValue .create {
24
- ValidatingPanel (
25
- disposable ? : throw RuntimeException (" Should never happen as `createPanel` is called after disposable is assigned" ),
26
- checkContinuously = false ,
27
- contentPanel = panel {
28
- ToolType .EP_NAME .extensionList.forEach { toolType ->
29
- row(toolType.displayName) {
30
- textFieldWithBrowseButton(fileChooserDescriptor = FileChooserDescriptorFactory .createSingleFileDescriptor())
31
- .bindText(
32
- { settings.getExecutablePath(toolType) ? : " " },
33
- { settings.setExecutablePath(toolType, it.takeIf { v -> v.isNotBlank() }) }
34
- )
35
- .validationOnApply {
36
- it.textField.text.takeIf { t -> t.isNotBlank() }?.let { path ->
37
- manager.validateCompatability(Path .of(path), toolType).toValidationInfo(toolType, component)
38
- }
39
- }.applyToComponent {
40
- setEmptyText(toolType, textField as JBTextField )
41
- }.resizableColumn()
42
- .align(Align .FILL )
43
-
44
- browserLink(message(" aws.settings.learn_more" ), toolType.documentationUrl())
45
- }
21
+ private val panel by lazy {
22
+ panel {
23
+ ToolType .EP_NAME .extensionList.forEach { toolType ->
24
+ row(toolType.displayName) {
25
+ textFieldWithBrowseButton(fileChooserDescriptor = FileChooserDescriptorFactory .createSingleFileDescriptor())
26
+ .bindText(
27
+ { settings.getExecutablePath(toolType) ? : " " },
28
+ { settings.setExecutablePath(toolType, it.takeIf { v -> v.isNotBlank() }) }
29
+ )
30
+ .validationOnInput {
31
+ it.textField.text.takeIf { t -> t.isNotBlank() }?.let { path ->
32
+ manager.validateCompatability(Path .of(path), toolType).toValidationInfo(toolType, component)
33
+ }
34
+ }.applyToComponent {
35
+ setEmptyText(toolType, textField as JBTextField )
36
+ }.resizableColumn()
37
+ .align(Align .FILL )
38
+
39
+ browserLink(message(" aws.settings.learn_more" ), toolType.documentationUrl())
46
40
}
47
- },
48
- emptyMap()
49
- )
41
+ }
42
+ }
50
43
}
51
44
52
- override fun createPanel () = panel.value.contentPanel
45
+ override fun createPanel () = panel
53
46
54
47
override fun apply () {
55
- panel.value.apply ()
56
- }
57
-
58
- override fun disposeUIResources () {
59
- // TODO: why are we overriding and not allowing the disposable to be disposed?
60
- panel.drop()
48
+ panel.apply ()
61
49
}
62
50
63
51
override fun getId (): String = " aws.tools"
0 commit comments