mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Simplify file chooser API; fix EA-35601
This commit is contained in:
+2
-2
@@ -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();
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+5
-4
@@ -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()) {
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user