'JetBrains Platform SDK textField property not updating
I'm getting into JetBrains plugin development and currently working on a tool window with Kotlin UI DSL. The UI renders fine but typing on the text field is not updating the property it is bound to, in this case regex. Here's my code.
class RegexTesterToolWindowFactory : ToolWindowFactory {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val regexTesterToolWindow = RegexTesterToolWindow(toolWindow)
val contentFactory = ContentFactory.SERVICE.getInstance()
val content = contentFactory.createContent(regexTesterToolWindow.content, "", false)
toolWindow.contentManager.addContent(content)
}
}
private val LOG = logger<RegexTesterToolWindow>()
class RegexTesterToolWindow(toolWindow: ToolWindow) {
private var regex: String = ".*"
private var testText: String = ""
var content: JPanel
init {
content = panel {
row("Regex:") {
textField(::regex)
}
row {
button("Run") {
LOG.info(regex)
LOG.info(testText)
}
}
}
}
}
When I hit the Run button, regex is always the default value .* even after I manually type in the text field.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
