boolean (@NotNull VirtualFile virtualFile, @NotNull final Project project) { ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(project); return fileIndex.isInSourceContent(virtualFile) && virtualFile.equals(fileIndex.getSourceRootForFile(virtualFile)); }