String (final Object object) { if (object instanceof Project) { return ((Project)object).getName(); } else if (object instanceof Module) { return ((Module)object).getName(); } else if (object instanceof PsiFile) { VirtualFile file = ((PsiFile)object).getVirtualFile(); return file != null ? file.getPresentableName() : ((PsiFile)object).getName(); } else if (object instanceof PsiDirectory) { return ((PsiDirectory)object).getVirtualFile().getName(); } else if (object instanceof JdkOrderEntry) { return ((JdkOrderEntry)object).getJdkName(); } else if (object instanceof LibraryOrderEntry) { final String libraryName = ((LibraryOrderEntry)object).getLibraryName(); return libraryName != null ? libraryName : CodeInsightBundle.message("package.dependencies.library.node.text"); } else if (object instanceof ModuleOrderEntry moduleOrderEntry) { return moduleOrderEntry.getModuleName(); } return null; }