use of com.intellij.openapi.vfs.JarFileSystem in project intellij-community by JetBrains.
the class IdeaJdk method appendIdeaLibrary.
private static void appendIdeaLibrary(final String libDirPath, final ArrayList<VirtualFile> result, @NonNls final String... forbidden) {
Arrays.sort(forbidden);
final String path = libDirPath + File.separator + LIB_DIR_NAME;
final JarFileSystem jfs = JarFileSystem.getInstance();
final File lib = new File(path);
if (lib.isDirectory()) {
File[] jars = lib.listFiles();
if (jars != null) {
for (File jar : jars) {
@NonNls String name = jar.getName();
if (jar.isFile() && Arrays.binarySearch(forbidden, name) < 0 && (name.endsWith(".jar") || name.endsWith(".zip"))) {
VirtualFile file = jfs.findFileByPath(jar.getPath() + JarFileSystem.JAR_SEPARATOR);
LOG.assertTrue(file != null, jar.getPath() + " not found");
result.add(file);
}
}
}
}
}
use of com.intellij.openapi.vfs.JarFileSystem in project intellij-community by JetBrains.
the class PyTreeStructureProvider method hideSkeletons.
@NotNull
private static Collection<AbstractTreeNode> hideSkeletons(@NotNull Collection<AbstractTreeNode> children) {
List<AbstractTreeNode> newChildren = new ArrayList<>();
for (AbstractTreeNode child : children) {
if (child instanceof PsiDirectoryNode) {
PsiDirectory directory = ((PsiDirectoryNode) child).getValue();
if (directory == null) {
continue;
}
VirtualFile dir = directory.getVirtualFile();
if (dir.equals(PyUserSkeletonsUtil.getUserSkeletonsDirectory())) {
continue;
}
if (dir.getFileSystem() instanceof JarFileSystem) {
dir = ((JarFileSystem) dir.getFileSystem()).getLocalVirtualFileFor(dir);
}
if (dir == null) {
continue;
}
if (PyTypeShed.INSTANCE.isInside(dir)) {
continue;
}
VirtualFile dirParent = dir.getParent();
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) {
VirtualFile grandParent = dirParent.getParent();
if (grandParent != null && grandParent.getName().equals(PythonSdkType.REMOTE_SOURCES_DIR_NAME)) {
continue;
}
}
}
newChildren.add(child);
}
return newChildren;
}
use of com.intellij.openapi.vfs.JarFileSystem in project intellij-plugins by JetBrains.
the class StrutsVersionDetector method getStrutsJarRoot.
@Nullable
private static VirtualFile getStrutsJarRoot(final Module module) {
final GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(module, false);
final JavaPsiFacade psiManager = JavaPsiFacade.getInstance(module.getProject());
final VirtualFile virtualFile = getStrutsClass(scope, psiManager);
if (virtualFile == null || !(virtualFile.getFileSystem() instanceof JarFileSystem)) {
return null;
}
final VirtualFile jarFile = JarFileSystem.getInstance().getLocalVirtualFileFor(virtualFile);
if (jarFile == null) {
return null;
}
return JarFileSystem.getInstance().getJarRootForLocalFile(jarFile);
}
Aggregations