boolean (VirtualFile file) { ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex(); return file != null && (index.isUnderSourceRootOfType(file, JavaModuleSourceRootTypes.SOURCES) || index.isInLibrary(file)); }