@Override @NotNull public Collection<PsiFileSystemItem> getContexts( final Project project, @NotNull final VirtualFile file) { final PsiFileSystemItem item = getPsiFileSystemItem(project, file); if (item != null) { final PsiFileSystemItem parent = item.getParent(); if (parent != null) { return Collections.singleton(parent); } } return Collections.emptyList(); }
@Override protected String getContainerText(PsiFileSystemItem element, String name) { PsiFileSystemItem parent = element.getParent(); final PsiDirectory psiDirectory = parent instanceof PsiDirectory ? (PsiDirectory) parent : null; if (psiDirectory == null) return null; final VirtualFile virtualFile = psiDirectory.getVirtualFile(); final String relativePath = getRelativePath(virtualFile, element.getProject()); if (relativePath == null) return "( " + File.separator + " )"; String path = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR.getOptimalTextForComponent( name + " ", new File(relativePath), this, myMaxWidth); return "(" + path + ")"; }