Esempio n. 1
0
 private static void updateSdk(@NotNull Project project, @NotNull final Sdk sdk)
     throws InvalidSdkException {
   PySkeletonRefresher.refreshSkeletonsOfSdk(
       project, sdk); // NOTE: whole thing would need a rename
   if (!PySdkUtil.isRemote(sdk)) {
     updateSysPath(sdk);
   }
 }
 private PythonPathEditor createPathEditor(final Sdk sdk) {
   if (PySdkUtil.isRemote(sdk)) {
     return new PyRemotePathEditor(sdk);
   } else {
     return new PythonPathEditor(
         "Classes",
         OrderRootType.CLASSES,
         FileChooserDescriptorFactory.createAllButJarContentsDescriptor()) {
       @Override
       protected void onReloadButtonClicked() {
         reloadSdk();
       }
     };
   }
 }
    @Override
    protected VirtualFile[] doAddItems() {
      Project project =
          CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel));
      try {
        String[] files =
            PythonRemoteInterpreterManager.getInstance()
                .chooseRemoteFiles(
                    project, (PyRemoteSdkAdditionalDataBase) mySdk.getSdkAdditionalData(), false);

        final String sourcesLocalPath = PySdkUtil.getRemoteSourcesLocalPath(mySdk.getHomePath());

        VirtualFile[] vFiles = new VirtualFile[files.length];

        int i = 0;
        for (String file : files) {
          String localRoot = PyRemoteSourceItem.localPathForRemoteRoot(sourcesLocalPath, file);

          myNewMappings.add(new PathMappingSettings.PathMapping(localRoot, file));
          myRemoteSdkData.getPathMappings().addMappingCheckUnique(localRoot, file);

          if (!new File(localRoot).exists()) {
            new File(localRoot).mkdirs();
          }
          vFiles[i++] =
              LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(localRoot));
        }

        vFiles = adjustAddedFileSet(myPanel, vFiles);
        List<VirtualFile> added = new ArrayList<VirtualFile>(vFiles.length);
        for (VirtualFile vFile : vFiles) {
          if (addElement(vFile)) {
            added.add(vFile);
          }
        }
        return VfsUtilCore.toVirtualFileArray(added);
      } catch (Exception e) {
        LOG.error(e);
      }
      return new VirtualFile[0];
    }