String (final Object object, boolean forPopup) { if (object instanceof PsiMember member) { if (forPopup && object instanceof PsiMethod method) { return PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, SHOW_NAME | TYPE_AFTER | SHOW_PARAMETERS, SHOW_TYPE); } return ElementDescriptionUtil.getElementDescription(member, UsageViewShortNameLocation.INSTANCE); } else if (object instanceof PsiPackage psiPackage) { final String name = psiPackage.getName(); return name != null ? name : JavaBundle.message("dependencies.tree.node.default.package.abbreviation"); } else if (object instanceof PsiDirectory directory && JrtFileSystem.isRoot(directory.getVirtualFile())) { return JavaBundle.message("jrt.node.short"); } else if (object instanceof PsiLambdaExpression) { return JavaBundle.message("lambda.tree.node.presentation"); } return null; }