boolean (final Pattern libPattern, final VirtualFile file, final ProjectFileIndex fileIndex) { if (libPattern != null) { final List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(file); for (OrderEntry orderEntry : entries) { if (orderEntry instanceof LibraryOrderEntry) { final String libraryName = ((LibraryOrderEntry)orderEntry).getLibraryName(); if (libraryName != null) { if (libPattern.matcher(libraryName).matches()) return true; } else { final String presentableName = orderEntry.getPresentableName(); final String fileName = new File(presentableName).getName(); if (libPattern.matcher(fileName).matches()) return true; } } else if (orderEntry instanceof JdkOrderEntry) { final String jdkName = ((JdkOrderEntry)orderEntry).getJdkName(); if (jdkName != null && libPattern.matcher(jdkName).matches()) return true; } } return false; } return true; }