fix: [NO BACKPORT] replace deprecations

This commit is contained in:
FalsePattern 2024-09-20 13:48:41 +02:00
parent a76138ddea
commit f0b7eb14a4
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
2 changed files with 4 additions and 7 deletions

View file

@ -35,27 +35,24 @@ public class TextFieldUtil {
public static TextFieldWithBrowseButton pathToDirectoryTextField(Disposable disposable, public static TextFieldWithBrowseButton pathToDirectoryTextField(Disposable disposable,
@NlsContexts.DialogTitle String dialogTitle, @NlsContexts.DialogTitle String dialogTitle,
Runnable onTextChanged) { Runnable onTextChanged) {
return pathTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor(), return pathTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(dialogTitle),
disposable, disposable,
dialogTitle,
onTextChanged); onTextChanged);
} }
public static TextFieldWithBrowseButton pathToFileTextField(Disposable disposable, public static TextFieldWithBrowseButton pathToFileTextField(Disposable disposable,
@NlsContexts.DialogTitle String dialogTitle, @NlsContexts.DialogTitle String dialogTitle,
Runnable onTextChanged) { Runnable onTextChanged) {
return pathTextField(FileChooserDescriptorFactory.createSingleFileDescriptor(), return pathTextField(FileChooserDescriptorFactory.createSingleFileDescriptor().withTitle(dialogTitle),
disposable, disposable,
dialogTitle,
onTextChanged); onTextChanged);
} }
public static TextFieldWithBrowseButton pathTextField(FileChooserDescriptor fileChooserDescriptor, public static TextFieldWithBrowseButton pathTextField(FileChooserDescriptor fileChooserDescriptor,
Disposable disposable, Disposable disposable,
@NlsContexts.DialogTitle String dialogTitle,
Runnable onTextChanged) { Runnable onTextChanged) {
val component = new TextFieldWithBrowseButton(new ExtendableTextField(), null, disposable); val component = new TextFieldWithBrowseButton(new ExtendableTextField(), null, disposable);
component.addBrowseFolderListener(dialogTitle, null, null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT); component.addBrowseFolderListener(null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
addTextChangeListener(component.getChildComponent(), ignored -> onTextChanged.run()); addTextChangeListener(component.getChildComponent(), ignored -> onTextChanged.run());
return component; return component;

View file

@ -28,7 +28,7 @@ public class WorkingDirectoryComponent extends LabeledComponent<TextFieldWithBro
field = new TextFieldWithBrowseButton(null, parent); field = new TextFieldWithBrowseButton(null, parent);
var fileChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor(); var fileChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor();
fileChooser.setTitle(ExecutionBundle.message("select.working.directory.message")); fileChooser.setTitle(ExecutionBundle.message("select.working.directory.message"));
field.addBrowseFolderListener(null, null, null, fileChooser); field.addBrowseFolderListener(null, fileChooser);
setComponent(field); setComponent(field);
setText(ExecutionBundle.message("run.configuration.working.directory.label")); setText(ExecutionBundle.message("run.configuration.working.directory.label"));
} }