void (ProjectViewNode<?> node, PresentationData data) { Object value = node.getValue(); RootType rootType; VirtualFile virtualFile = null; if (value instanceof RootType) { rootType = (RootType)value; } else { virtualFile = node.getVirtualFile(); if (virtualFile == null || !virtualFile.isValid()) return; rootType = ScratchFileService.getInstance().getRootType(virtualFile); if (rootType == null) return; } ScratchFileService scratchFileService = ScratchFileService.getInstance(); VirtualFile rootFile = LocalFileSystem.getInstance().findFileByPath(scratchFileService.getRootPath(rootType)); String text; Icon icon = null; if (virtualFile == null || virtualFile.isDirectory() && virtualFile.equals(rootFile)) { text = rootType.getDisplayName(); } else { Project project = Objects.requireNonNull(node.getProject()); text = rootType.substituteName(project, virtualFile); icon = rootType.substituteIcon(project, virtualFile); } if (text != null) { data.clearText(); data.addText(text, SimpleTextAttributes.REGULAR_ATTRIBUTES); data.setPresentableText(text); } if (icon != null) { data.setIcon(icon); } }