private List<Runnable> rootUpdateTaskList(@NotNull Project project, @NotNull Set<Sdk> sdkSet) { final List<Runnable> rootUpdateTaskList = new ArrayList<>(); for (Sdk sdk : sdkSet) { final Level level = level(sdk); for (VirtualFile root : sdk.getRootProvider().getFiles(OrderRootType.CLASSES)) { if (root.isValid()) { rootUpdateTaskList.add(new UpdateRootTask(project, root, level)); } } } return rootUpdateTaskList; }
sdksToAdd.add(newSdk); for (String classesRoot : sdk.getRootProvider().getUrls(OrderRootType.CLASSES)) { if (!classesRoot.equals(sdk.getHomePath())) { globalGoPathUrls.add(classesRoot);
@Nullable private static NotNullFunction<OrderEntry, VirtualFile[]> computeRootProvider(@MagicConstant(valuesFromClass = MonkeyParameters.class) int classPathType, final Sdk sdk) { return (classPathType & SDK_ONLY) == 0 ? null : (NotNullFunction<OrderEntry, VirtualFile[]>) orderEntry -> { if (orderEntry instanceof JdkOrderEntry) { return sdk.getRootProvider().getFiles(OrderRootType.CLASSES); } return orderEntry.getFiles(OrderRootType.CLASSES); }; }
@Nullable private static String getCommunitySrcUrlInner(@NotNull Sdk projectSdk) { String homePath = projectSdk.getHomePath(); String API_SCR = "/platform/lang-api/src"; if (homePath != null) { for (String prefix : Arrays.asList("community", "")) { File file = new File(homePath, FileUtil.toSystemDependentName(prefix + API_SCR)); if (file.exists() && file.isDirectory()) { return VfsUtil.pathToUrl(FileUtil.toSystemDependentName(homePath + "/" + prefix)); } } } String[] sources = projectSdk.getRootProvider().getUrls(OrderRootType.SOURCES); for (String source : sources) { String communityPath = StringUtil.trimEnd(source, API_SCR); if (communityPath.length() < source.length()) { return communityPath; } } return null; }
/** * @return list of perl bin directories where script from library may be located **/ @NotNull public static Stream<VirtualFile> getBinDirectories(@Nullable Sdk sdk) { if (sdk == null) { return Stream.empty(); } ApplicationManager.getApplication().assertReadAccessAllowed(); SdkTypeId sdkType = sdk.getSdkType(); if (!(sdkType instanceof PerlSdkType)) { throw new IllegalArgumentException("Got non-perl sdk: " + sdk); } List<VirtualFile> files = new ArrayList<>(ContainerUtil.map(sdk.getRootProvider().getFiles(OrderRootType.CLASSES), PerlRunUtil::findLibsBin)); PerlHostData hostData = PerlHostData.notNullFrom(sdk); File localSdkBinDir = hostData.getLocalPath(new File( StringUtil.notNullize(PerlProjectManager.getInterpreterPath(sdk))).getParentFile()); if (localSdkBinDir != null) { files.add(VfsUtil.findFileByIoFile(localSdkBinDir, false)); } PerlVersionManagerData.notNullFrom(sdk).getBinDirsPath().forEach( it -> ObjectUtils.doIfNotNull(hostData.getLocalPath(it), localPath -> files.add(VfsUtil.findFileByIoFile(localPath, false)))); return files.stream().filter(Objects::nonNull).distinct(); }
Sdk projectSdk = getProjectSdk(); if (projectSdk != null) { result.addAll(Arrays.asList(projectSdk.getRootProvider().getFiles(OrderRootType.CLASSES)));