String (@NotNull AbstractTreeNode<?> element, @NotNull Project project) { Object nodeElement = element.getValue(); if (nodeElement instanceof SmartPsiElementPointer) { nodeElement = ((SmartPsiElementPointer<?>)nodeElement).getElement(); } if (nodeElement instanceof PsiElement) { if (nodeElement instanceof PsiDirectory) { return VfsUtilCore.getRelativeLocation(((PsiDirectory)nodeElement).getVirtualFile(), project.getBaseDir()); } if (nodeElement instanceof PsiFile containingFile) { return VfsUtilCore.getRelativeLocation(containingFile.getVirtualFile(), project.getBaseDir()); } } if (nodeElement instanceof LibraryGroupElement) { return ((LibraryGroupElement)nodeElement).getModule().getName(); } if (nodeElement instanceof NamedLibraryElement namedLibraryElement) { final Module module = namedLibraryElement.getModule(); return (module != null ? module.getName() : "") + ":" + namedLibraryElement.getOrderEntry().getPresentableName(); } if (nodeElement instanceof File) { return VfsUtilCore.getRelativeLocation(VfsUtil.findFileByIoFile((File)nodeElement, false), project.getBaseDir()); } final FavoriteNodeProvider[] nodeProviders = FavoriteNodeProvider.EP_NAME.getExtensions(project); for (FavoriteNodeProvider provider : nodeProviders) { String location = provider.getElementLocation(nodeElement); if (location != null) return location; } return null; }