TextWithIcon (@NotNull Project project, @NotNull ProjectFileIndex fileIndex, @NotNull VirtualFile vFile) { String text = orderEntryText(fileIndex, vFile); Icon icon = AllIcons.Nodes.PpLibFolder; if (StringUtil.isEmpty(text) && Registry.is("index.run.configuration.jre")) { for (Sdk sdk : ProjectJdkTable.getInstance().getAllJdks()) { Set<VirtualFile> roots = StreamEx.of(sdk.getRootProvider().getFiles(OrderRootType.CLASSES)) .append(sdk.getRootProvider().getFiles(OrderRootType.SOURCES)) .toSet(); if (VfsUtilCore.isUnder(vFile, roots)) { text = "< " + sdk.getName() + " >"; break; } } } if (StringUtil.isEmpty(text)) { SyntheticLibrary library = syntheticLibrary(project, fileIndex, vFile); if (library instanceof ItemPresentation presentation) { text = coalesce(presentation.getPresentableText(), ""); icon = presentation.getIcon(false); } } text = text.substring(text.lastIndexOf(File.separatorChar) + 1); VirtualFile jar = JarFileSystem.getInstance().getVirtualFileForJar(vFile); if (jar != null && !text.equals(jar.getName())) { text += " (" + jar.getName() + ")"; } return new TextWithIcon(text, icon); }