[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
This commit is contained in:
Roman Shevchenko
2024-09-04 11:16:12 +02:00
committed by intellij-monorepo-bot
parent 5656c23f5c
commit a5666abead
162 changed files with 1161 additions and 1515 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.javaee;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
@@ -12,16 +12,13 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
* @author Dmitry Avdeev
*/
public class XMLCatalogConfigurable implements Configurable {
private TextFieldWithBrowseButton myPropertyFile;
private JPanel myPanel;
public XMLCatalogConfigurable() {
myPropertyFile.addBrowseFolderListener(XmlBundle.message("xml.catalog.properties.file"), null, null,
new FileChooserDescriptor(true, false, false, false, false, false));
myPropertyFile.addBrowseFolderListener(null, new FileChooserDescriptor(true, false, false, false, false, false)
.withTitle(XmlBundle.message("xml.catalog.properties.file")));
}
@Override

View File

@@ -20,10 +20,8 @@ import com.intellij.application.options.CodeStyle;
import com.intellij.ide.highlighter.DTDFileType;
import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.ComboBox;
@@ -130,12 +128,12 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings {
final SchemaType outputType = getOutputType();
myLineLength.setEnabled(outputType == SchemaType.DTD || outputType == SchemaType.RNC);
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
final Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(firstFile);
var descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor()
.withTitle(RelaxngBundle.message("relaxng.convert-schema.settings.destination.title"))
.withDescription(RelaxngBundle.message("relaxng.convert-schema.settings.destination.message"));
var module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(firstFile);
descriptor.putUserData(LangDataKeys.MODULE_CONTEXT, module);
myOutputDestination.addBrowseFolderListener(RelaxngBundle.message("relaxng.convert-schema.settings.destination.title"),
RelaxngBundle.message("relaxng.convert-schema.settings.destination.message"), project, descriptor);
myOutputDestination.addBrowseFolderListener(project, descriptor);
final JTextField tf = myOutputDestination.getTextField();
tf.getDocument().addDocumentListener(new DocumentAdapter() {
@@ -256,4 +254,4 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings {
public boolean hasAdvancedSettings() {
return getOutputType() == SchemaType.XSD || myInputType == SchemaType.DTD;
}
}
}