VirtualFile[] (Component parentComponent, final VirtualFile[] rootCandidates) { final List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, null, new LibraryRootsDetectorImpl(JAVA_SOURCE_ROOT_DETECTOR.getExtensionList()), new OrderRootType[] {OrderRootType.SOURCES}); final List<VirtualFile> result = new ArrayList<>(); for (OrderRoot root : orderRoots) { result.add(root.getFile()); } return VfsUtilCore.toVirtualFileArray(result); }