void (@NotNull JList<?> list, Object value, int index, boolean selected, boolean hasFocus) { Color bgColor = UIUtil.getListBackground(); Color color = list.getForeground(); PsiElement target = PSIRenderingUtils.getPsiElement(value); VirtualFile vFile = PsiUtilCore.getVirtualFile(target); boolean isProblemFile = false; if (vFile != null) { Project project = target.getProject(); isProblemFile = WolfTheProblemSolver.getInstance(project).isProblemFile(vFile); FileStatus status = FileStatusManager.getInstance(project).getStatus(vFile); color = status.getColor(); Color fileBgColor = getFileBackgroundColor(project, vFile); bgColor = fileBgColor == null ? bgColor : fileBgColor; } if (value instanceof PsiElement) { //noinspection unchecked T element = (T)value; @NlsContexts.Label String name = ((PsiElement)value).isValid() ? getElementText(element) : "INVALID"; TextAttributes attributes = element.isValid() ? getNavigationItemAttributes(value) : null; SimpleTextAttributes nameAttributes = attributes != null ? SimpleTextAttributes.fromTextAttributes(attributes) : null; if (nameAttributes == null) nameAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color); if (name == null) { LOG.error("Null name for PSI element " + element.getClass() + " (by " + PsiElementListCellRenderer.this + ")"); name = LangBundle.message("label.unknown"); } SpeedSearchUtil.appendColoredFragmentForMatcher(name, this, nameAttributes, myMatchers.nameMatcher, bgColor, selected); if (!element.isValid()) { append(" " + LangBundle.message("label.invalid"), SimpleTextAttributes.ERROR_ATTRIBUTES); return; } setIcon(PsiElementListCellRenderer.this.getIcon(element)); FontMetrics fm = list.getFontMetrics(list.getFont()); int maxWidth = list.getWidth() - fm.stringWidth(name) - 16 - myRightComponentWidth - 20; String containerText = getContainerTextForLeftComponent(element, name, maxWidth, fm); if (containerText != null) { appendLocationText(selected, bgColor, isProblemFile, containerText); } } else if (!customizeNonPsiElementLeftRenderer(this, list, value, index, selected, hasFocus)) { setIcon(IconUtil.getEmptyIcon(false)); @NlsSafe String text = value == null ? "" : value.toString(); append(text, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, list.getForeground())); } setBackground(selected ? UIUtil.getListSelectionBackground(true) : bgColor); }