@@ -10,9 +10,11 @@ import com.intellij.openapi.options.BoundSearchableConfigurable
10
10
import com.intellij.openapi.project.Project
11
11
import com.intellij.openapi.ui.DialogPanel
12
12
import com.intellij.ui.EditorNotifications
13
- import com.intellij.ui.layout.CellBuilder
14
- import com.intellij.ui.layout.applyToComponent
15
- import com.intellij.ui.layout.panel
13
+ import com.intellij.ui.dsl.builder.Cell
14
+ import com.intellij.ui.dsl.builder.bindSelected
15
+ import com.intellij.ui.dsl.builder.bindText
16
+ import com.intellij.ui.dsl.builder.panel
17
+ import com.intellij.ui.dsl.gridLayout.HorizontalAlign
16
18
import javax.swing.JComponent
17
19
18
20
private const val CONFIGURABLE_ID = " settings.jsgraphql"
@@ -40,65 +42,64 @@ class GraphQLSettingsConfigurable(private val project: Project) :
40
42
41
43
override fun createPanel (): DialogPanel {
42
44
return panel {
43
- titledRow (message(" graphql.settings.introspection" )) {
45
+ group (message(" graphql.settings.introspection" )) {
44
46
row(message(" graphql.settings.introspection.query.label" ) + " :" ) {
45
- expandableTextField(settings::getIntrospectionQuery, settings::setIntrospectionQuery)
46
- .constraints(growX)
47
+ expandableTextField()
48
+ .bindText(settings::getIntrospectionQuery, settings::setIntrospectionQuery)
49
+ .horizontalAlign(HorizontalAlign .FILL )
47
50
.applyToComponent {
48
51
emptyText.text = message(" graphql.settings.introspection.query.empty.text" )
49
52
toolTipText = message(" graphql.settings.introspection.query.tooltip" )
50
53
}
51
54
}
52
55
row {
53
- checkBox(
54
- message(" graphql.settings.introspection.default.values.label" ),
55
- settings::isEnableIntrospectionDefaultValues,
56
- settings::setEnableIntrospectionDefaultValues
57
- ).applyToComponent { toolTipText = message(" graphql.settings.introspection.default.values.tooltip" ) }
56
+ checkBox(message(" graphql.settings.introspection.default.values.label" ))
57
+ .bindSelected(
58
+ settings::isEnableIntrospectionDefaultValues,
59
+ settings::setEnableIntrospectionDefaultValues
60
+ )
61
+ .applyToComponent {
62
+ toolTipText = message(" graphql.settings.introspection.default.values.tooltip" )
63
+ }
58
64
}
59
65
row {
60
- checkBox(
61
- message(" graphql.settings.introspection.repeatable.directives.label" ),
62
- settings::isEnableIntrospectionRepeatableDirectives,
63
- settings::setEnableIntrospectionRepeatableDirectives
64
- ).applyToComponent { toolTipText = message(" graphql.settings.introspection.repeatable.directives.tooltip" ) }
66
+ checkBox(message(" graphql.settings.introspection.repeatable.directives.label" ))
67
+ .bindSelected(
68
+ settings::isEnableIntrospectionRepeatableDirectives,
69
+ settings::setEnableIntrospectionRepeatableDirectives
70
+ )
71
+ .applyToComponent {
72
+ toolTipText = message(" graphql.settings.introspection.repeatable.directives.tooltip" )
73
+ }
65
74
}
66
75
row {
67
- checkBox(
68
- message( " graphql.settings.introspection.open.editor.label " ),
69
- settings::isOpenEditorWithIntrospectionResult,
70
- settings::setOpenEditorWithIntrospectionResult
71
- )
76
+ checkBox(message( " graphql.settings.introspection.open.editor.label " ))
77
+ .bindSelected(
78
+ settings::isOpenEditorWithIntrospectionResult,
79
+ settings::setOpenEditorWithIntrospectionResult
80
+ )
72
81
}
73
82
}
74
-
75
- titledRow(message(" graphql.settings.frameworks" )) {
83
+ group(message(" graphql.settings.frameworks" )) {
76
84
row {
77
- checkBox(
78
- message(" graphql.library.relay" ),
79
- settings::isRelaySupportEnabled,
80
- settings::setRelaySupportEnabled
81
- )
85
+ checkBox(message(" graphql.library.relay" ))
86
+ .bindSelected(settings::isRelaySupportEnabled, settings::setRelaySupportEnabled)
82
87
.applyToComponent { toolTipText = message(" graphql.settings.frameworks.relay.tooltip" ) }
83
88
.updateLibraries()
84
89
}
85
90
row {
86
- checkBox(
87
- message(" graphql.library.federation" ),
88
- settings::isFederationSupportEnabled,
89
- settings::setFederationSupportEnabled
90
- ).updateLibraries()
91
+ checkBox(message(" graphql.library.federation" ))
92
+ .bindSelected(settings::isFederationSupportEnabled, settings::setFederationSupportEnabled)
93
+ .updateLibraries()
91
94
}
92
95
row {
93
- checkBox(
94
- message(" graphql.library.apollokotlin" ),
95
- settings::isApolloKotlinSupportEnabled,
96
- settings::setApolloKotlinSupportEnabled
97
- ).updateLibraries()
96
+ checkBox(message(" graphql.library.apollokotlin" ))
97
+ .bindSelected(settings::isApolloKotlinSupportEnabled, settings::setApolloKotlinSupportEnabled)
98
+ .updateLibraries()
98
99
}
99
100
}
100
101
}
101
102
}
102
103
103
- private fun <T : JComponent > CellBuilder <T>.updateLibraries (): CellBuilder <T > = onApply { shouldUpdateLibraries = true }
104
+ private fun <T : JComponent > Cell <T>.updateLibraries (): Cell <T > = onApply { shouldUpdateLibraries = true }
104
105
}
0 commit comments