diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java index 33f1cced24bf..ecebb9db73f3 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java @@ -175,7 +175,7 @@ public class PathEditor { requestDefaultFocus(); } - private VirtualFile[] doAdd() { + protected VirtualFile[] doAdd() { VirtualFile baseDir = myAddBaseDir; Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel)); if (baseDir == null && project != null) { diff --git a/platform/platform-impl/src/com/intellij/remote/RemoteSdkCredentialsHolder.java b/platform/platform-impl/src/com/intellij/remote/RemoteSdkCredentialsHolder.java index 8069f8c0336a..d92839e212b8 100644 --- a/platform/platform-impl/src/com/intellij/remote/RemoteSdkCredentialsHolder.java +++ b/platform/platform-impl/src/com/intellij/remote/RemoteSdkCredentialsHolder.java @@ -1,5 +1,6 @@ package com.intellij.remote; +import com.intellij.util.PathMappingSettings; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -97,6 +98,17 @@ public class RemoteSdkCredentialsHolder extends RemoteCredentialsHolder implemen myRemoteSdkProperties.setRemoteRoots(remoteRoots); } + @NotNull + @Override + public PathMappingSettings getPathMappings() { + return myRemoteSdkProperties.getPathMappings(); + } + + @Override + public void setPathMappings(@Nullable PathMappingSettings pathMappings) { + myRemoteSdkProperties.setPathMappings(pathMappings); + } + @Override public boolean isHelpersVersionChecked() { return myRemoteSdkProperties.isHelpersVersionChecked(); diff --git a/platform/platform-impl/src/com/intellij/remote/RemoteSdkProperties.java b/platform/platform-impl/src/com/intellij/remote/RemoteSdkProperties.java index 7d132578a6d4..a690afd96afc 100644 --- a/platform/platform-impl/src/com/intellij/remote/RemoteSdkProperties.java +++ b/platform/platform-impl/src/com/intellij/remote/RemoteSdkProperties.java @@ -15,6 +15,10 @@ */ package com.intellij.remote; +import com.intellij.util.PathMappingSettings; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -31,14 +35,47 @@ public interface RemoteSdkProperties { String getDefaultHelpersName(); + /** + * Use getPathMappings() instead + * To be removed in IDEA 15 + * + * @deprecated + */ + @Deprecated void addRemoteRoot(String remoteRoot); + /** + * Use getPathMappings() instead + * To be removed in IDEA 15 + * + * @deprecated + */ + @Deprecated void clearRemoteRoots(); + /** + * Use getPathMappings() instead + * To be removed in IDEA 15 + * + * @deprecated + */ + @Deprecated List getRemoteRoots(); + /** + * Use setPathMappings() instead + * To be removed in IDEA 15 + * + * @deprecated + */ + @Deprecated void setRemoteRoots(List remoteRoots); + @NotNull + PathMappingSettings getPathMappings(); + + void setPathMappings(@Nullable PathMappingSettings pathMappings); + boolean isHelpersVersionChecked(); void setHelpersVersionChecked(boolean helpersVersionChecked); diff --git a/platform/platform-impl/src/com/intellij/remote/RemoteSdkPropertiesHolder.java b/platform/platform-impl/src/com/intellij/remote/RemoteSdkPropertiesHolder.java index 71bf44ba3cb7..a0407d27f7e9 100644 --- a/platform/platform-impl/src/com/intellij/remote/RemoteSdkPropertiesHolder.java +++ b/platform/platform-impl/src/com/intellij/remote/RemoteSdkPropertiesHolder.java @@ -19,12 +19,13 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.intellij.openapi.util.JDOMExternalizer; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.PathMappingSettings; import org.jdom.Element; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.util.TreeSet; /** * @author traff @@ -35,6 +36,7 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { private static final String REMOTE_ROOTS = "REMOTE_ROOTS"; private static final String REMOTE_PATH = "REMOTE_PATH"; private static final String INITIALIZED = "INITIALIZED"; + private static final String PATH_MAPPINGS = "PATH_MAPPINGS"; private String mySdkId; @@ -49,6 +51,9 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { private boolean myInitialized = false; + @NotNull + private PathMappingSettings myPathMappings = new PathMappingSettings(); + public RemoteSdkPropertiesHolder(String name) { myHelpersDefaultDirName = name; } @@ -97,6 +102,20 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { myRemoteRoots = Sets.newTreeSet(remoteRoots); } + @NotNull + @Override + public PathMappingSettings getPathMappings() { + return myPathMappings; + } + + @Override + public void setPathMappings(@Nullable PathMappingSettings pathMappings) { + myPathMappings = new PathMappingSettings(); + if (pathMappings != null) { + myPathMappings.addAll(pathMappings); + } + } + @Override public boolean isHelpersVersionChecked() { return myHelpersVersionChecked; @@ -123,7 +142,6 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { @Override public void setInitialized(boolean initialized) { myInitialized = initialized; - } public void copyTo(RemoteSdkProperties copy) { @@ -142,6 +160,8 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { rootElement.setAttribute(INITIALIZED, Boolean.toString(isInitialized())); + PathMappingSettings.writeExternal(rootElement, myPathMappings); + for (String remoteRoot : getRemoteRoots()) { final Element child = new Element(REMOTE_ROOTS); child.setAttribute(REMOTE_PATH, remoteRoot); @@ -156,5 +176,7 @@ public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { setRemoteRoots(JDOMExternalizer.loadStringsList(element, REMOTE_ROOTS, REMOTE_PATH)); setInitialized(StringUtil.parseBoolean(element.getAttributeValue(INITIALIZED), true)); + + setPathMappings(PathMappingSettings.readExternal(element)); } } diff --git a/platform/util/src/com/intellij/util/PathMappingSettings.java b/platform/util/src/com/intellij/util/PathMappingSettings.java index 9bdd98755337..09c5b490cb4b 100644 --- a/platform/util/src/com/intellij/util/PathMappingSettings.java +++ b/platform/util/src/com/intellij/util/PathMappingSettings.java @@ -128,10 +128,20 @@ public class PathMappingSettings implements Cloneable { public void addMapping(String local, String remote) { PathMapping mapping = new PathMapping(local, remote); - if (areBothEmpty(mapping.myLocalRoot, mapping.myRemoteRoot)) { - return; + add(mapping); + } + + public void addMappingCheckUnique(String local, String remote) { + for (PathMapping mapping: myPathMappings) { + if (pathEquals(local, mapping.getLocalRoot()) && pathEquals(remote, mapping.getRemoteRoot())) { + return; + } } - myPathMappings.add(mapping); + addMapping(local, remote); + } + + private static boolean pathEquals(@NotNull String path1, @NotNull String path2) { + return norm(path1).equals(norm(path2)); } public boolean canReplaceRemote(String remotePath) { @@ -267,11 +277,11 @@ public class PathMappingSettings implements Cloneable { return myRemoteRoot; } - public int getLocalLen() { + private int getLocalLen() { return myLocalRoot != null ? myLocalRoot.length() : -1; } - public int getRemoteLen() { + private int getRemoteLen() { return myRemoteRoot != null ? myRemoteRoot.length() : -1; } diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonPathEditor.java b/python/ide/src/com/jetbrains/python/configuration/PythonPathEditor.java index 1c1a6635e93d..33169a79d267 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PythonPathEditor.java +++ b/python/ide/src/com/jetbrains/python/configuration/PythonPathEditor.java @@ -300,7 +300,7 @@ public class PythonPathEditor extends SdkPathEditor { } - private static class PythonPathListCellRenderer extends ListCellRendererWrapper { + private class PythonPathListCellRenderer extends ListCellRendererWrapper { private final PathListModel model; public PythonPathListCellRenderer(final ListCellRenderer listCellRenderer, PathListModel model) { @@ -314,7 +314,11 @@ public class PythonPathEditor extends SdkPathEditor { if (suffix.length() > 0) { suffix = " " + suffix; } - setText(value != null ? value.getPresentableUrl() + suffix : ""); + setText(value != null ? getPresentablePath(value) + suffix : ""); } } + + protected String getPresentablePath(VirtualFile value) { + return value.getPresentableUrl(); + } } diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonSdkDetailsDialog.java b/python/ide/src/com/jetbrains/python/configuration/PythonSdkDetailsDialog.java index 6ff0a2e36c3e..b0ca6dbff65f 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PythonSdkDetailsDialog.java +++ b/python/ide/src/com/jetbrains/python/configuration/PythonSdkDetailsDialog.java @@ -45,6 +45,7 @@ import com.intellij.ui.components.JBList; import com.intellij.util.NullableConsumer; import com.intellij.util.NullableFunction; import com.intellij.util.containers.FactoryMap; +import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase; import com.jetbrains.python.remote.PythonRemoteInterpreterManager; import com.jetbrains.python.sdk.*; import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; @@ -286,8 +287,9 @@ public class PythonSdkDetailsDialog extends DialogWrapper { myModifiedModificators.add(modificator); } final Sdk oldSdk = myProjectSdksModel.findSdk(sdk); - if (oldSdk == null) + if (oldSdk == null) { myProjectSdksModel.addSdk(sdk); + } refreshSdkList(); mySdkList.setSelectedValue(sdk, true); mySdkListChanged = true; @@ -452,15 +454,10 @@ public class PythonSdkDetailsDialog extends DialogWrapper { return LocalFileSystem.getInstance().refreshAndFindFileByPath(sdkName); } }); - sdk = SdkConfigurationUtil.setupSdk(ProjectJdkTable.getInstance().getAllJdks(), sdkHome, PythonSdkType.getInstance(), true, null, null); + sdk = + SdkConfigurationUtil.setupSdk(ProjectJdkTable.getInstance().getAllJdks(), sdkHome, PythonSdkType.getInstance(), true, null, null); } - final PythonPathEditor pathEditor = - new PythonPathEditor("Classes", OrderRootType.CLASSES, FileChooserDescriptorFactory.createAllButJarContentsDescriptor()) { - @Override - protected void onReloadButtonClicked() { - reloadSdk(); - } - }; + final PythonPathEditor pathEditor = createPathEditor(sdk); final SdkModificator sdkModificator = myModificators.get(sdk); PythonPathDialog dialog = new PythonPathDialog(myProject, pathEditor); @@ -476,4 +473,40 @@ public class PythonSdkDetailsDialog extends DialogWrapper { updateOkButton(); } } + + private PythonPathEditor createPathEditor(final Sdk sdk) { + if (PySdkUtil.isRemote(sdk)) { + return new PythonPathEditor("Classes", OrderRootType.CLASSES, FileChooserDescriptorFactory.createAllButJarContentsDescriptor()) { + private final PyRemoteSdkAdditionalDataBase myRemoteSdkData = (PyRemoteSdkAdditionalDataBase) sdk.getSdkAdditionalData(); + @Override + protected void onReloadButtonClicked() { + reloadSdk(); + } + + @Override + protected String getPresentablePath(VirtualFile value) { + String path = value.getPath(); + return myRemoteSdkData.getPathMappings().convertToRemote(path); + } + + @Override + protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) { + toolbarDecorator.setAddActionUpdater(new AnActionButtonUpdater() { + @Override + public boolean isEnabled(AnActionEvent e) { + return false; //TODO: implement adding remote path + } + }); + } + }; + } + else { + return new PythonPathEditor("Classes", OrderRootType.CLASSES, FileChooserDescriptorFactory.createAllButJarContentsDescriptor()) { + @Override + protected void onReloadButtonClicked() { + reloadSdk(); + } + }; + } + } } diff --git a/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java b/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java index 2fd5694eacf1..62de7ea14daf 100644 --- a/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java +++ b/python/src/com/jetbrains/python/projectView/PyRemoteLibrariesNode.java @@ -15,25 +15,41 @@ */ package com.jetbrains.python.projectView; +import com.google.common.base.Function; +import com.google.common.base.Predicates; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.Lists; import com.intellij.ide.projectView.PresentationData; import com.intellij.ide.projectView.ViewSettings; import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; +import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; +import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; import com.intellij.util.PlatformIcons; +import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase; import com.jetbrains.python.sdk.PySdkUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collection; + /** * @author traff */ public class PyRemoteLibrariesNode extends PsiDirectoryNode { - private PyRemoteLibrariesNode(Project project, PsiDirectory value, ViewSettings viewSettings) { + private final Sdk mySdk; + private final PyRemoteSdkAdditionalDataBase myRemoteSdkData; + + private PyRemoteLibrariesNode(Sdk sdk, Project project, PsiDirectory value, ViewSettings viewSettings) { super(project, value, viewSettings); + mySdk = sdk; + assert mySdk.getSdkAdditionalData() instanceof PyRemoteSdkAdditionalDataBase; + + myRemoteSdkData = (PyRemoteSdkAdditionalDataBase)mySdk.getSdkAdditionalData(); } @Override @@ -44,11 +60,47 @@ public class PyRemoteLibrariesNode extends PsiDirectoryNode { @Nullable public static PyRemoteLibrariesNode create(@NotNull Project project, @NotNull Sdk sdk, ViewSettings settings) { - final VirtualFile remoteLibraries = PySdkUtil.findRemoteLibrariesDir(sdk); - if (remoteLibraries != null) { + final VirtualFile remoteLibrary = PySdkUtil.findAnyRemoteLibrary(sdk); + if (remoteLibrary != null) { + final VirtualFile remoteLibraries = remoteLibrary.getParent(); final PsiDirectory remoteLibrariesDirectory = PsiManager.getInstance(project).findDirectory(remoteLibraries); - return new PyRemoteLibrariesNode(project, remoteLibrariesDirectory, settings); + return new PyRemoteLibrariesNode(sdk, project, remoteLibrariesDirectory, settings); } return null; } + + @Override + public Collection getChildrenImpl() { + + return FluentIterable.from(Lists.newArrayList(getValue().getChildren())).transform(new Function() { + @Override + public AbstractTreeNode apply(PsiElement input) { + if (input instanceof PsiDirectory) { + PsiDirectory directory = (PsiDirectory)input; + if (myRemoteSdkData.getPathMappings().canReplaceLocal((directory.getVirtualFile().getPath()))) { + return new PyRemoteRootNode(myRemoteSdkData.getPathMappings().convertToRemote(directory.getVirtualFile().getPath()), + getProject(), directory, getSettings()); + } + } + + return null; + } + }).filter(Predicates.notNull()).toList(); + } + + public static class PyRemoteRootNode extends PsiDirectoryNode { + + private String myRemotePath; + + public PyRemoteRootNode(String remotePath, Project project, PsiDirectory value, ViewSettings viewSettings) { + super(project, value, viewSettings); + myRemotePath = remotePath; + } + + @Override + protected void updateImpl(PresentationData data) { + data.setPresentableText(myRemotePath); + data.setIcon(PlatformIcons.FOLDER_ICON); + } + } } diff --git a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java index dedc82e38246..6153bc64146d 100644 --- a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java +++ b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java @@ -36,7 +36,6 @@ import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil; import com.jetbrains.python.psi.PyDocStringOwner; import com.jetbrains.python.psi.PyFile; import com.jetbrains.python.psi.PyFunction; -import com.jetbrains.python.remote.PyRemoteSdkCredentials; import com.jetbrains.python.sdk.PythonSdkType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -116,6 +115,17 @@ public class PyTreeStructureProvider implements SelectableTreeStructureProvider, if (dirParent != null && dirParent.getName().equals(PythonSdkType.SKELETON_DIR_NAME)) { continue; } + + if (dirParent != null && dirParent.getName().equals(PythonSdkType.REMOTE_SOURCES_DIR_NAME)) { + continue; + } + if (dirParent != null) { + PsiDirectory grandParent = dirParent.getParent(); + + if (grandParent != null && grandParent.getName().equals(PythonSdkType.REMOTE_SOURCES_DIR_NAME)) { + continue; + } + } } newChildren.add(child); } diff --git a/python/src/com/jetbrains/python/remote/PySkeletonsPathAware.java b/python/src/com/jetbrains/python/remote/PySkeletonsPathAware.java index 789d1ba17020..4cc21ed75c20 100644 --- a/python/src/com/jetbrains/python/remote/PySkeletonsPathAware.java +++ b/python/src/com/jetbrains/python/remote/PySkeletonsPathAware.java @@ -2,9 +2,22 @@ package com.jetbrains.python.remote; /** * @author traff + * @deprecated */ public interface PySkeletonsPathAware { + /** + * Use RemoteSdkProperties.getPathMappings() instead + * To be removed in IDEA 15 + * @deprecated + */ + @Deprecated String getSkeletonsPath(); + /** + * Use RemoteSdkProperties.getPathMappings() instead + * To be removed in IDEA 15 + * @deprecated + */ + @Deprecated void setSkeletonsPath(String path); } diff --git a/python/src/com/jetbrains/python/sdk/PySdkUtil.java b/python/src/com/jetbrains/python/sdk/PySdkUtil.java index 60a4c5bb0323..8f2b62b1b414 100644 --- a/python/src/com/jetbrains/python/sdk/PySdkUtil.java +++ b/python/src/com/jetbrains/python/sdk/PySdkUtil.java @@ -57,8 +57,6 @@ public class PySdkUtil { // Windows EOF marker, Ctrl+Z public static final int SUBSTITUTE = 26; - private static final String REMOTE_SOURCES_DIR_NAME = "remote_sources"; - private PySdkUtil() { // explicitly none } @@ -243,7 +241,7 @@ public class PySdkUtil { String basePath = PathManager.getSystemPath(); return basePath + File.separator + - REMOTE_SOURCES_DIR_NAME + + PythonSdkType.REMOTE_SOURCES_DIR_NAME + sep + FileUtil.toSystemIndependentName(sdkHome).hashCode() + sep; @@ -255,8 +253,8 @@ public class PySdkUtil { } @Nullable - public static VirtualFile findRemoteLibrariesDir(@NotNull final Sdk sdk) { - return findLibraryDir(sdk, REMOTE_SOURCES_DIR_NAME, OrderRootType.CLASSES); + public static VirtualFile findAnyRemoteLibrary(@NotNull final Sdk sdk) { + return findLibraryDir(sdk, PythonSdkType.REMOTE_SOURCES_DIR_NAME, OrderRootType.CLASSES); } private static VirtualFile findLibraryDir(Sdk sdk, String dirName, OrderRootType rootType) { diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java index a51d8e29c5a1..39a9ac87bd13 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java @@ -96,6 +96,7 @@ import java.util.regex.Pattern; * @author yole */ public class PythonSdkType extends SdkType { + public static final String REMOTE_SOURCES_DIR_NAME = "remote_sources"; private static final Logger LOG = Logger.getInstance("#" + PythonSdkType.class.getName()); private static final String[] WINDOWS_EXECUTABLE_SUFFIXES = new String[]{"cmd", "exe", "bat", "com"}; @@ -647,9 +648,6 @@ public class PythonSdkType extends SdkType { } } } - else { - addRemoteLibrariesRoot(sdkModificator, sdkHome); - } PyUserSkeletonsUtil.addUserSkeletonsRoot(sdkModificator); addSkeletonsRoot(sdkModificator, sdkHome); @@ -699,14 +697,6 @@ public class PythonSdkType extends SdkType { sdkModificator.addRoot(builtins_root, BUILTIN_ROOT_TYPE); } - private static void addRemoteLibrariesRoot(@NotNull SdkModificator sdkModificator, String sdkHome) { - @NonNls final String librariesRoot = PySdkUtil.getRemoteSourcesLocalPath(sdkHome); - new File(librariesRoot).mkdirs(); - final VirtualFile remoteLibraries = LocalFileSystem.getInstance().refreshAndFindFileByPath(librariesRoot); - assert remoteLibraries != null : "Cannot find remote libraries path " + librariesRoot + " in VFS"; - sdkModificator.addRoot(remoteLibraries, OrderRootType.CLASSES); - } - protected static void addHardcodedPaths(SdkModificator sdkModificator) { // Add python-django installed as package in Linux // NOTE: fragile and arbitrary diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java index 550359a679e3..cb45c883cd12 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java @@ -15,6 +15,7 @@ */ package com.jetbrains.python.sdk; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; @@ -34,8 +35,10 @@ import com.intellij.openapi.startup.StartupActivity; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.PathMappingSettings; import com.jetbrains.python.PyBundle; import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil; +import com.jetbrains.python.remote.PyRemoteSdkAdditionalDataBase; import com.jetbrains.python.sdk.skeletons.PySkeletonRefresher; import org.jetbrains.annotations.NotNull; @@ -145,6 +148,15 @@ public class PythonSdkUpdater implements StartupActivity { PySkeletonRefresher.refreshSkeletonsOfSdk(project, sdk); // NOTE: whole thing would need a rename if (!PySdkUtil.isRemote(sdk)) { updateSysPath(sdk); + } else { + PyRemoteSdkAdditionalDataBase remoteSdkData = (PyRemoteSdkAdditionalDataBase) sdk.getSdkAdditionalData(); + assert remoteSdkData != null; + List paths = Lists.newArrayList(); + for (PathMappingSettings.PathMapping mapping : remoteSdkData.getPathMappings().getPathMappings()) { + paths.add(mapping.getLocalRoot()); + } + + updateSdkPath(sdk, paths); } } diff --git a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java index 13202d7a39c7..284a125e8736 100644 --- a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java +++ b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java @@ -237,7 +237,7 @@ public class PySkeletonRefresher { final VirtualFile userSkeletonsDir = PyUserSkeletonsUtil.getUserSkeletonsDirectory(); final File userSkeletons = userSkeletonsDir != null ? new File(userSkeletonsDir.getPath()) : null; - final VirtualFile remoteSourcesDir = PySdkUtil.findRemoteLibrariesDir(sdk); + final VirtualFile remoteSourcesDir = PySdkUtil.findAnyRemoteLibrary(sdk); final File remoteSources = remoteSourcesDir != null ? new File(remoteSourcesDir.getPath()) : null; final VirtualFile[] classDirs = sdk.getRootProvider().getFiles(OrderRootType.CLASSES);