VirtualFile () { for (OrderRootType orderRootType : OrderRootType.getAllPersistentTypes()) { final VirtualFile[] existingRoots = getLibraryEditor().getFiles(orderRootType); if (existingRoots.length > 0) { VirtualFile existingRoot = existingRoots[0]; if (existingRoot.getFileSystem() instanceof JarFileSystem) { existingRoot = JarFileSystem.getInstance().getVirtualFileForJar(existingRoot); } if (existingRoot != null) { if (existingRoot.isDirectory()) { return existingRoot; } else { return existingRoot.getParent(); } } } } return null; }