From bc0a192e100a4b8ff28077f8cc497188629e957d Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 28 Sep 2017 18:55:36 +0300 Subject: [PATCH] env tests fixed --- .../com/jetbrains/python/debugger/PyDebugRunner.java | 2 +- .../python/packaging/PyPackageManagerImpl.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java index e7d4523cf684..e07d227a8d12 100644 --- a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java +++ b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java @@ -387,7 +387,7 @@ public class PyDebugRunner extends GenericProgramRunner { final Sdk sdk = runConfiguration.getSdk(); if (sdk != null) { List roots = Lists.newArrayList(); - for (VirtualFile contentRoot : sdk.getSdkModificator().getRoots(OrderRootType.CLASSES)) { + for (VirtualFile contentRoot : sdk.getRootProvider().getFiles(OrderRootType.CLASSES)) { roots.add(contentRoot.getPath()); } environment.put(LIBRARY_ROOTS, StringUtil.join(roots, File.pathSeparator)); diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java index 87d395af511a..7ddfa7fce0fa 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java @@ -27,6 +27,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.projectRoots.ProjectJdkTable; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; import com.intellij.openapi.roots.OrderRootType; @@ -161,7 +162,16 @@ public class PyPackageManagerImpl extends PyPackageManager { protected void subscribeToLocalChanges() { final Application app = ApplicationManager.getApplication(); final MessageBusConnection connection = app.getMessageBus().connect(); - connection.subscribe(VirtualFileManager.VFS_CHANGES, new MySdkRootWatcher()); + MySdkRootWatcher watcher = new MySdkRootWatcher(); + connection.subscribe(VirtualFileManager.VFS_CHANGES, watcher); + connection.subscribe(ProjectJdkTable.JDK_TABLE_TOPIC, new ProjectJdkTable.Adapter() { + @Override + public void jdkRemoved(@NotNull Sdk jdk) { + if (jdk == getSdk()) { + connection.disconnect(); + } + } + }); } @NotNull