boolean (@NotNull PsiFileSystemItem element) { if (!filter.shouldShow(element)) { // skip } else if (element instanceof PsiDirectory) { result.add(new PsiDirectoryNode(project, (PsiDirectory)element, settings, filter) { @Override public Collection<AbstractTreeNode<?>> getChildrenImpl() { //noinspection ConstantConditions return getDirectoryChildrenImpl(getProject(), getValue(), getSettings(), getFilter()); } }); } else if (element instanceof PsiFile) { result.add(new PsiFileNode(project, (PsiFile)element, settings) { @Override public Comparable<ExtensionSortKey> getTypeSortKey() { PsiFile value = getValue(); Language language = value == null ? null : value.getLanguage(); LanguageFileType fileType = language == null ? null : language.getAssociatedFileType(); return fileType == null ? null : new ExtensionSortKey(fileType.getDefaultExtension()); } }); } return true; }