From d83f1a84fd69f96d298a12f2a19d56c2b00ccf91 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Mon, 10 Apr 2017 21:36:29 +0300 Subject: [PATCH] PY-21590 PY-21002 Cache installed packages for a remote SDK created in New Project dialog I removed the old check (now obsolete) that prevented caching of the list of installed packages in SDKs with unset interpreter paths. It turned out to be the case with new remote interpreters created right in "New Project" dialog where detecting interpreters paths is delayed until the moment of actual project initialization when PythonSdkUpdater is run. It led to repetitive requesting the list of installed packages that, first, badly affected the responsiveness of the dialog (PY-21590) and also caused network operations on EDT when installed packages were requested once again under modal progress indicators inside the write action in the Django project generator (PY-21002) (platform executes such tasks directly of EDT to prevent possible deadlocks). --- .../python/packaging/PyPackageManagersImpl.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java index 3521521b5720..6ab3c0b6ab94 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java @@ -17,8 +17,6 @@ package com.jetbrains.python.packaging; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.python.packaging.ui.PyCondaManagementService; import com.jetbrains.python.packaging.ui.PyPackageManagementService; import com.jetbrains.python.sdk.PythonSdkType; @@ -47,17 +45,11 @@ public class PyPackageManagersImpl extends PyPackageManagers { else { manager = new PyPackageManagerImpl(sdk); } - if (sdkIsSetUp(sdk)) - myInstances.put(key, manager); + myInstances.put(key, manager); } return manager; } - private static boolean sdkIsSetUp(@NotNull final Sdk sdk) { - final VirtualFile[] roots = sdk.getRootProvider().getFiles(OrderRootType.CLASSES); - return roots.length != 0; - } - public PyPackageManagementService getManagementService(Project project, Sdk sdk) { if (PyCondaPackageManagerImpl.isCondaVEnv(sdk)) { return new PyCondaManagementService(project, sdk);