boolean (final NavigationItem item) { if (item instanceof PsiFile file) { final Collection<FileTypeRef> types = getFilterItems(); // if language substitutors are used, PsiFile.getFileType() can be different from // PsiFile.getVirtualFile().getFileType() if (types != null) { if (types.contains(FileTypeRef.forFileType(file.getFileType()))) return true; VirtualFile vFile = file.getVirtualFile(); return vFile != null && types.contains(FileTypeRef.forFileType(vFile.getFileType())); } return true; } else if (item instanceof PsiDirectory) { final Collection<FileTypeRef> types = getFilterItems(); if (types != null) return types.contains(DIRECTORY_FILE_TYPE_REF); return true; } else { return super.acceptItem(item); } }