@Override
  protected void customizeCellRenderer(@NotNull final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
    Color color = UIUtil.getListForeground();
    SimpleTextAttributes attributes = null;
    String locationString = null;

    setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); // for separator, see below

    if (value instanceof NodeDescriptor descriptor) {
      setIcon(descriptor.getIcon());
      final Color elementColor = descriptor.getColor();

      if (elementColor != null) {
        color = elementColor;
      }

      if (descriptor instanceof AbstractTreeNode treeNode) {
        final TextAttributesKey attributesKey = treeNode.getPresentation().getTextAttributesKey();

        if (attributesKey != null) {
          final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);

          if (textAttributes != null) attributes =  SimpleTextAttributes.fromTextAttributes(textAttributes);
        }
        locationString = treeNode.getPresentation().getLocationString();

        final PresentationData presentation = treeNode.getPresentation();
        if (presentation.hasSeparatorAbove() && !selected) {
          setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground()),
                                                       BorderFactory.createEmptyBorder(0, 0, 1, 0)));
        }
      }
    }

    if(attributes == null) attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color);
    //noinspection HardCodedStringLiteral
    final String text = value.toString();

    if (myCommanderPanel.isEnableSearchHighlighting()) {
      JList list1 = myCommanderPanel.getList();
      if (list1 != null) {
        SpeedSearchUtil.appendFragmentsForSpeedSearch(list1, text, attributes, selected, this);
      }
    }
    else {
      append(text != null ? text : "", attributes);
    }

    if (locationString != null && locationString.length() > 0) {
      append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
    }
  }
@Override
  protected void customizeCellRenderer(@NotNull final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus)