mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
Simplify file chooser API; fix EA-35601
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class JikesConfigurable implements Configurable {
|
||||
myPathField.getButton().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(myPathField, descriptor, null);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myPathField, null, null);
|
||||
if (file != null) {
|
||||
myPathField.setText(file.getPath().replace('/', File.separatorChar));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.compiler.options;
|
||||
import com.intellij.compiler.CompileServerManager;
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
@@ -105,8 +106,8 @@ public class AnnotationProcessorsConfigurable implements SearchableConfigurable,
|
||||
|
||||
myProcessorPathField = new TextFieldWithBrowseButton(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final VirtualFile[] files =
|
||||
FileChooser.chooseFiles(myProcessorPathField, FileChooserDescriptorFactory.createAllButJarContentsDescriptor());
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createAllButJarContentsDescriptor();
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProcessorPathField, myProject, null);
|
||||
if (files.length > 0) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (VirtualFile file : files) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public class DirectoryCopyElementType extends PackagingElementType<DirectoryCopy
|
||||
public List<? extends DirectoryCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor();
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(context.getProject(), descriptor);
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null);
|
||||
final List<DirectoryCopyPackagingElement> list = new ArrayList<DirectoryCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new DirectoryCopyPackagingElement(file.getPath()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -63,8 +62,7 @@ public class ExtractedDirectoryElementType extends PackagingElementType<Extracte
|
||||
return super.isFileSelectable(file);
|
||||
}
|
||||
};
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null);
|
||||
final List<PackagingElement<?>> list = new ArrayList<PackagingElement<?>>();
|
||||
final PackagingElementFactory factory = PackagingElementFactory.getInstance();
|
||||
for (VirtualFile file : files) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -55,8 +54,7 @@ public class FileCopyElementType extends PackagingElementType<FileCopyPackagingE
|
||||
public List<? extends FileCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, true);
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null);
|
||||
final List<FileCopyPackagingElement> list = new ArrayList<FileCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new FileCopyPackagingElement(file.getPath()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -261,7 +261,7 @@ public class ManifestFileUtil {
|
||||
public static VirtualFile showDialogAndCreateManifest(final ArtifactEditorContext context, final CompositePackagingElement<?> element) {
|
||||
FileChooserDescriptor descriptor = createDescriptorForManifestDirectory();
|
||||
final VirtualFile directory = suggestManifestFileDirectory(element, context, context.getArtifactType());
|
||||
final VirtualFile file = FileChooser.chooseFile(context.getProject(), descriptor, directory);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, context.getProject(), directory);
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -105,7 +105,7 @@ public abstract class ElementWithManifestPropertiesPanel<E extends CompositeElem
|
||||
}
|
||||
};
|
||||
descriptor.setTitle("Specify Path to MANIFEST.MF file");
|
||||
final VirtualFile file = FileChooser.chooseFile(myContext.getProject(), descriptor, null);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myContext.getProject(), null);
|
||||
if (file == null) return;
|
||||
|
||||
ManifestFileUtil.addManifestFileToLayout(file.getPath(), myContext, myElement);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -154,7 +154,7 @@ public class ExcludedEntriesConfigurable implements UnnamedConfigurable {
|
||||
selected = myExcludeEntryDescriptions.size();
|
||||
}
|
||||
int savedSelected = selected;
|
||||
VirtualFile[] chosen = FileChooser.chooseFiles(myProject, descriptor);
|
||||
VirtualFile[] chosen = FileChooser.chooseFiles(descriptor, myProject, null);
|
||||
for (final VirtualFile chosenFile : chosen) {
|
||||
if (isFileExcluded(chosenFile)) {
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -276,7 +276,7 @@ public class AttachSourcesNotificationProvider implements EditorNotifications.Pr
|
||||
descriptor.setDescription(ProjectBundle.message("library.attach.sources.description"));
|
||||
final Library firstLibrary = libraries.get(0).getLibrary();
|
||||
VirtualFile[] roots = firstLibrary != null ? firstLibrary.getFiles(OrderRootType.CLASSES) : VirtualFile.EMPTY_ARRAY;
|
||||
VirtualFile[] candidates = FileChooser.chooseFiles(myProject, descriptor, roots.length == 0 ? null : PathUtil.getLocalFile(roots[0]));
|
||||
VirtualFile[] candidates = FileChooser.chooseFiles(descriptor, myProject, roots.length == 0 ? null : PathUtil.getLocalFile(roots[0]));
|
||||
final VirtualFile[] files = PathUIUtils.scanAndSelectDetectedJavaSourceRoots(myParentComponent, candidates);
|
||||
if (files.length == 0) {
|
||||
return new ActionCallback.Rejected();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ public abstract class CustomLibraryDescriptionBase extends CustomLibraryDescript
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, false, false, true);
|
||||
descriptor.setTitle(IdeBundle.message("new.library.file.chooser.title"));
|
||||
descriptor.setDescription(IdeBundle.message("new.library.file.chooser.description"));
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(parentComponent, descriptor, contextDirectory);
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, parentComponent, null, contextDirectory);
|
||||
if (files.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,7 +91,7 @@ public class AnnotationsEditor extends ModuleElementsEditor {
|
||||
FileChooserDescriptor myDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
myDescriptor.setTitle(ProjectBundle.message("add.external.annotations.path.title"));
|
||||
myDescriptor.setDescription(ProjectBundle.message("add.external.annotations.path.description"));
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myTable, myDescriptor);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myTable, myProject, null);
|
||||
final MyTableModel tableModel = (MyTableModel)myTable.getModel();
|
||||
boolean changes = false;
|
||||
for (final VirtualFile file : files) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,7 +94,7 @@ public class JavadocEditor extends ModuleElementsEditor {
|
||||
FileChooserDescriptor myDescriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
|
||||
myDescriptor.setTitle(ProjectBundle.message("module.javadoc.add.path.title"));
|
||||
myDescriptor.setDescription(ProjectBundle.message("module.javadoc.add.path.prompt"));
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myTable, myDescriptor);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myTable, myProject, null);
|
||||
final MyTableModel tableModel = (MyTableModel)myTable.getModel();
|
||||
boolean changes = false;
|
||||
for (final VirtualFile file : files) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
@@ -148,7 +149,8 @@ public class CreateModuleLibraryChooser implements ClasspathElementChooser<Libra
|
||||
}
|
||||
chooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModule);
|
||||
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(myParentComponent, chooserDescriptor, myModule.getProject().getBaseDir());
|
||||
final Project project = myModule.getProject();
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(chooserDescriptor, myParentComponent, project, project.getBaseDir());
|
||||
if (files.length == 0) return Collections.emptyList();
|
||||
|
||||
List<LibraryRootsComponentDescriptor> suitableDescriptors = new ArrayList<LibraryRootsComponentDescriptor>();
|
||||
@@ -167,8 +169,7 @@ public class CreateModuleLibraryChooser implements ClasspathElementChooser<Libra
|
||||
else {
|
||||
rootsComponentDescriptor = myDefaultDescriptor;
|
||||
}
|
||||
List<OrderRoot> chosenRoots = RootDetectionUtil.detectRoots(Arrays.asList(files), myParentComponent, myModule.getProject(),
|
||||
rootsComponentDescriptor);
|
||||
List<OrderRoot> chosenRoots = RootDetectionUtil.detectRoots(Arrays.asList(files), myParentComponent, project, rootsComponentDescriptor);
|
||||
|
||||
final List<OrderRoot> roots = filterAlreadyAdded(chosenRoots);
|
||||
if (roots.isEmpty()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -359,7 +359,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
|
||||
if (myContextModule != null) {
|
||||
chooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myContextModule);
|
||||
}
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(myPanel, chooserDescriptor, initialSelection);
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(chooserDescriptor, myPanel, myProject, initialSelection);
|
||||
if (files.length == 0) return Collections.emptyList();
|
||||
|
||||
return RootDetectionUtil.detectRoots(Arrays.asList(files), myPanel, myProject, myDescriptor);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -252,7 +252,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName()));
|
||||
descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description"));
|
||||
final VirtualFile file = FileChooser.chooseFile(project, descriptor);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, project, null);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,7 +78,7 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends DialogWrapper {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
myDestDirectoryField.getButton().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final VirtualFile file = FileChooser.chooseFile(myDirectory.getProject(), descriptor, directory.getVirtualFile());
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myDirectory.getProject(), directory.getVirtualFile());
|
||||
if (file != null) {
|
||||
myDestDirectoryField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -177,13 +177,11 @@ public class PathEditor {
|
||||
|
||||
private VirtualFile[] doAdd() {
|
||||
VirtualFile baseDir = myAddBaseDir;
|
||||
if (baseDir == null) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
|
||||
if (project != null) {
|
||||
baseDir = project.getBaseDir();
|
||||
}
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
|
||||
if (baseDir == null && project != null) {
|
||||
baseDir = project.getBaseDir();
|
||||
}
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myPanel, myDescriptor, baseDir);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myPanel, project, baseDir);
|
||||
files = adjustAddedFileSet(myPanel, files);
|
||||
List<VirtualFile> added = new ArrayList<VirtualFile>(files.length);
|
||||
for (VirtualFile vFile : files) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,7 +82,7 @@ public class ViewOfflineResultsAction extends AnAction implements DumbAware {
|
||||
|
||||
LOG.assertTrue(project != null);
|
||||
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(project, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR);
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, project, null);
|
||||
if (virtualFile == null || !virtualFile.isDirectory()) return;
|
||||
|
||||
final Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
|
||||
|
||||
protected void initComponents() {
|
||||
myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
|
||||
ExecutionBundle.message("run.configuration.program.parameters"));
|
||||
ExecutionBundle.message("run.configuration.program.parameters"));
|
||||
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
myWorkingDirectoryField = new TextFieldWithBrowseButton(new ActionListener() {
|
||||
@@ -78,7 +78,8 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
|
||||
FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
|
||||
fileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext);
|
||||
VirtualFile file = FileChooser.chooseFile(myWorkingDirectoryComponent, fileChooserDescriptor, null);
|
||||
Project project = myModuleContext != null ? myModuleContext.getProject() : null;
|
||||
VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, myWorkingDirectoryComponent, project, null);
|
||||
if (file != null) {
|
||||
setWorkingDirectory(file.getPresentableUrl());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -199,7 +199,7 @@ public class DetectionExcludesConfigurable implements Configurable {
|
||||
private void chooseDirectoryAndAdd(final @Nullable FrameworkType type) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setDescription((type != null ? type.getPresentableName() + " framework detection" : "Detection for all frameworks") + " will be disabled in selected directory");
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(myMainPanel, descriptor, myProject.getBaseDir());
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myMainPanel, myProject, myProject.getBaseDir());
|
||||
final VirtualFile file = files.length > 0 ? files[0] : null;
|
||||
if (file != null) {
|
||||
addAndRemoveDuplicates(type, file);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,10 +18,7 @@ package com.intellij.ide.macro;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.fileChooser.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -43,8 +40,7 @@ public class FilePromptMacro extends PromptingMacro implements SecondQueueExpand
|
||||
protected String promptUser(DataContext dataContext) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
|
||||
final FileChooserDialog fileChooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project);
|
||||
final VirtualFile[] result = fileChooser.choose(null, project);
|
||||
final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, null);
|
||||
return result.length == 1? FileUtil.toSystemDependentName(result[0].getPath()) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class DumpIntentionsAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final VirtualFile file =
|
||||
FileChooser.chooseFile(e.getData(PlatformDataKeys.PROJECT), FileChooserDescriptorFactory.createSingleFolderDescriptor(), null);
|
||||
FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), e.getData(PlatformDataKeys.PROJECT), null);
|
||||
if (file != null) {
|
||||
final List<IntentionActionMetaData> list = IntentionManagerSettings.getInstance().getMetaData();
|
||||
final File root = VfsUtil.virtualToIoFile(file);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,7 +60,7 @@ public class LibraryTypeServiceImpl extends LibraryTypeService {
|
||||
final Project project) {
|
||||
final FileChooserDescriptor chooserDescriptor = descriptor.createAttachFilesChooserDescriptor();
|
||||
chooserDescriptor.setTitle("Select Library Files");
|
||||
final VirtualFile[] rootCandidates = FileChooser.chooseFiles(parentComponent, chooserDescriptor, contextDirectory);
|
||||
final VirtualFile[] rootCandidates = FileChooser.chooseFiles(chooserDescriptor, parentComponent, project, contextDirectory);
|
||||
if (rootCandidates.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -49,6 +52,6 @@ public abstract class ChooserBasedAttachRootButtonDescriptor extends AttachRootB
|
||||
if (contextModule != null) {
|
||||
chooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, contextModule);
|
||||
}
|
||||
return FileChooser.chooseFiles(parent, chooserDescriptor, initialSelection);
|
||||
return FileChooser.chooseFiles(chooserDescriptor, parent, contextModule != null ? contextModule.getProject() : null, initialSelection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,6 +41,7 @@ import com.intellij.openapi.options.BaseConfigurable;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.*;
|
||||
@@ -119,6 +120,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
|
||||
}
|
||||
});
|
||||
|
||||
final Project project = projectProfileManager.getProject();
|
||||
myImportButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false){
|
||||
@@ -128,7 +130,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
|
||||
}
|
||||
};
|
||||
descriptor.setDescription("Choose profile file");
|
||||
final VirtualFile file = FileChooser.chooseFile(myWholePanel, descriptor, null);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myWholePanel, project, null);
|
||||
if (file == null) return;
|
||||
InspectionProfileImpl profile =
|
||||
new InspectionProfileImpl("TempProfile", InspectionToolRegistrar.getInstance(), myProfileManager);
|
||||
@@ -193,7 +195,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setDescription("Choose directory to store profile file");
|
||||
final VirtualFile file = FileChooser.chooseFile(myWholePanel, descriptor, null);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myWholePanel, project, null);
|
||||
if (file == null) return;
|
||||
final Element element = new Element("inspections");
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -197,7 +197,7 @@ public class ToolEditorDialog extends DialogWrapper {
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(myProject, descriptor, null);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (file != null) {
|
||||
myTfCommand.setText(file.getPresentableUrl());
|
||||
String workingDirectory = myTfCommandWorkingDirectory.getText();
|
||||
@@ -276,7 +276,7 @@ public class ToolEditorDialog extends DialogWrapper {
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(myProject, descriptor);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (file != null) {
|
||||
myTfCommandWorkingDirectory.setText(file.getPresentableUrl());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -177,7 +177,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (pathToFile() == null) {
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(myComponent, FILE_DESCRIPTOR, null);
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(FILE_DESCRIPTOR, myComponent, getEventProject(e), null);
|
||||
if (selectedFile != null) {
|
||||
myState.currentScript = selectedFile.getPresentableUrl();
|
||||
myCurrentScript.setText(myState.currentScript);
|
||||
@@ -218,7 +218,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(myComponent, FILE_DESCRIPTOR, pathToFile());
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(FILE_DESCRIPTOR, myComponent, getEventProject(e), pathToFile());
|
||||
if (selectedFile != null) {
|
||||
myState.currentScript = selectedFile.getPresentableUrl();
|
||||
loadFrom(selectedFile);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -177,16 +177,8 @@ public class FileDownloaderImpl implements FileDownloader {
|
||||
private VirtualFile chooseDirectoryForFiles() {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setTitle(IdeBundle.message("dialog.directory.for.downloaded.files.title"));
|
||||
|
||||
final VirtualFile file;
|
||||
if (myProject != null) {
|
||||
file = FileChooser.chooseFile(myProject, descriptor, myProject.getBaseDir());
|
||||
}
|
||||
else {
|
||||
file = FileChooser.chooseFile(myParent, descriptor, null);
|
||||
}
|
||||
|
||||
return file;
|
||||
final VirtualFile baseDir = myProject != null ? myProject.getBaseDir() : null;
|
||||
return FileChooser.chooseFile(descriptor, myParent, myProject, baseDir);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.openapi.fileChooser;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -33,48 +32,128 @@ public class FileChooser {
|
||||
|
||||
private FileChooser() { }
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor) {
|
||||
return chooseFiles(project, descriptor, null);
|
||||
return chooseFiles(descriptor, null, project, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor,
|
||||
* java.awt.Component,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor) {
|
||||
return chooseFiles(parent, descriptor, null);
|
||||
return chooseFiles(descriptor, parent, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
return chooseFiles(descriptor, null, project, toSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor,
|
||||
* java.awt.Component,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
return chooseFiles(descriptor, parent, null, toSelect);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project);
|
||||
public static VirtualFile[] chooseFiles(@NotNull final FileChooserDescriptor descriptor,
|
||||
@Nullable final Project project,
|
||||
@Nullable final VirtualFile toSelect) {
|
||||
return chooseFiles(descriptor, null, project, toSelect);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(@NotNull final FileChooserDescriptor descriptor,
|
||||
@Nullable final Component parent,
|
||||
@Nullable final Project project,
|
||||
@Nullable final VirtualFile toSelect) {
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, parent);
|
||||
return chooser.choose(toSelect, project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, parent);
|
||||
return chooser.choose(toSelect, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFile(FileChooserDescriptor,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(Project project, FileChooserDescriptor descriptor) {
|
||||
return chooseFile(project, descriptor, null);
|
||||
return chooseFile(descriptor, null, project, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFile(FileChooserDescriptor,
|
||||
* java.awt.Component,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor) {
|
||||
return chooseFile(parent, descriptor, null);
|
||||
return chooseFile(descriptor, parent, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFile(FileChooserDescriptor,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
LOG.assertTrue(!descriptor.isChooseMultiple());
|
||||
return ArrayUtil.getFirstElement(chooseFiles(project, descriptor, toSelect));
|
||||
return chooseFile(descriptor, null, project, toSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #chooseFile(FileChooserDescriptor,
|
||||
* java.awt.Component,
|
||||
* com.intellij.openapi.project.Project,
|
||||
* com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
return chooseFile(descriptor, parent, null, toSelect);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) {
|
||||
public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor,
|
||||
@Nullable final Project project,
|
||||
@Nullable final VirtualFile toSelect) {
|
||||
return chooseFile(descriptor, null, project, toSelect);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor,
|
||||
@Nullable final Component parent,
|
||||
@Nullable final Project project,
|
||||
@Nullable final VirtualFile toSelect) {
|
||||
LOG.assertTrue(!descriptor.isChooseMultiple());
|
||||
return ArrayUtil.getFirstElement(chooseFiles(parent, descriptor, toSelect));
|
||||
return ArrayUtil.getFirstElement(chooseFiles(descriptor, parent, project, toSelect));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,11 +233,4 @@ public class FileChooser {
|
||||
final PathChooserDialog pathChooser = factory.createPathChooser(descriptor, project, parent);
|
||||
pathChooser.choose(toSelect, callback);
|
||||
}
|
||||
|
||||
/** @deprecated internal method, to remove in IDEA 12 */
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public static boolean isNativeMacChooserEnabled() {
|
||||
return "true".equalsIgnoreCase(System.getProperty("native.mac.file.chooser.enabled", "true")) &&
|
||||
Registry.is("ide.mac.filechooser.native");
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,21 @@ public abstract class FileChooserFactory {
|
||||
return ServiceManager.getService(FileChooserFactory.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #createFileChooser(FileChooserDescriptor, com.intellij.openapi.project.Project, java.awt.Component)}
|
||||
* (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, @Nullable Project project) {
|
||||
return createFileChooser(descriptor, project, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@linkplain #createFileChooser(FileChooserDescriptor, com.intellij.openapi.project.Project, java.awt.Component)}
|
||||
* (to remove in IDEA 13)
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
public FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, @NotNull Component parent) {
|
||||
return createFileChooser(descriptor, null, parent);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,7 +82,7 @@ public class GuiUtils {
|
||||
return constructFieldWithBrowseButton(aTextField, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.getDirectoryChooserDescriptor(aSearchedObjectName);
|
||||
VirtualFile file = FileChooser.chooseFile(aTextField, descriptor);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, aTextField, null, null);
|
||||
if (file != null) {
|
||||
aTextField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
aTextField.postActionEvent();
|
||||
@@ -96,7 +96,7 @@ public class GuiUtils {
|
||||
return constructFieldWithBrowseButton(aFieldWithHistory, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.getFileChooserDescriptor(aSearchedObjectName);
|
||||
VirtualFile file = FileChooser.chooseFile(aFieldWithHistory, descriptor);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, aFieldWithHistory, null, null);
|
||||
if (file != null) {
|
||||
try {
|
||||
aFieldWithHistory.setText(VfsUtil.virtualToIoFile(file).toURL().toString());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class InsertPathAction extends AnAction {
|
||||
}
|
||||
//TODO use from openapi
|
||||
//FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.commandLine.insertPath");
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myTextField, myDescriptor, virtualFile);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myTextField, getEventProject(e), virtualFile);
|
||||
if (files.length != 0) {
|
||||
myTextField.replaceSelection(files[0].getPresentableUrl());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -159,7 +159,7 @@ public class ChooseComponentsToExportDialog extends DialogWrapper {
|
||||
else {
|
||||
initialDir = null;
|
||||
}
|
||||
final VirtualFile file = FileChooser.chooseFile(parent, chooserDescriptor, initialDir);
|
||||
final VirtualFile file = FileChooser.chooseFile(chooserDescriptor, parent, null, initialDir);
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diff.DiffRequest;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.fileEditor.*;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
@@ -125,8 +125,7 @@ public class VirtualFileDiffElement extends DiffElement<VirtualFile> {
|
||||
@Override
|
||||
public DiffElement<VirtualFile> call() throws Exception {
|
||||
final FileChooserDescriptor descriptor = getChooserDescriptor();
|
||||
final VirtualFile[] result = FileChooserFactory.getInstance()
|
||||
.createFileChooser(descriptor, project).choose(getValue(), project);
|
||||
final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, getValue());
|
||||
return result.length == 1 ? createElement(result[0]) : null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,7 +81,7 @@ public class InstalledPluginsManagerMain extends PluginManagerMain {
|
||||
};
|
||||
descriptor.setTitle("Choose Plugin File");
|
||||
descriptor.setDescription("JAR and ZIP archives are accepted");
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(myActionsPanel, descriptor);
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, myActionsPanel, null, null);
|
||||
if (virtualFile != null) {
|
||||
final File file = VfsUtil.virtualToIoFile(virtualFile);
|
||||
try {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class EncodingViewer extends DialogWrapper {
|
||||
initEncodings();
|
||||
myLoadFile.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VirtualFile file = FileChooser.chooseFile(myPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
|
||||
VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), myPanel, null, null);
|
||||
if (file != null) {
|
||||
loadFrom(file);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,8 +22,8 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diff.DirDiffManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
@@ -42,11 +42,11 @@ public class CompareDirectoriesAction extends AnAction {
|
||||
if (files.length == 2 && files[0].isDirectory() && files[1].isDirectory()) {
|
||||
src = new VirtualFileDiffElement(files[0]);
|
||||
trg = new VirtualFileDiffElement(files[1]);
|
||||
} else if (files.length == 1 && files[0].isDirectory()) {
|
||||
}
|
||||
else if (files.length == 1 && files[0].isDirectory()) {
|
||||
src = new VirtualFileDiffElement(files[0]);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false);
|
||||
final VirtualFile[] result = FileChooserFactory.getInstance()
|
||||
.createFileChooser(descriptor, project).choose(project.getBaseDir(), project);
|
||||
final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, project.getBaseDir());
|
||||
if (result.length == 1 && result[0] != null && result[0].isDirectory()) {
|
||||
trg = new VirtualFileDiffElement(result[0]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,8 +24,8 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diff.DirDiffManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class CompareJarsAction extends AnAction {
|
||||
//
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = getEventProject(e);
|
||||
@@ -45,7 +44,8 @@ public class CompareJarsAction extends AnAction {
|
||||
if (files.length == 2 && isArchive(files[0]) && isArchive(files[1])) {
|
||||
src = new JarFileDiffElement(files[0]);
|
||||
trg = new JarFileDiffElement(files[1]);
|
||||
} else if (files.length == 1 && isArchive(files[0])) {
|
||||
}
|
||||
else if (files.length == 1 && isArchive(files[0])) {
|
||||
src = new JarFileDiffElement(files[0]);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, false) {
|
||||
@Override
|
||||
@@ -54,8 +54,7 @@ public class CompareJarsAction extends AnAction {
|
||||
|| (!file.isDirectory() && isArchive(file));
|
||||
}
|
||||
};
|
||||
final VirtualFile[] result = FileChooserFactory.getInstance()
|
||||
.createFileChooser(descriptor, project).choose(project.getBaseDir(), project);
|
||||
final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, project.getBaseDir());
|
||||
if (result.length == 1 && result[0] != null && isArchive(result[0])) {
|
||||
trg = new JarFileDiffElement(result[0]);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,8 +50,7 @@ public class LocalPathCellEditor extends AbstractTableCellEditor {
|
||||
final FileChooserDescriptor d = getFileChooserDescriptor();
|
||||
String initial = (String)getCellEditorValue();
|
||||
VirtualFile initialFile = StringUtil.isNotEmpty(initial) ? LocalFileSystem.getInstance().findFileByPath(initial) : null;
|
||||
VirtualFile file =
|
||||
myProject != null ? FileChooser.chooseFile(myProject, d, initialFile) : FileChooser.chooseFile(table, d, initialFile);
|
||||
VirtualFile file = FileChooser.chooseFile(d, table, myProject, initialFile);
|
||||
if (file != null) {
|
||||
String path = file.getPresentableUrl();
|
||||
if (SystemInfo.isWindows && path.length() == 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -577,7 +577,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
private class NewBaseSelector implements Runnable {
|
||||
public void run() {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(myProject, descriptor);
|
||||
VirtualFile selectedFile = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (selectedFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -795,7 +795,7 @@ public class InjectionsSettingsUI implements SearchableConfigurable.Parent, NonD
|
||||
final SplitterProportionsData splitterData = new SplitterProportionsDataImpl();
|
||||
splitterData.externalizeFromDimensionService("IntelliLang.ImportSettingsKey.SplitterProportions");
|
||||
|
||||
final VirtualFile file = FileChooser.chooseFile(myProject, descriptor);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (file == null) return;
|
||||
try {
|
||||
final Configuration cfg = Configuration.load(file.getInputStream());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,11 +33,13 @@ import com.intellij.openapi.compiler.CompileScope;
|
||||
import com.intellij.openapi.compiler.CompileStatusNotification;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
@@ -116,7 +118,8 @@ class ApkStep extends ExportSignedPackageWizardStep {
|
||||
return getContentRootPath(module);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final Project project = wizard.getProject();
|
||||
myProguardConfigFilePathField.getButton().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -129,8 +132,8 @@ class ApkStep extends ExportSignedPackageWizardStep {
|
||||
if (defaultFile == null && facet != null) {
|
||||
defaultFile = AndroidRootUtil.getMainContentRoot(facet);
|
||||
}
|
||||
final VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
|
||||
defaultFile);
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, project, defaultFile);
|
||||
if (file != null) {
|
||||
myProguardConfigFilePathField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.android.exportSignedPackage;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -204,7 +205,8 @@ class KeystoreStep extends ExportSignedPackageWizardStep {
|
||||
path = defaultLocation != null ? defaultLocation : "";
|
||||
}
|
||||
VirtualFile f = LocalFileSystem.getInstance().findFileByPath(path);
|
||||
VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), f);
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, myWizard.getProject(), f);
|
||||
if (file != null) {
|
||||
myKeystoreLocationField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -151,8 +151,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
if (defaultFile == null) {
|
||||
defaultFile = AndroidRootUtil.getMainContentRoot(facet);
|
||||
}
|
||||
final VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
|
||||
defaultFile);
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, project, defaultFile);
|
||||
if (file != null) {
|
||||
myProguardConfigFileTextField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
@@ -686,7 +686,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
}
|
||||
}
|
||||
}
|
||||
VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFolderDescriptor(), initialFile);
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, myContext.getProject(), initialFile);
|
||||
if (file != null) {
|
||||
myTextField.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
@@ -741,21 +742,21 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
|
||||
initialFile = LocalFileSystem.getInstance().findFileByPath(p);
|
||||
}
|
||||
}
|
||||
return FileChooser
|
||||
.chooseFiles(myContentPanel, new FileChooserDescriptor(chooseFile, !chooseFile, false, false, false, chooseMultiple) {
|
||||
@Override
|
||||
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
|
||||
if (!super.isFileVisible(file, showHiddenFiles)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file.isDirectory() && !chooseFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return filter == null || filter.value(file);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(chooseFile, !chooseFile, false, false, false, chooseMultiple) {
|
||||
@Override
|
||||
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
|
||||
if (!super.isFileVisible(file, showHiddenFiles)) {
|
||||
return false;
|
||||
}
|
||||
}, initialFile);
|
||||
|
||||
if (!file.isDirectory() && !chooseFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return filter == null || filter.value(file);
|
||||
}
|
||||
};
|
||||
return FileChooser.chooseFiles(descriptor, myContentPanel, myContext.getProject(), initialFile);
|
||||
}
|
||||
|
||||
private static class MyManifestFilter implements Condition<VirtualFile> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,7 +34,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManagerListener;
|
||||
@@ -206,7 +205,7 @@ public class AntExplorer extends SimpleToolWindowPanel implements DataProvider,
|
||||
final FileChooserDescriptor descriptor = createXmlDescriptor();
|
||||
descriptor.setTitle(AntBundle.message("select.ant.build.file.dialog.title"));
|
||||
descriptor.setDescription(AntBundle.message("select.ant.build.file.dialog.description"));
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(myProject, descriptor);
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProject, null);
|
||||
if (files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,12 +15,10 @@
|
||||
*/
|
||||
package com.intellij.lang.ant.config.impl;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.roots.ui.CellAppearanceEx;
|
||||
import com.intellij.openapi.roots.ui.FileAppearanceService;
|
||||
import com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -38,14 +36,17 @@ import java.util.List;
|
||||
|
||||
public class AllJarsUnderDirEntry implements AntClasspathEntry {
|
||||
private static final Icon ALL_JARS_IN_DIR_ICON = IconLoader.getIcon("/ant/allJarsInDir.png");
|
||||
private final File myDir;
|
||||
@NonNls static final String DIR = "dir";
|
||||
@NonNls private static final String JAR_SUFFIX = ".jar";
|
||||
|
||||
private static final Function<VirtualFile, AntClasspathEntry> CREATE_FROM_VIRTUAL_FILE = new Function<VirtualFile, AntClasspathEntry>() {
|
||||
public AntClasspathEntry fun(VirtualFile file) {
|
||||
return fromVirtualFile(file);
|
||||
}
|
||||
};
|
||||
@NonNls public static final String JAR_SUFFIX = ".jar";
|
||||
|
||||
@NonNls static final String DIR = "dir";
|
||||
|
||||
private final File myDir;
|
||||
|
||||
public AllJarsUnderDirEntry(final File dir) {
|
||||
myDir = dir;
|
||||
@@ -85,17 +86,10 @@ public class AllJarsUnderDirEntry implements AntClasspathEntry {
|
||||
return new AllJarsUnderDirEntry(file.getPath());
|
||||
}
|
||||
|
||||
public static class AddEntriesFactory implements Factory<List<AntClasspathEntry>> {
|
||||
private final JComponent myParentComponent;
|
||||
|
||||
public AddEntriesFactory(final JComponent component) {
|
||||
myParentComponent = component;
|
||||
}
|
||||
|
||||
public List<AntClasspathEntry> create() {
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myParentComponent, FileChooserDescriptorFactory.createMultipleFoldersDescriptor());
|
||||
if (files.length == 0) return null;
|
||||
return ContainerUtil.map(files, CREATE_FROM_VIRTUAL_FILE);
|
||||
@SuppressWarnings("ClassNameSameAsAncestorName")
|
||||
public static class AddEntriesFactory extends AntClasspathEntry.AddEntriesFactory {
|
||||
public AddEntriesFactory(final JComponent parentComponent) {
|
||||
super(parentComponent, FileChooserDescriptorFactory.createMultipleFoldersDescriptor(), CREATE_FROM_VIRTUAL_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,13 +15,20 @@
|
||||
*/
|
||||
package com.intellij.lang.ant.config.impl;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.roots.ui.CellAppearanceEx;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.NullableFactory;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.config.Externalizer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,4 +56,23 @@ public interface AntClasspathEntry {
|
||||
void addFilesTo(List<File> files);
|
||||
|
||||
CellAppearanceEx getAppearance();
|
||||
|
||||
abstract class AddEntriesFactory implements NullableFactory<List<AntClasspathEntry>> {
|
||||
private final JComponent myParentComponent;
|
||||
private final FileChooserDescriptor myDescriptor;
|
||||
private final Function<VirtualFile,AntClasspathEntry> myMapper;
|
||||
|
||||
public AddEntriesFactory(final JComponent parentComponent,
|
||||
final FileChooserDescriptor descriptor,
|
||||
final Function<VirtualFile, AntClasspathEntry> mapper) {
|
||||
myParentComponent = parentComponent;
|
||||
myDescriptor = descriptor;
|
||||
myMapper = mapper;
|
||||
}
|
||||
|
||||
public List<AntClasspathEntry> create() {
|
||||
final VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myParentComponent, null, null);
|
||||
return files.length == 0 ? null : ContainerUtil.map(files, myMapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package com.intellij.lang.ant.config.impl;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.roots.ui.CellAppearanceEx;
|
||||
import com.intellij.openapi.roots.ui.FileAppearanceService;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -27,7 +25,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
@@ -36,12 +33,11 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class SinglePathEntry implements AntClasspathEntry {
|
||||
private static final Function<VirtualFile, AntClasspathEntry> CREATE_FROM_VIRTUAL_FILE =
|
||||
new Function<VirtualFile, AntClasspathEntry>() {
|
||||
public AntClasspathEntry fun(VirtualFile singlePathEntry) {
|
||||
return fromVirtulaFile(singlePathEntry);
|
||||
}
|
||||
};
|
||||
private static final Function<VirtualFile, AntClasspathEntry> CREATE_FROM_VIRTUAL_FILE = new Function<VirtualFile, AntClasspathEntry>() {
|
||||
public AntClasspathEntry fun(VirtualFile singlePathEntry) {
|
||||
return fromVirtualFile(singlePathEntry);
|
||||
}
|
||||
};
|
||||
|
||||
@NonNls static final String PATH = "path";
|
||||
|
||||
@@ -77,22 +73,14 @@ public class SinglePathEntry implements AntClasspathEntry {
|
||||
return myFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
public static SinglePathEntry fromVirtulaFile(VirtualFile file) {
|
||||
private static SinglePathEntry fromVirtualFile(VirtualFile file) {
|
||||
return new SinglePathEntry(file.getPresentableUrl());
|
||||
}
|
||||
|
||||
public static class AddEntriesFactory implements Factory<List<AntClasspathEntry>> {
|
||||
private final JComponent myParentComponent;
|
||||
|
||||
@SuppressWarnings("ClassNameSameAsAncestorName")
|
||||
public static class AddEntriesFactory extends AntClasspathEntry.AddEntriesFactory {
|
||||
public AddEntriesFactory(final JComponent parentComponent) {
|
||||
myParentComponent = parentComponent;
|
||||
}
|
||||
|
||||
public List<AntClasspathEntry> create() {
|
||||
VirtualFile[] files = FileChooser.chooseFiles(myParentComponent, new FileChooserDescriptor(false, true, true, true, false, true));
|
||||
if (files.length == 0) return null;
|
||||
return ContainerUtil.map(files, CREATE_FROM_VIRTUAL_FILE);
|
||||
super(parentComponent, new FileChooserDescriptor(false, true, true, true, false, true), CREATE_FROM_VIRTUAL_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ant.config.impl.AntInstallation;
|
||||
import com.intellij.lang.ant.config.impl.AntReference;
|
||||
import com.intellij.lang.ant.config.impl.GlobalAntConfiguration;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -214,7 +215,8 @@ public class AntSetPanel {
|
||||
}
|
||||
|
||||
public AntInstallation create() {
|
||||
VirtualFile file = FileChooser.chooseFile(myParent, FileChooserDescriptorFactory.createSingleFolderDescriptor(), null);
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myParent, null, null);
|
||||
if (file == null) return null;
|
||||
try {
|
||||
final AntInstallation inst = AntInstallation.fromHome(file.getPresentableUrl());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -195,7 +195,7 @@ public class CopyrightProfilesPanel extends MasterDetailsComponent implements Se
|
||||
}
|
||||
};
|
||||
descriptor.setTitle("Choose file containing copyright notice");
|
||||
final VirtualFile file = FileChooser.chooseFile(myProject, descriptor);
|
||||
final VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (file == null) return;
|
||||
|
||||
final List<CopyrightProfile> copyrightProfiles = ExternalOptionHelper.loadOptions(VfsUtil.virtualToIoFile(file));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class CheckoutHelper {
|
||||
descriptor.setTitle(CvsBundle.message("dialog.description.select.a.directory.to.check.out.the.files.to"));
|
||||
VirtualFile suggestedCheckoutFolder =
|
||||
LocalFileSystem.getInstance().findFileByPath(pathToSuggestedFolder.replace(File.separatorChar, '/'));
|
||||
return FileChooser.chooseFile(myPanel, descriptor, suggestedCheckoutFolder);
|
||||
return FileChooser.chooseFile(descriptor, myPanel, null, suggestedCheckoutFolder);
|
||||
}
|
||||
|
||||
private boolean requestLocation() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,23 +113,19 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable {
|
||||
JPanel wholePanel = new JPanel(new GridBagLayout());
|
||||
wholePanel.add(mySandboxHomeLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.WEST,
|
||||
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
wholePanel.add(GuiUtils.constructFieldWithBrowseButton(mySandboxHome,
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory
|
||||
.createSingleFolderDescriptor();
|
||||
descriptor.setTitle(DevKitBundle.message("sandbox.home"));
|
||||
descriptor.setDescription(
|
||||
DevKitBundle.message("sandbox.purpose"));
|
||||
VirtualFile file = FileChooser.chooseFile(mySandboxHome, descriptor, null);
|
||||
if (file != null) {
|
||||
mySandboxHome.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
myModified = true;
|
||||
}
|
||||
}),
|
||||
new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0));
|
||||
wholePanel.add(GuiUtils.constructFieldWithBrowseButton(mySandboxHome, new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.setTitle(DevKitBundle.message("sandbox.home"));
|
||||
descriptor.setDescription(DevKitBundle.message("sandbox.purpose"));
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, mySandboxHome, null, null);
|
||||
if (file != null) {
|
||||
mySandboxHome.setText(FileUtil.toSystemDependentName(file.getPath()));
|
||||
}
|
||||
myModified = true;
|
||||
}
|
||||
}), new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0));
|
||||
|
||||
wholePanel.add(myInternalJreLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 1, GridBagConstraints.WEST,
|
||||
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
|
||||
@@ -347,7 +347,7 @@ public class EclipseImportBuilder extends ProjectImportBuilder<String> implement
|
||||
};
|
||||
descriptor.setDescription(buf.toString());
|
||||
descriptor.setTitle(getTitle());
|
||||
final VirtualFile selectedFile = FileChooser.chooseFile(project, descriptor, project.getBaseDir());
|
||||
final VirtualFile selectedFile = FileChooser.chooseFile(descriptor, project, project.getBaseDir());
|
||||
if (selectedFile != null) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
@@ -387,7 +387,7 @@ public class EclipseImportBuilder extends ProjectImportBuilder<String> implement
|
||||
};
|
||||
fileChooserDescriptor.setTitle(EclipseBundle.message("eclipse.create.library.title"));
|
||||
fileChooserDescriptor.setDescription(EclipseBundle.message("eclipse.create.library.description", libraryName));
|
||||
final VirtualFile file = FileChooser.chooseFile(project, fileChooserDescriptor, null);
|
||||
final VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, project, null);
|
||||
if (file != null) {
|
||||
final VirtualFile pluginsDir = file.findChild("plugins");
|
||||
if (pluginsDir != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,7 +64,7 @@ public class GitInit extends DumbAwareAction {
|
||||
if (baseDir == null) {
|
||||
baseDir = project.getBaseDir();
|
||||
}
|
||||
final VirtualFile root = FileChooser.chooseFile(project, fcd, baseDir);
|
||||
final VirtualFile root = FileChooser.chooseFile(fcd, project, baseDir);
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,7 +72,8 @@ public class SelectRepositoryAndShowLogAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final VirtualFile[] virtualFiles = FileChooser.chooseFiles(project, new FileChooserDescriptor(false, true, false, true, false, true));
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, true, false, true);
|
||||
final VirtualFile[] virtualFiles = FileChooser.chooseFiles(descriptor, project, null);
|
||||
if (virtualFiles.length == 0) return;
|
||||
if (virtualFiles.length > MAX_REPOS) {
|
||||
VcsBalloonProblemNotifier.showOverVersionControlView(project, "Too many roots (more than " + MAX_REPOS +
|
||||
|
||||
@@ -33,7 +33,7 @@ public class GradleLinkToProjectAction extends AnAction implements DumbAware {
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
final VirtualFile file = FileChooser.chooseFile(project, GradleUtil.getFileChooserDescriptor());
|
||||
final VirtualFile file = FileChooser.chooseFile(GradleUtil.getFileChooserDescriptor(), project, null);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -110,7 +110,7 @@ public class GroovyLibraryDescription extends CustomLibraryDescription {
|
||||
};
|
||||
descriptor.setTitle(myFrameworkName + " SDK");
|
||||
descriptor.setDescription("Choose a directory containing " + myFrameworkName + " distribution");
|
||||
final VirtualFile dir = FileChooser.chooseFile(parentComponent, descriptor, initial);
|
||||
final VirtualFile dir = FileChooser.chooseFile(descriptor, parentComponent, null, initial);
|
||||
if (dir == null) return null;
|
||||
|
||||
final GroovyLibraryPresentationProviderBase provider = findManager(dir);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -112,7 +112,7 @@ public class HgInitDialog extends DialogWrapper {
|
||||
if (myShowDialog) {
|
||||
super.show();
|
||||
} else {
|
||||
mySelectedDir = FileChooser.chooseFile(myProject, myFileDescriptor);
|
||||
mySelectedDir = FileChooser.chooseFile(myFileDescriptor, myProject, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -130,7 +130,8 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
|
||||
new BrowseModuleValueActionListener(project) {
|
||||
@Override
|
||||
protected String showDialog() {
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(project, FileChooserDescriptorFactory.createSingleFolderDescriptor(), null);
|
||||
final VirtualFile virtualFile =
|
||||
FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project, null);
|
||||
if (virtualFile != null) {
|
||||
return FileUtil.toSystemDependentName(virtualFile.getPath());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,8 +19,8 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -68,10 +68,8 @@ public class ChooseFileIntentionAction implements IntentionAction {
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
|
||||
final MavenDomDependency dep = getDependency(file, editor);
|
||||
PsiFile currentValue = dep.getSystemPath().getValue();
|
||||
FileChooserDialog dialog =
|
||||
getFileChooserFactory().createFileChooser(new FileChooserDescriptor(true, false, true, true, false, false),
|
||||
project);
|
||||
VirtualFile[] files = dialog.choose(currentValue == null ? null : currentValue.getVirtualFile(), project);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, false);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(descriptor, project, currentValue == null ? null : currentValue.getVirtualFile());
|
||||
if (files.length == 0) return;
|
||||
|
||||
final PsiFile selectedFile = PsiManager.getInstance(project).findFile(files[0]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,9 +17,8 @@ package org.jetbrains.idea.maven.project.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager;
|
||||
@@ -48,8 +47,7 @@ public class AddManagedFilesAction extends MavenAction {
|
||||
Project project = MavenActionUtil.getProject(e.getDataContext());
|
||||
VirtualFile fileToSelect = e.getData(PlatformDataKeys.VIRTUAL_FILE);
|
||||
|
||||
FileChooserDialog dialog = FileChooserFactory.getInstance().createFileChooser(singlePomSelection, project);
|
||||
VirtualFile[] files = dialog.choose(fileToSelect, project);
|
||||
VirtualFile[] files = FileChooser.chooseFiles(singlePomSelection, project, fileToSelect);
|
||||
if (files.length == 0) return;
|
||||
|
||||
manager.addManagedFiles(Arrays.asList(files));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -118,7 +118,7 @@ public class SvnConfigurable implements Configurable {
|
||||
|
||||
String oldValue = PropertiesComponent.getInstance().getValue("FileChooser.showHiddens");
|
||||
PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", Boolean.TRUE.toString());
|
||||
VirtualFile file = FileChooser.chooseFile(myComponent, descriptor, root);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myComponent, myProject, root);
|
||||
PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", oldValue);
|
||||
if (file == null) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -938,7 +938,7 @@ public class RepositoryBrowserDialog extends DialogWrapper {
|
||||
fcd.setTitle(title);
|
||||
fcd.setDescription(description);
|
||||
fcd.setHideIgnored(false);
|
||||
VirtualFile file = FileChooser.chooseFile(myProject, fcd);
|
||||
VirtualFile file = FileChooser.chooseFile(fcd, myProject, null);
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class CheckoutOptionsDialog extends DialogWrapper {
|
||||
private FixedSizeButton mySelectTarget;
|
||||
private final String myRelativePath;
|
||||
|
||||
public CheckoutOptionsDialog(Project project, SVNURL url, File target, final VirtualFile root, final String relativePath) {
|
||||
public CheckoutOptionsDialog(final Project project, SVNURL url, File target, final VirtualFile root, final String relativePath) {
|
||||
super(project, true);
|
||||
myRelativePath = relativePath;
|
||||
final String urlText = url.toString();
|
||||
@@ -74,7 +74,7 @@ public class CheckoutOptionsDialog extends DialogWrapper {
|
||||
fcd.setTitle(SvnBundle.message("checkout.directory.chooser.title"));
|
||||
fcd.setDescription(SvnBundle.message("checkout.directory.chooser.prompt"));
|
||||
fcd.setHideIgnored(false);
|
||||
VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd, null);
|
||||
VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), project, null);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -174,7 +174,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener {
|
||||
fcd.setTitle(title);
|
||||
fcd.setDescription(description);
|
||||
fcd.setHideIgnored(false);
|
||||
VirtualFile file = FileChooser.chooseFile(myBrowser, fcd);
|
||||
VirtualFile file = FileChooser.chooseFile(fcd, myBrowser, myProject, null);
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,6 +38,7 @@ import java.io.File;
|
||||
public class ExportOptionsDialog extends DialogWrapper implements ActionListener {
|
||||
|
||||
private final SVNURL myURL;
|
||||
private final Project myProject;
|
||||
private final File myFile;
|
||||
private TextFieldWithBrowseButton myPathField;
|
||||
private DepthCombo myDepth;
|
||||
@@ -48,6 +49,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener
|
||||
public ExportOptionsDialog(Project project, SVNURL url, File target) {
|
||||
super(project, true);
|
||||
myURL = url;
|
||||
myProject = project;
|
||||
myFile = target;
|
||||
setTitle("SVN Export Options");
|
||||
init();
|
||||
@@ -170,7 +172,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener
|
||||
fcd.setTitle("Export Directory");
|
||||
fcd.setDescription("Select directory to export from subversion");
|
||||
fcd.setHideIgnored(false);
|
||||
VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd);
|
||||
VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -200,7 +200,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener
|
||||
fcd.setTitle("Checkout Directory");
|
||||
fcd.setDescription("Select directory to checkout from subversion");
|
||||
fcd.setHideIgnored(false);
|
||||
VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd);
|
||||
VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null);
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -112,7 +112,7 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final VirtualFile vFile = FileChooser.chooseFile(myProject, FileChooserDescriptorFactory.createSingleFolderDescriptor());
|
||||
final VirtualFile vFile = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject, null);
|
||||
if (vFile != null) {
|
||||
final File file = new File(vFile.getPath());
|
||||
if (hasDuplicate(file)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ public class SuiteBrowser extends BrowseModuleValueActionListener
|
||||
};
|
||||
descriptor.setDescription("Please select the testng.xml suite file");
|
||||
descriptor.setTitle("Select Suite");
|
||||
VirtualFile file = FileChooser.chooseFile(getProject(), descriptor);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, getProject(), null);
|
||||
return file != null ? file.getPath() : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -202,7 +202,7 @@ public class UndeclaredTestInspection extends BaseJavaLocalInspectionTool {
|
||||
final PsiClass psiClass = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiClass.class);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final VirtualFile file = FileChooser.chooseFile(project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
|
||||
final VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project, null);
|
||||
if (file != null) {
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
final PsiDirectory directory = psiManager.findDirectory(file);
|
||||
|
||||
@@ -58,7 +58,7 @@ class AddAssociationAction extends AnAction {
|
||||
}
|
||||
};
|
||||
|
||||
final VirtualFile[] virtualFiles = FileChooser.chooseFiles(project, descriptor, psiFile.getVirtualFile());
|
||||
final VirtualFile[] virtualFiles = FileChooser.chooseFiles(descriptor, project, psiFile.getVirtualFile());
|
||||
if (virtualFiles.length == 0) return; // cancel
|
||||
|
||||
for (VirtualFile file : virtualFiles) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -97,7 +97,7 @@ public class EditLocationDialog extends DialogWrapper {
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent ignored) {
|
||||
FileChooserDescriptor descriptor = getChooserDescriptor();
|
||||
VirtualFile file = FileChooser.chooseFile(myProject, descriptor);
|
||||
VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
|
||||
if (file != null) {
|
||||
myTfPath.setText(file.getPath().replace('/', File.separatorChar));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,22 +15,21 @@
|
||||
*/
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.xml.XmlBundle;
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.List;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -62,11 +61,6 @@ public class UIUtils {
|
||||
|
||||
fileChooserDescriptor.setTitle(selectFileDialogTitle);
|
||||
|
||||
final FileChooserDialog fileChooser = FileChooserFactory.getInstance().createFileChooser(
|
||||
fileChooserDescriptor,
|
||||
myProject
|
||||
);
|
||||
|
||||
VirtualFile initialFile = myProject.getBaseDir();
|
||||
String selectedItem = wsdlUrl.getTextField().getText();
|
||||
if (selectedItem != null && selectedItem.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
|
||||
@@ -74,7 +68,7 @@ public class UIUtils {
|
||||
if (fileByPath != null) initialFile = fileByPath;
|
||||
}
|
||||
|
||||
final VirtualFile[] virtualFiles = fileChooser.choose(initialFile, myProject);
|
||||
final VirtualFile[] virtualFiles = FileChooser.chooseFiles(fileChooserDescriptor, myProject, initialFile);
|
||||
if (virtualFiles.length == 1) {
|
||||
String url = fixIDEAUrl(virtualFiles[0].getUrl());
|
||||
wsdlUrl.setText(url);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class UriUtil {
|
||||
private UriUtil() {}
|
||||
|
||||
/** @see #findRelativeFile(String, com.intellij.psi.PsiFile) */
|
||||
/** @see #findRelative(String, com.intellij.psi.PsiFileSystemItem) */
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public static VirtualFile findRelativeFile(String uri, VirtualFile base) {
|
||||
|
||||
Reference in New Issue
Block a user