mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui-dsl: remove code duplication
GitOrigin-RevId: d9fb30780370c03f14dd4415ffd74bccf686f4aa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
66e9b89b03
commit
6b887c4c0c
@@ -31,7 +31,6 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.ui.layout.*
|
||||
import javax.swing.AbstractButton
|
||||
import javax.swing.JComponent
|
||||
|
||||
class ExternalDiffSettingsPanel {
|
||||
@@ -43,7 +42,7 @@ class ExternalDiffSettingsPanel {
|
||||
panel = panel {
|
||||
blockRow {
|
||||
val diffEnabled = checkBox(DiffBundle.message("settings.external.diff.enable.external.diff.tool"), settings::isDiffEnabled)
|
||||
enableSubRowsIfSelected(diffEnabled.component)
|
||||
enableSubRowsIf(diffEnabled.component.selected)
|
||||
|
||||
row {
|
||||
row(DiffBundle.message("settings.external.diff.path.to.executable")) {
|
||||
@@ -68,7 +67,7 @@ class ExternalDiffSettingsPanel {
|
||||
|
||||
blockRow {
|
||||
val mergeEnabled = checkBox(DiffBundle.message("settings.external.diff.enable.external.merge.tool"), settings::isMergeEnabled)
|
||||
enableSubRowsIfSelected(mergeEnabled.component)
|
||||
enableSubRowsIf(mergeEnabled.component.selected)
|
||||
|
||||
row {
|
||||
row(DiffBundle.message("settings.external.diff.path.to.executable.merge")) {
|
||||
@@ -111,15 +110,6 @@ class ExternalDiffSettingsPanel {
|
||||
panel.reset()
|
||||
}
|
||||
|
||||
private fun Row.enableSubRowsIfSelected(button: AbstractButton): Row {
|
||||
subRowsEnabled = button.isSelected
|
||||
button.addChangeListener {
|
||||
subRowsEnabled = button.isSelected
|
||||
button.parent?.repaint() // Repaint all dependent components in sync
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
private fun Cell.executableTextField(title: @NlsContexts.DialogTitle String,
|
||||
modelGet: () -> String,
|
||||
modelSet: (String) -> Unit): CellBuilder<TextFieldWithBrowseButton> {
|
||||
|
||||
@@ -76,8 +76,5 @@ fun FileChooserDescriptor.chooseFile(event: AnActionEvent, fileChosen: (chosenFi
|
||||
}
|
||||
|
||||
fun Row.attachSubRowsEnabled(component: AbstractButton) {
|
||||
subRowsEnabled = component.isSelected
|
||||
component.addChangeListener {
|
||||
subRowsEnabled = component.isSelected
|
||||
}
|
||||
enableSubRowsIf(component.selected)
|
||||
}
|
||||
|
||||
@@ -155,6 +155,8 @@ internal class MigLayoutRow(private val parent: MigLayoutRow?,
|
||||
it.enabled = value
|
||||
it.subRowsEnabled = value
|
||||
}
|
||||
|
||||
components.firstOrNull()?.parent?.repaint() // Repaint all dependent components in sync
|
||||
}
|
||||
|
||||
override var subRowsVisible = true
|
||||
|
||||
Reference in New Issue
Block a user