VirtualFile (Sdk sdk, String dirName, OrderRootType rootType) { final VirtualFile[] virtualFiles = sdk.getRootProvider().getFiles(rootType); for (VirtualFile virtualFile : virtualFiles) { if (virtualFile.isValid() && virtualFile.getPath().contains(dirName)) { return virtualFile; } } return null; }