From e63b8a7f25ebf08e190936282717aa6dabd7d00d Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 4 Sep 2024 11:16:12 +0200 Subject: [PATCH] [project] pruning `FileChooserDescriptor` overrides (IJPL-150176 prerequisite) `BrowseFolderRunnable` and `*WithBrowseButton` family: getting rid of separate "title" and "description" parameters in favor of the chooser descriptor object, to avoid cloning the latter down the road. GitOrigin-RevId: 33ec5968a1db953c60848974135055c288accf85 --- .../rider/plugins/efcore/ui/DslExtensions.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/DslExtensions.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/DslExtensions.kt index 6fea8dcd..383322d8 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/DslExtensions.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/DslExtensions.kt @@ -5,12 +5,13 @@ import com.intellij.openapi.editor.colors.EditorFontType import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory import com.intellij.openapi.project.Project import com.intellij.openapi.ui.TextFieldWithBrowseButton +import com.intellij.openapi.util.NlsContexts import com.intellij.ui.components.fields.ExpandableTextField import com.intellij.ui.dsl.builder.Cell import com.intellij.ui.dsl.builder.Row import com.intellij.ui.dsl.builder.bindText -import com.jetbrains.rdclient.util.idea.toIOFile import com.jetbrains.observables.ObservableProperty +import com.jetbrains.rdclient.util.idea.toIOFile import java.io.File import javax.swing.JComponent @@ -25,13 +26,12 @@ fun JComponent.monospaced(): JComponent = } fun Row.textFieldForRelativeFolder( - basePathGetter: () -> String, - project: Project? = null, - browseDialogTitle: String? = null, + basePathGetter: () -> String, + project: Project? = null, + browseDialogTitle: @NlsContexts.DialogTitle String? = null, ): Cell { - - val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor() - val textFieldWithBrowseButtonCell = textFieldWithBrowseButton(browseDialogTitle, project, fileChooserDescriptor) { + val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(browseDialogTitle) + val textFieldWithBrowseButtonCell = textFieldWithBrowseButton(fileChooserDescriptor, project) { val pathRelativeToAsFile = File(basePathGetter()).path it.toIOFile().relativeTo(File(pathRelativeToAsFile)).path }