boolean (boolean isTest) { if (myElement != null) { Project project = myElement.getProject(); ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex(); if (myElement instanceof PsiDirectory) { VirtualFile directory = ((PsiFileSystemItem)myElement).getVirtualFile(); if (index.isInSourceContent(directory)) { return isTest == TestSourcesFilter.isTestSources(directory, myProject); } } else if (myElement instanceof PsiFile) { VirtualFile file = ((PsiFileSystemItem)myElement).getVirtualFile(); if (file != null) { return isTest == TestSourcesFilter.isTestSources(file, myProject); } } } return true; }