mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[project] reviewing use of file-based filters in choosers (IJPL-150176)
... and amending/replacing them with extension-based filters where possible GitOrigin-RevId: 422e4f42ac96c295a707eae76ef25686753fc6ce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a28c8ee586
commit
9b43719207
@@ -5,6 +5,7 @@ import com.intellij.application.options.colors.ColorAndFontOptions;
|
||||
import com.intellij.application.options.colors.SimpleEditorPreview;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.IdeCoreBundle;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -38,7 +39,9 @@ import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.intellij.images.ImagesBundle;
|
||||
import org.intellij.images.fileTypes.ImageFileTypeManager;
|
||||
import org.intellij.images.fileTypes.impl.SvgFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -220,8 +223,7 @@ public class BackgroundImageDialog extends DialogWrapper {
|
||||
((CardLayout)myPreviewPanel.getLayout()).show(myPreviewPanel, EDITOR);
|
||||
myPathField.getComboBox().setEditable(true);
|
||||
var descriptor = new FileChooserDescriptor(true, false, false, false, true, false)
|
||||
.withFileFilter(file -> ImageFileTypeManager.getInstance().isImage(file))
|
||||
.withExtensionFilter(ImageFileTypeManager.getInstance().getImageFileType());
|
||||
.withExtensionFilter(IdeCoreBundle.message("file.chooser.files.label", ImagesBundle.message("filetype.images.display.name")), ImageFileTypeManager.getInstance().getImageFileType(), SvgFileType.INSTANCE);
|
||||
myPathField.addBrowseFolderListener(null, descriptor, TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);
|
||||
JTextComponent textComponent = getComboEditor();
|
||||
textComponent.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
package com.intellij.compiler.impl.javaCompiler.eclipse
|
||||
|
||||
import com.intellij.compiler.impl.javaCompiler.CompilerModuleOptionsComponent
|
||||
import com.intellij.ide.highlighter.ArchiveFileType
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton
|
||||
@@ -45,9 +43,9 @@ class EclipseCompilerConfigurableUi(project: Project) {
|
||||
}
|
||||
.bottomGap(BottomGap.SMALL)
|
||||
row {
|
||||
val descriptor = object : FileChooserDescriptor(true, false, true, true, false, false) {}
|
||||
val descriptor = FileChooserDescriptor(true, false, true, true, false, false)
|
||||
.withTitle(JavaCompilerBundle.message("path.to.ecj.compiler.tool"))
|
||||
.withFileFilter { file -> FileTypeRegistry.getInstance().isFileOfType(file, ArchiveFileType.INSTANCE) }
|
||||
.withExtensionFilter("jar")
|
||||
pathToEcjField = textFieldWithBrowseButton(descriptor, project)
|
||||
.align(AlignX.FILL)
|
||||
.label(JavaCompilerBundle.message("eclipse.compiler.path.label"), LabelPosition.TOP)
|
||||
|
||||
@@ -236,9 +236,8 @@ abstract class CommonStarterInitialStep(
|
||||
}
|
||||
|
||||
private fun Row.projectLocationField(locationProperty: GraphProperty<String>, wizardContext: WizardContext): Cell<TextFieldWithBrowseButton> {
|
||||
val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor()
|
||||
val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor()
|
||||
.withTitle(message("title.select.project.file.directory", wizardContext.presentationName))
|
||||
.withFileFilter { it.isDirectory }
|
||||
.withPathToTextConvertor(::getPresentablePath)
|
||||
.withTextToPathConvertor(::getCanonicalPath)
|
||||
val property = locationProperty.transform(::getPresentablePath, ::getCanonicalPath)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2022 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.openapi.externalSystem.action;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeCoreBundle;
|
||||
import com.intellij.ide.JavaUiBundle;
|
||||
import com.intellij.ide.actions.ImportModuleAction;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
@@ -15,6 +16,7 @@ import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExtern
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemActionsCollector;
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -93,12 +95,14 @@ public final class AttachExternalProjectAction extends DumbAwareAction {
|
||||
@NotNull Project project,
|
||||
@NotNull ProjectSystemId externalSystemId
|
||||
) {
|
||||
ExternalSystemUnlinkedProjectAware unlinkedProjectAware = ExternalSystemUnlinkedProjectAware.getInstance(externalSystemId);
|
||||
var unlinkedProjectAware = ExternalSystemUnlinkedProjectAware.getInstance(externalSystemId);
|
||||
if (unlinkedProjectAware == null) {
|
||||
return manager.getExternalProjectDescriptor();
|
||||
}
|
||||
return new FileChooserDescriptor(true, true, false, false, false, false)
|
||||
.withFileFilter(virtualFile -> unlinkedProjectAware.isBuildFile(project, virtualFile));
|
||||
var descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor()
|
||||
.withFileFilter(file -> unlinkedProjectAware.isBuildFile(project, file));
|
||||
var extensions = unlinkedProjectAware.buildFileExtensions();
|
||||
return extensions.length == 0 ? descriptor : descriptor.withExtensionFilter(IdeCoreBundle.message("file.chooser.files.label", unlinkedProjectAware.getSystemId().getReadableName()), extensions);
|
||||
}
|
||||
|
||||
private static Predicate<VirtualFile> getSelectedFileValidator(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// 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.openapi.roots.ui.configuration.libraryEditor;
|
||||
|
||||
import com.intellij.codeInsight.ExternalAnnotationsManager;
|
||||
@@ -6,7 +6,6 @@ import com.intellij.ide.JavaUiBundle;
|
||||
import com.intellij.ide.highlighter.JavaClassFileType;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileElement;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -19,7 +18,6 @@ import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.ui.*;
|
||||
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
@@ -34,24 +32,21 @@ import javax.swing.*;
|
||||
import java.util.*;
|
||||
|
||||
public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponentDescriptor {
|
||||
private static final Set<String> NATIVE_LIBRARY_EXTENSIONS = CollectionFactory.createFilePathSet(Arrays.asList("dll", "so", "dylib"));
|
||||
|
||||
public static final Condition<VirtualFile> LIBRARY_ROOT_CONDITION = file -> FileElement.isArchive(file) || isNativeLibrary(file);
|
||||
private static final Set<String> NATIVE_LIBRARY_EXTENSIONS = CollectionFactory.createFilePathSet(List.of("dll", "so", "dylib"));
|
||||
private static final String[] LIBRARY_EXTENSIONS = {"jar", "zip", "dll", "so", "dylib"};
|
||||
|
||||
@Override
|
||||
public OrderRootTypePresentation getRootTypePresentation(@NotNull OrderRootType type) {
|
||||
return getDefaultPresentation(type);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends AttachRootButtonDescriptor> createAttachButtons() {
|
||||
return Collections.singletonList(new AttachUrlJavadocDescriptor());
|
||||
public @NotNull List<? extends AttachRootButtonDescriptor> createAttachButtons() {
|
||||
return List.of(new AttachUrlJavadocDescriptor());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends RootDetector> getRootDetectors() {
|
||||
public @NotNull List<? extends RootDetector> getRootDetectors() {
|
||||
List<RootDetector> results = new ArrayList<>();
|
||||
results.add(new DescendentBasedRootFilter(OrderRootType.CLASSES, false, "classes",
|
||||
file -> FileTypeRegistry.getInstance().isFileOfType(file, JavaClassFileType.INSTANCE)
|
||||
@@ -66,10 +61,12 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
return results;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static DescendentBasedRootFilter createAnnotationsRootDetector() {
|
||||
return new DescendentBasedRootFilter(AnnotationOrderRootType.getInstance(), false, "external annotations",
|
||||
file -> ExternalAnnotationsManager.ANNOTATIONS_XML.equals(file.getName()));
|
||||
@Override
|
||||
public @NotNull FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) {
|
||||
return new FileChooserDescriptor(true, true, true, false, true, true)
|
||||
.withExtensionFilter(ProjectBundle.message("library.attach.files.label"), LIBRARY_EXTENSIONS)
|
||||
.withTitle(StringUtil.isEmpty(libraryName) ? ProjectBundle.message("library.attach.files.action") : ProjectBundle.message("library.attach.files.to.library.action", libraryName))
|
||||
.withDescription(JavaUiBundle.message("library.java.attach.files.description"));
|
||||
}
|
||||
|
||||
private static boolean isNativeLibrary(VirtualFile file) {
|
||||
@@ -77,14 +74,9 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
return extension != null && NATIVE_LIBRARY_EXTENSIONS.contains(extension);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true).withFileFilter(LIBRARY_ROOT_CONDITION);
|
||||
descriptor.setTitle(StringUtil.isEmpty(libraryName) ? ProjectBundle.message("library.attach.files.action")
|
||||
: ProjectBundle.message("library.attach.files.to.library.action", libraryName));
|
||||
descriptor.setDescription(JavaUiBundle.message("library.java.attach.files.description"));
|
||||
return descriptor;
|
||||
public static @NotNull DescendentBasedRootFilter createAnnotationsRootDetector() {
|
||||
return new DescendentBasedRootFilter(AnnotationOrderRootType.getInstance(), false, "external annotations",
|
||||
file -> ExternalAnnotationsManager.ANNOTATIONS_XML.equals(file.getName()));
|
||||
}
|
||||
|
||||
public static OrderRootTypePresentation getDefaultPresentation(OrderRootType type) {
|
||||
@@ -97,9 +89,8 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
super(JavadocOrderRootType.getInstance(), false, "JavaDocs");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator) {
|
||||
public @NotNull Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator) {
|
||||
List<VirtualFile> result = new ArrayList<>();
|
||||
collectJavadocRoots(rootCandidate, result, progressIndicator);
|
||||
JavadocQuarantineStatusCleaner.cleanIfNeeded(VfsUtilCore.toVirtualFileArray(result));
|
||||
@@ -127,9 +118,8 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
super(NativeLibraryOrderRootType.getInstance(), false, "native library location");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator) {
|
||||
public @NotNull Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator) {
|
||||
if (rootCandidate.isInLocalFileSystem()) {
|
||||
if (rootCandidate.isDirectory()) {
|
||||
for (VirtualFile file : rootCandidate.getChildren()) {
|
||||
@@ -160,4 +150,4 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
return vFile != null ? new VirtualFile[]{vFile} : VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,6 @@ class PasswordSafeConfigurableUi(private val settings: PasswordSafeSettings) : C
|
||||
row(CredentialStoreBundle.message("settings.password.database")) {
|
||||
val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor()
|
||||
.withTitle(CredentialStoreBundle.message("passwordSafeConfigurable.keepass.database.file"))
|
||||
.withFileFilter { it.extension.equals("kdbx", ignoreCase = true) }
|
||||
.withExtensionFilter("kdbx")
|
||||
keePassDbFile = textFieldWithBrowseButton(fileChooserDescriptor, fileChosen = {
|
||||
val path = if (it.isDirectory) "${it.path}${File.separator}${DB_FILE_NAME}" else it.path
|
||||
|
||||
@@ -163,6 +163,7 @@ com.intellij.openapi.externalSystem.autoimport.ExternalSystemSettingsFilesReload
|
||||
- onProjectUnlinked(java.lang.String):V
|
||||
com.intellij.openapi.externalSystem.autolink.ExternalSystemUnlinkedProjectAware
|
||||
- sf:Companion:com.intellij.openapi.externalSystem.autolink.ExternalSystemUnlinkedProjectAware$Companion
|
||||
- buildFileExtensions():java.lang.String[]
|
||||
- s:getInstance(com.intellij.openapi.externalSystem.model.ProjectSystemId):com.intellij.openapi.externalSystem.autolink.ExternalSystemUnlinkedProjectAware
|
||||
- a:getSystemId():com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
- a:isBuildFile(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile):Z
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// 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.openapi.externalSystem.autolink
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -20,6 +20,8 @@ interface ExternalSystemUnlinkedProjectAware {
|
||||
|
||||
val systemId: ProjectSystemId
|
||||
|
||||
fun buildFileExtensions(): Array<String> = arrayOf()
|
||||
|
||||
fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean
|
||||
|
||||
fun isLinkedProject(project: Project, externalProjectPath: String): Boolean
|
||||
|
||||
@@ -1494,6 +1494,7 @@ c:com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withDescription(java.lang.String):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withExtensionFilter(com.intellij.openapi.fileTypes.FileType):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withExtensionFilter(java.lang.String):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withExtensionFilter(java.lang.String,com.intellij.openapi.fileTypes.FileType[]):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withExtensionFilter(java.lang.String,java.lang.String[]):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withFileFilter(com.intellij.openapi.util.Condition):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
- withHideIgnored(Z):com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
|
||||
@@ -118,6 +118,7 @@ module.name.inspection.too.few.lines=There are {0} modules in the project but on
|
||||
|
||||
button.text.attach.files=Attach &Files or Directories\u2026
|
||||
library.attach.files.action=Attach Files or Directories
|
||||
library.attach.files.label=Library files
|
||||
library.attach.files.to.library.action=Attach Files or Directories to Library ''{0}''
|
||||
library.attach.files.description=Select files or directories in which library classes, sources and documentation are located
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Allows customizing {@link FileChooser} dialog options.
|
||||
@@ -214,26 +215,40 @@ public class FileChooserDescriptor implements Cloneable {
|
||||
* Sets simple boolean condition for use in {@link #isFileVisible(VirtualFile, boolean)} and {@link #isFileSelectable(VirtualFile)}.
|
||||
* <p/>
|
||||
* In native choosers, has no effect on visibility (use {@link #withExtensionFilter} for that), only on a final eligibility check.
|
||||
* So for simple file type- or extension-based filtering it is better to use {@link #withExtensionFilter}.
|
||||
*/
|
||||
public FileChooserDescriptor withFileFilter(@Nullable Condition<? super VirtualFile> filter) {
|
||||
myFileFilter = filter;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @see #withExtensionFilter(String, String...) */
|
||||
/**
|
||||
* @see #withExtensionFilter(String, String...)
|
||||
* @see FileChooserDescriptorFactory#createSingleFileDescriptor(FileType)
|
||||
* @see FileChooserDescriptorFactory#createSingleFileOrFolderDescriptor(FileType)
|
||||
*/
|
||||
public FileChooserDescriptor withExtensionFilter(@NotNull FileType type) {
|
||||
var extensions = FileTypeManager.getInstance().getAssociations(type).stream()
|
||||
return withExtensionFilter(IdeCoreBundle.message("file.chooser.files.label", type.getName()), type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #withExtensionFilter(String, String...)
|
||||
*/
|
||||
public FileChooserDescriptor withExtensionFilter(@NlsContexts.Label @NotNull String label, @NotNull FileType @NotNull ... types) {
|
||||
if (types.length == 0) throw new IllegalArgumentException("The list must not be empty");
|
||||
var extensions = Stream.of(types)
|
||||
.flatMap(type -> FileTypeManager.getInstance().getAssociations(type).stream())
|
||||
.map(matcher -> matcher instanceof ExtensionFileNameMatcher em ? em.getExtension() : null)
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(String[]::new);
|
||||
return switch (extensions.length) {
|
||||
case 0 -> throw new IllegalArgumentException("Unsupported file type: " + type);
|
||||
case 1 -> withExtensionFilter(extensions[0]);
|
||||
default -> withExtensionFilter(type.getDisplayName(), extensions);
|
||||
};
|
||||
myFileFilter = file -> ContainerUtil.exists(types, type -> FileTypeRegistry.getInstance().isFileOfType(file, type));
|
||||
return withExtensionFilter(label, extensions);
|
||||
}
|
||||
|
||||
/** @see #withExtensionFilter(String, String...) */
|
||||
/**
|
||||
* @see #withExtensionFilter(String, String...)
|
||||
* @see FileChooserDescriptorFactory#createSingleFileDescriptor(String)
|
||||
*/
|
||||
public FileChooserDescriptor withExtensionFilter(@NotNull String extension) {
|
||||
return withExtensionFilter(IdeCoreBundle.message("file.chooser.files.label", extension.toUpperCase(Locale.ROOT)), extension);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
package com.intellij.openapi.fileChooser;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.Strings;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -49,21 +47,15 @@ public final class FileChooserDescriptorFactory {
|
||||
}
|
||||
|
||||
public static FileChooserDescriptor createSingleFileDescriptor(@NotNull FileType fileType) {
|
||||
return createSingleFileNoJarsDescriptor()
|
||||
.withFileFilter(file -> FileTypeRegistry.getInstance().isFileOfType(file, fileType))
|
||||
.withExtensionFilter(fileType);
|
||||
return createSingleFileNoJarsDescriptor().withExtensionFilter(fileType);
|
||||
}
|
||||
|
||||
public static FileChooserDescriptor createSingleFileOrFolderDescriptor(@NotNull FileType fileType) {
|
||||
return createSingleFileOrFolderDescriptor()
|
||||
.withFileFilter(file -> file.isDirectory() || FileTypeRegistry.getInstance().isFileOfType(file, fileType))
|
||||
.withExtensionFilter(fileType);
|
||||
return createSingleFileOrFolderDescriptor().withExtensionFilter(fileType);
|
||||
}
|
||||
|
||||
public static FileChooserDescriptor createSingleFileDescriptor(@NotNull String extension) {
|
||||
return createSingleFileNoJarsDescriptor()
|
||||
.withFileFilter(file -> Strings.endsWithIgnoreCase(file.getName(), '.' + extension))
|
||||
.withExtensionFilter(extension);
|
||||
return createSingleFileNoJarsDescriptor().withExtensionFilter(extension);
|
||||
}
|
||||
|
||||
public static FileChooserDescriptor createSingleFolderDescriptor() {
|
||||
|
||||
@@ -151,7 +151,6 @@ public final class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunn
|
||||
super(true, false, false, false, false, false);
|
||||
putUserData(FileChooserKeys.NEW_FILE_TYPE, UiScriptFileType.getInstance());
|
||||
putUserData(FileChooserKeys.NEW_FILE_TEMPLATE_TEXT, "");
|
||||
withFileFilter(file -> UiScriptFileType.myExtension.equalsIgnoreCase(file.getExtension()));
|
||||
withExtensionFilter(UiScriptFileType.myExtension);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,6 @@ internal class BrowseIconsComboBox(private val customActionsSchema: CustomAction
|
||||
|
||||
private fun browseIconAndSelect() {
|
||||
val descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
||||
.withFileFilter { "svg".equals(it.extension, ignoreCase = true) || "png".equals(it.extension, ignoreCase = true) }
|
||||
.withExtensionFilter(IdeBundle.message("icon.file.filter.label"), "svg", "png")
|
||||
descriptor.title = IdeBundle.message("title.browse.icon")
|
||||
descriptor.description = IdeBundle.message("prompt.browse.icon.for.selected.action")
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.fileChooser.FileChooser
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
||||
import com.intellij.openapi.ide.CopyPasteManager
|
||||
import com.intellij.openapi.progress.runBackgroundableTask
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
@@ -76,10 +75,8 @@ internal open class DumpInvalidTipsAction : AnAction() {
|
||||
internal class SelectAndDumpInvalidTipsAction : DumpInvalidTipsAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.getData(CommonDataKeys.PROJECT)
|
||||
val htmlFileType = FileTypeManager.getInstance().getStdFileType("HTML")
|
||||
val descriptor = FileChooserDescriptor(true, true, false, false, false, true)
|
||||
.withFileFilter { FileTypeRegistry.getInstance().isFileOfType(it, htmlFileType) }
|
||||
.withExtensionFilter(htmlFileType)
|
||||
.withExtensionFilter(FileTypeManager.getInstance().getStdFileType("HTML"))
|
||||
.withDescription("Choose HTML files or folders with tips.")
|
||||
val chosenFiles = FileChooser.chooseFiles(descriptor, project, null)
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.ide.TipsOfTheDayUsagesCollector;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -137,10 +136,8 @@ final class TipDialog extends DialogWrapper {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
|
||||
var htmlFileType = FileTypeManager.getInstance().getStdFileType("HTML");
|
||||
var descriptor = FileChooserDescriptorFactory.createMultipleFilesNoJarsDescriptor()
|
||||
.withFileFilter(file -> FileTypeRegistry.getInstance().isFileOfType(file, htmlFileType))
|
||||
.withExtensionFilter(htmlFileType);
|
||||
.withExtensionFilter(FileTypeManager.getInstance().getStdFileType("HTML"));
|
||||
String value = propertiesComponent.getValue(LAST_OPENED_TIP_PATH);
|
||||
VirtualFile lastOpenedTip = value != null ? LocalFileSystem.getInstance().findFileByPath(value) : null;
|
||||
VirtualFile[] pathToSelect = lastOpenedTip != null ? new VirtualFile[]{lastOpenedTip} : VirtualFile.EMPTY_ARRAY;
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.fileChooser.FileSaverDescriptor;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
@@ -705,10 +704,8 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab
|
||||
}
|
||||
|
||||
private void doImportAction(final DataContext dataContext) {
|
||||
var xmlFileType = FileTypeManager.getInstance().getStdFileType("XML");
|
||||
var descriptor = new FileChooserDescriptor(true, false, false, false, true, false)
|
||||
.withFileFilter(file -> FileTypeRegistry.getInstance().isFileOfType(file, xmlFileType))
|
||||
.withExtensionFilter(xmlFileType)
|
||||
.withExtensionFilter(FileTypeManager.getInstance().getStdFileType("XML"))
|
||||
.withTitle(IntelliLangBundle.message("dialog.file.chooser.title.import.configuration"))
|
||||
.withDescription(IntelliLangBundle.message("dialog.file.chooser.description.please.select.the.configuration.file"));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// 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.lang.ant.config.impl
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType
|
||||
import com.intellij.lang.ant.config.AntBuildFile
|
||||
import com.intellij.lang.ant.config.AntConfigurationBase
|
||||
import com.intellij.lang.ant.config.AntConfigurationListener
|
||||
@@ -21,9 +22,9 @@ import com.intellij.util.PathUtil
|
||||
class AntUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
override val systemId = SYSTEM_ID
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean {
|
||||
return buildFile.name in KNOWN_ANT_FILES
|
||||
}
|
||||
override fun buildFileExtensions(): Array<String> = arrayOf(XmlFileType.DEFAULT_EXTENSION)
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean = buildFile.name in KNOWN_ANT_FILES
|
||||
|
||||
override fun isLinkedProject(project: Project, externalProjectPath: String): Boolean {
|
||||
val antConfiguration = AntConfigurationBase.getInstance(project)
|
||||
@@ -64,4 +65,4 @@ class AntUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ copyright.profiles.empty=No copyright profiles added.
|
||||
copyright.profiles.select.profile=Select a profile to view or edit its details here
|
||||
copyright.scope.column=Scope
|
||||
copyright.select.scopes.label=Select Scopes to add new scopes or modify existing ones
|
||||
dialog.file.chooser.title.choose.file.containing.copyright.notice=Choose File Containing Copyright Notice
|
||||
copyright.file.chooser.title=Choose File Containing Copyright Notice
|
||||
copyright.file.chooser.label=XML|IML files
|
||||
dialog.message.new.copyright.profile.name=New copyright profile name:
|
||||
dialog.message.no.copyright.configured=No copyright configured for current file. Would you like to edit copyright settings?
|
||||
dialog.message.the.copyright.settings.imported=The copyright settings have been successfully imported.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.maddyhome.idea.copyright.ui;
|
||||
|
||||
import com.intellij.copyright.AbstractCopyrightManager;
|
||||
@@ -10,9 +10,7 @@ import com.intellij.ide.highlighter.XmlFileType;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
@@ -227,12 +225,9 @@ final class CopyrightProfilesPanel extends MasterDetailsComponent implements Sea
|
||||
PlatformIcons.IMPORT_ICON) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent event) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
||||
.withFileFilter(file -> {
|
||||
final FileType fileType = file.getFileType();
|
||||
return fileType == ModuleFileType.INSTANCE || fileType == XmlFileType.INSTANCE;
|
||||
})
|
||||
.withTitle(CopyrightBundle.message("dialog.file.chooser.title.choose.file.containing.copyright.notice"));
|
||||
var descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
||||
.withExtensionFilter(CopyrightBundle.message("copyright.file.chooser.label"), ModuleFileType.INSTANCE, XmlFileType.INSTANCE)
|
||||
.withTitle(CopyrightBundle.message("copyright.file.chooser.title"));
|
||||
FileChooser.chooseFile(descriptor, myProject, null, file -> {
|
||||
final List<CopyrightProfile> profiles = ExternalOptionHelper.loadOptions(VfsUtilCore.virtualToIoFile(file));
|
||||
if (profiles == null) return;
|
||||
|
||||
@@ -2,6 +2,7 @@ gradle.name=Gradle
|
||||
|
||||
gradle.filetype.description=Groovy Gradle DSL configuration
|
||||
gradle.filetype.display.name=Groovy Gradle DSL
|
||||
gradle.filter.label=Gradle files
|
||||
|
||||
gradle.settings.text.default=Default
|
||||
|
||||
@@ -281,4 +282,4 @@ advanced.settings.gradle=Build Tools. Gradle
|
||||
advanced.setting.gradle.download.sources=Download sources
|
||||
advanced.setting.gradle.download.sources.description=Download sources for project dependencies during the project import. A project sync is required to download the sources after selecting this option.
|
||||
|
||||
gradle.linking.project=Linking Gradle Project
|
||||
gradle.linking.project=Linking Gradle Project
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.gradle.autolink
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.externalSystem.autolink.ExternalSystemProjectLinkListener
|
||||
import com.intellij.openapi.externalSystem.autolink.ExternalSystemUnlinkedProjectAware
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.plugins.gradle.service.project.open.GradleOpenProjectProvider
|
||||
@@ -11,15 +12,14 @@ import org.jetbrains.plugins.gradle.service.project.open.linkAndSyncGradleProjec
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettingsListener
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants.KNOWN_GRADLE_FILES
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants.SYSTEM_ID
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
|
||||
class GradleUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
override val systemId = SYSTEM_ID
|
||||
override val systemId: ProjectSystemId = GradleConstants.SYSTEM_ID
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean {
|
||||
return buildFile.name in KNOWN_GRADLE_FILES
|
||||
}
|
||||
override fun buildFileExtensions(): Array<String> = GradleConstants.BUILD_FILE_EXTENSIONS
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean = buildFile.name in GradleConstants.KNOWN_GRADLE_FILES
|
||||
|
||||
override fun isLinkedProject(project: Project, externalProjectPath: String): Boolean {
|
||||
val gradleSettings = GradleSettings.getInstance(project)
|
||||
@@ -45,4 +45,4 @@ class GradleUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
override suspend fun unlinkProject(project: Project, externalProjectPath: String) {
|
||||
GradleOpenProjectProvider().unlinkProject(project, externalProjectPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,7 @@ public final class JavaFxApplicationIconsDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
private static void addBrowseListener(TextFieldWithBrowseButton withBrowseButton, String extension, Project project) {
|
||||
withBrowseButton.addBrowseFolderListener(project, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
||||
.withFileFilter(file -> extension.equalsIgnoreCase(file.getExtension()))
|
||||
withBrowseButton.addBrowseFolderListener(project, FileChooserDescriptorFactory.createSingleFileDescriptor(extension)
|
||||
.withTitle(JavaFXBundle.message("javafx.application.icons.select.icon.file.title"))
|
||||
.withDescription(JavaFXBundle.message("javafx.application.icons.select.icon.file.description", extension)));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 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 org.jetbrains.kotlin.idea.base.platforms.library
|
||||
|
||||
import com.intellij.ide.JavaUiBundle
|
||||
@@ -10,7 +10,6 @@ import com.intellij.openapi.project.ProjectBundle
|
||||
import com.intellij.openapi.roots.OrderRootType
|
||||
import com.intellij.openapi.roots.libraries.DummyLibraryProperties
|
||||
import com.intellij.openapi.roots.libraries.LibraryType
|
||||
import com.intellij.openapi.roots.libraries.LibraryType.EP_NAME
|
||||
import com.intellij.openapi.roots.libraries.LibraryTypeService
|
||||
import com.intellij.openapi.roots.libraries.NewLibraryConfiguration
|
||||
import com.intellij.openapi.roots.libraries.ui.DescendentBasedRootFilter
|
||||
@@ -54,9 +53,9 @@ class JSLibraryType : LibraryType<DummyLibraryProperties>(KotlinJavaScriptLibrar
|
||||
|
||||
object RootsComponentDescriptor : DefaultLibraryRootsComponentDescriptor() {
|
||||
override fun createAttachFilesChooserDescriptor(libraryName: String?): FileChooserDescriptor {
|
||||
val descriptor = FileChooserDescriptor(true, true, true, false, true, true).withFileFilter {
|
||||
FileElement.isArchive(it) || isAcceptedForJsLibrary(it.extension)
|
||||
}
|
||||
val descriptor = FileChooserDescriptor(true, true, true, false, true, true)
|
||||
.withExtensionFilter(ProjectBundle.message("library.attach.files.label"), "js", "kjsm")
|
||||
.withFileFilter { FileElement.isArchive(it) || isAcceptedForJsLibrary(it.extension) }
|
||||
descriptor.title = if (StringUtil.isEmpty(libraryName))
|
||||
ProjectBundle.message("library.attach.files.action")
|
||||
else
|
||||
@@ -73,7 +72,7 @@ class JSLibraryType : LibraryType<DummyLibraryProperties>(KotlinJavaScriptLibrar
|
||||
},
|
||||
DescendentBasedRootFilter.createFileTypeBasedFilter(OrderRootType.SOURCES, false, KotlinFileType.INSTANCE, "sources")
|
||||
)
|
||||
|
||||
private fun isAcceptedForJsLibrary(extension: String?): Boolean = extension == "js" || extension == "kjsm"
|
||||
}
|
||||
}
|
||||
|
||||
private fun isAcceptedForJsLibrary(extension: String?): Boolean = extension == "js" || extension == "kjsm"
|
||||
@@ -37,9 +37,8 @@ public class KotlinStandaloneScriptRunConfigurationEditor extends SettingsEditor
|
||||
}
|
||||
|
||||
void initChooseFileField(Project project) {
|
||||
var descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
||||
var descriptor = FileChooserDescriptorFactory.createSingleFileDescriptor(KotlinParserDefinition.STD_SCRIPT_SUFFIX)
|
||||
.withTitle(KotlinRunConfigurationsBundle.message("script.choose.file"))
|
||||
.withFileFilter(file -> file.isDirectory() || KotlinParserDefinition.STD_SCRIPT_SUFFIX.equals(file.getExtension()))
|
||||
.withTreeRootVisible(true);
|
||||
chooseScriptFileTextField.addBrowseFolderListener(project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.maven.project
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.externalSystem.autolink.ExternalSystemProjectLinkListener
|
||||
import com.intellij.openapi.externalSystem.autolink.ExternalSystemUnlinkedProjectAware
|
||||
@@ -16,9 +17,9 @@ import org.jetbrains.idea.maven.wizards.MavenOpenProjectProvider
|
||||
internal class MavenUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
override val systemId: ProjectSystemId = MavenUtil.SYSTEM_ID
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean {
|
||||
return MavenUtil.isPomFile(project, buildFile)
|
||||
}
|
||||
override fun buildFileExtensions(): Array<String> = arrayOf(XmlFileType.DEFAULT_EXTENSION)
|
||||
|
||||
override fun isBuildFile(project: Project, buildFile: VirtualFile): Boolean = MavenUtil.isPomFile(project, buildFile)
|
||||
|
||||
override fun isLinkedProject(project: Project, externalProjectPath: String): Boolean {
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(project)
|
||||
@@ -58,4 +59,4 @@ internal class MavenUnlinkedProjectAware : ExternalSystemUnlinkedProjectAware {
|
||||
.map { it.directory }
|
||||
.toCollection(CollectionFactory.createFilePathSet())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo
|
||||
import com.intellij.openapi.fileChooser.FileChooser
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder.Companion.yesNo
|
||||
import com.intellij.openapi.ui.Messages
|
||||
@@ -91,7 +91,7 @@ class TextMateBundlesListPanel : Disposable {
|
||||
val fileToSelect = PropertiesComponent.getInstance().getValue(TEXTMATE_LAST_ADDED_BUNDLE)?.let { lastAddedBundlePath ->
|
||||
LocalFileSystem.getInstance().findFileByPath(lastAddedBundlePath)
|
||||
}
|
||||
val chooserDescriptor = FileChooserDescriptor(true, true, false, false, false, true).withFileFilter { false }
|
||||
val chooserDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor()
|
||||
val bundleDirectories = FileChooser.chooseFiles(chooserDescriptor, myBundlesList, null, fileToSelect)
|
||||
if (bundleDirectories.isNotEmpty()) {
|
||||
var errorMessage: String? = null
|
||||
|
||||
@@ -479,6 +479,7 @@ sdk.paths.dialog.removed.by.user.suffix=(removed by user)
|
||||
|
||||
sdk.create.venv.dependencies.label=Dependencies:
|
||||
sdk.create.venv.dependencies.chooser=Choose requirements.txt or setup.py
|
||||
sdk.create.venv.dependencies.filter=TXT|PY files
|
||||
|
||||
sdk.create.venv.dialog.label.inherit.global.site.packages=Inherit global site-packages
|
||||
sdk.create.venv.environment.label=Environment:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.sdk.add.v1
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
|
||||
@@ -18,11 +19,11 @@ import com.jetbrains.python.PythonFileType
|
||||
import com.jetbrains.python.pathValidation.PlatformAndRoot
|
||||
import com.jetbrains.python.sdk.PySdkSettings
|
||||
import com.jetbrains.python.sdk.add.PyAddSdkPanel
|
||||
import com.jetbrains.python.sdk.add.PyAddSdkPanel.Companion.validateSdkComboBox
|
||||
import com.jetbrains.python.sdk.add.PySdkPathChoosingComboBox
|
||||
import com.jetbrains.python.sdk.add.addBaseInterpretersAsync
|
||||
import com.jetbrains.python.sdk.add.v1.PyAddNewEnvCollector.InputData
|
||||
import com.jetbrains.python.sdk.add.v1.PyAddNewEnvCollector.RequirementsTxtOrSetupPyData
|
||||
import com.jetbrains.python.sdk.add.PyAddSdkPanel.Companion.validateSdkComboBox
|
||||
import com.jetbrains.python.sdk.add.addBaseInterpretersAsync
|
||||
import com.jetbrains.python.sdk.basePath
|
||||
import org.jetbrains.annotations.SystemDependent
|
||||
import org.jetbrains.annotations.SystemIndependent
|
||||
@@ -62,8 +63,9 @@ class PyAddNewVirtualEnvFromFilePanel(
|
||||
setTextFieldPreferredWidth(it.length)
|
||||
}
|
||||
|
||||
@Suppress("DialogTitleCapitalization")
|
||||
addBrowseFolderListener(module.project, FileChooserDescriptorFactory.createSingleFileDescriptor()
|
||||
.withFileFilter { file -> file.fileType.let { it == PlainTextFileType.INSTANCE || it == PythonFileType.INSTANCE } }
|
||||
.withExtensionFilter(PyBundle.message("sdk.create.venv.dependencies.filter"), PlainTextFileType.INSTANCE, PythonFileType.INSTANCE)
|
||||
.withTitle(PyBundle.message("sdk.create.venv.dependencies.chooser")))
|
||||
}
|
||||
|
||||
@@ -163,4 +165,4 @@ class PyAddNewVirtualEnvFromFilePanel(
|
||||
val baseSdk: Sdk?,
|
||||
val requirementsTxtOrSetupPyPath: @NlsSafe @SystemDependent String,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user