mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-02 10:14:57 +07:00
FileDownloader reworked: allow to download in background, get rid of unnecessary VFS access
This commit is contained in:
@@ -138,9 +138,9 @@ public class LibraryDownloadSettings {
|
||||
}
|
||||
|
||||
List<Pair<VirtualFile,DownloadableFileDescription>> downloaded =
|
||||
DownloadableFileService.getInstance().createDownloader(toDownload, null, parent, myLibraryName + " Library")
|
||||
.toDirectory(myDirectoryForDownloadedLibrariesPath)
|
||||
.downloadAndReturnWithDescriptions();
|
||||
DownloadableFileService.getInstance()
|
||||
.createDownloader(toDownload, myLibraryName + " Library")
|
||||
.downloadWithProgress(myDirectoryForDownloadedLibrariesPath, null, parent);
|
||||
if (downloaded == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -286,12 +286,13 @@ public abstract class FindJarFix<T extends PsiElement> implements IntentionActio
|
||||
PropertiesComponent.getInstance(project).setValue("findjar.last.used.dir", file.getPath());
|
||||
final DownloadableFileService downloader = DownloadableFileService.getInstance();
|
||||
final DownloadableFileDescription description = downloader.createFileDescription(jarUrl, jarName);
|
||||
final VirtualFile[] jars = downloader.createDownloader(Arrays.asList(description), project, myEditorComponent, jarName)
|
||||
.toDirectory(file.getPath()).download();
|
||||
if (jars != null && jars.length == 1) {
|
||||
final List<VirtualFile> jars =
|
||||
downloader.createDownloader(Arrays.asList(description), jarName)
|
||||
.downloadFilesWithProgress(file.getPath(), project, myEditorComponent);
|
||||
if (jars != null && jars.size() == 1) {
|
||||
AccessToken token = WriteAction.start();
|
||||
try {
|
||||
OrderEntryFix.addJarToRoots(jars[0].getPresentableUrl(), myModule, myRef);
|
||||
OrderEntryFix.addJarToRoots(jars.get(0).getPresentableUrl(), myModule, myRef);
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
|
||||
Reference in New Issue
Block a user