how can I bind value of a JCheckBox to enabling and disabling rows in a LayoutBuilder using Kotlin. (in Configurable::createComponent)
Answered
So, following on from my previous question. I'm now adding some fields to do with proxy settings into my createComponent() method, like this:
override fun createComponent(): JComponent = com.intellij.ui.layout.panel {
titledRow("Proxy Settings") {}
row("Use Proxy") { CheckBox("enabled", false)() }
row("host") { JBTextField()(push) }
row("port") { JBTextField()(push) }
}
I'd like to dynamically enabled/disable the host and port inputs when the user checks the box for enable proxy. I tried instantiating the Checkbox in the line before so that I could set the rows (for host & port) to enabled based on it's value but that didn't work. Any ideas?
This is a theme that I'll be reusing all over the settings page as I have a lot of fields that are dependant on the choices of related inputs.
Please sign in to leave a comment.
See com.intellij.util.net.HttpConfigurable
As before, I've got it working so will show my code:
This results in my settings looking like:
So I'm fairly happy but would like to know the following:
Do you really need separate Proxy configuration than the one shared from IDE settings? Preferences | Appearance & Behavior | System Settings | HTTP Proxy
(3) no
Good point. The proxy settings are an example of the kind of thing I'm doing in the settings for this plugin. In the case of the proxy though, perhaps a good experience would be to keep the checkbox and display the values that would be used if enabled with a link to the IDE wide proxy settings if the user wants to change them. If you can provide any pointers in getting that information I'll give it a go.
In case anyone else wants to access IDE proxy settings, this is what I'm doing to give the user the option of using them in my plugin: