boolean (@Nullable PsiFile psiFile) { if (psiFile == null) return false; if (psiFile instanceof PsiCodeFragment) return false; final VirtualFile file = psiFile.getVirtualFile(); if (file == null) return false; if (file.getFileSystem() instanceof NonPhysicalFileSystem) return false; final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(psiFile.getProject()).getFileIndex(); return !projectFileIndex.isUnderSourceRootOfType(file, JavaModuleSourceRootTypes.SOURCES) && !projectFileIndex.isInLibrary(file); }