NodeDescriptor (@NotNull Project project, @NotNull Object element, @Nullable NodeDescriptor parentDescriptor, int weight) { if (element instanceof NodeDescriptor) { return (NodeDescriptor)element; } Pair<Icon, @Nls String> iconAndText = createIconAndText(element); SimpleTextAttributes attributes = (!project.isDefault() && DumbService.getInstance(project).isDumb() && !isEditableInDumbMode(element)) ? SimpleTextAttributes.GRAYED_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES; return new PresentableNodeDescriptor<>(project, parentDescriptor) { @Override protected void update(@NotNull PresentationData presentation) { presentation.addText(iconAndText.second, attributes); presentation.setIcon(iconAndText.first); } @Override public @NlsSafe String toString() { return iconAndText.second; } @Override public int getWeight() { return weight; } @Override public Object getElement() { return element; } }; }