boolean (@NotNull PsiFile psiFile) { final boolean shouldHighlight = shouldHighlightFile(psiFile); if (shouldHighlight) { if (psiFile.getFileType() == JavaFileType.INSTANCE) { final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile != null) { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(psiFile.getProject()).getFileIndex(); if (fileIndex.isInLibrarySource(virtualFile)) { return fileIndex.isInSourceContent(virtualFile); } } } } return shouldHighlight; }