void (JList<? extends E> list, E value, boolean isSelected) { if (mySeparatorComponent.isVisible() && mySeparatorComponent instanceof GroupHeaderSeparator) { ((GroupHeaderSeparator)mySeparatorComponent).setHideLine(myCurrentIndex == 0); } ListPopupStep<Object> step = myPopup.getListStep(); boolean isSelectable = step.isSelectable(value); myTextLabel.setEnabled(isSelectable); myMainPane.setOpaque(false); myButtonPane.setOpaque(false); boolean nextStepButtonSelected = false; boolean showNextStepLabel = step.hasSubstep(value) && !myInlineActionsSupport.hasExtraButtons(value); if (showNextStepLabel) { myNextStepLabel.setVisible(isSelectable); myNextStepLabel.setIcon(isSelectable && isSelected ? AllIcons.Icons.Ide.MenuArrowSelected : AllIcons.Icons.Ide.MenuArrow); if (ExperimentalUI.isNewUI()) { myNextStepLabel.setBorder(JBUI.Borders.emptyLeft(20)); } else { getItemComponent().setBackground(calcBackground(isSelected && isSelectable)); } setForegroundSelected(myTextLabel, isSelected && isSelectable); } else { myNextStepLabel.setVisible(false); } boolean hasNextIcon = myNextStepLabel.isVisible(); boolean hasInlineButtons = updateExtraButtons(list, value, step, isSelected, hasNextIcon); if (ExperimentalUI.isNewUI() && getItemComponent() instanceof SelectablePanel selectablePanel) { myUpdateScaleHelper.saveScaleAndRunIfChanged(() -> { if (ExperimentalUI.isNewUI()) { PopupUtil.configListRendererFixedHeight(selectablePanel); } }); selectablePanel.setSelectionColor(isSelected && isSelectable ? UIUtil.getListSelectionBackground(true) : null); int leftRightInset = JBUI.CurrentTheme.Popup.Selection.LEFT_RIGHT_INSET.get(); Insets innerInsets = JBUI.CurrentTheme.Popup.Selection.innerInsets(); int expectedRightInset = leftRightInset * 2; if (hasNextIcon || hasInlineButtons) { expectedRightInset -= myButtonsSeparator.getPreferredSize().width; } if (myShortcutLabel != null) { //noinspection UseDPIAwareBorders myShortcutLabel.setBorder(new EmptyBorder(0, 0, 0, expectedRightInset - leftRightInset)); expectedRightInset = leftRightInset; } //noinspection UseDPIAwareBorders selectablePanel.setBorder( new EmptyBorder(0, innerInsets.left + leftRightInset, 0, expectedRightInset)); } if (step instanceof BaseListPopupStep) { Color bg = ((BaseListPopupStep<E>)step).getBackgroundFor(value); Color fg = ((BaseListPopupStep<E>)step).getForegroundFor(value); if (!isSelected && fg != null) myTextLabel.setForeground(fg); if (!isSelected && bg != null) UIUtil.setBackgroundRecursively(getItemComponent(), bg); if (bg != null && mySeparatorComponent.isVisible() && myCurrentIndex > 0) { E prevValue = list.getModel().getElementAt(myCurrentIndex - 1); // separator between 2 colored items shall get color too if (Comparing.equal(bg, ((BaseListPopupStep<E>)step).getBackgroundFor(prevValue))) { myRendererComponent.setBackground(bg); } } } if (myMnemonicLabel != null && value instanceof NumericMnemonicItem && ((NumericMnemonicItem)value).digitMnemonicsEnabled()) { Character mnemonic = ((NumericMnemonicItem)value).getMnemonicChar(); myMnemonicLabel.setText(mnemonic != null ? String.valueOf(mnemonic) : ""); Color foreground = ExperimentalUI.isNewUI() ? JBUI.CurrentTheme.Popup.mnemonicForeground() : JBUI.CurrentTheme.ActionsList.MNEMONIC_FOREGROUND; myMnemonicLabel.setForeground(isSelected && isSelectable && !nextStepButtonSelected ? getSelectionForeground() : foreground); myMnemonicLabel.setVisible(true); myTextLabel.setDisplayedMnemonicIndex(-1); } else if (step.isMnemonicsNavigationEnabled()) { MnemonicNavigationFilter<Object> filter = step.getMnemonicNavigationFilter(); int pos = filter == null ? -1 : filter.getMnemonicPos(value); if (pos != -1) { String text = myTextLabel.getText(); text = text.substring(0, pos) + text.substring(pos + 1); myTextLabel.setText(text); myTextLabel.setDisplayedMnemonicIndex(pos); } } else { myTextLabel.setDisplayedMnemonicIndex(-1); } if (myShortcutLabel != null) { myShortcutLabel.setEnabled(isSelectable); myShortcutLabel.setText(""); if (value instanceof ShortcutProvider) { ShortcutSet set = ((ShortcutProvider)value).getShortcut(); String shortcutText = null; if (set != null) { Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts()); if (shortcut != null) { shortcutText = KeymapUtil.getShortcutText(shortcut); } } if (shortcutText == null && value instanceof AnActionHolder) { AnAction action = ((AnActionHolder)value).getAction(); if (action instanceof UserDataHolder) { shortcutText = ((UserDataHolder)action).getUserData(CUSTOM_KEY_STROKE_TEXT); } } if (shortcutText != null) { myShortcutLabel.setText(" " + shortcutText); if (ExperimentalUI.isNewUI()) { myNextStepLabel.setBorder(JBUI.Borders.emptyLeft(6)); } } } myShortcutLabel.setForeground(isSelected && isSelectable && !nextStepButtonSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground")); } if (myValueLabel != null) { String valueLabelText = step instanceof ListPopupStepEx<?> ? ((ListPopupStepEx<E>)step).getValueFor(value) : null; myValueLabel.setText(valueLabelText); if (ExperimentalUI.isNewUI()) { myValueLabel.setBorder(JBUI.Borders.emptyLeft(Strings.isEmpty(valueLabelText) ? 0 : 6)); } boolean selected = isSelected && isSelectable && !nextStepButtonSelected; setForegroundSelected(myValueLabel, selected); } if (ExperimentalUI.isNewUI() && getItemComponent() instanceof SelectablePanel selectablePanel) { selectablePanel.setSelectionColor(isSelected && isSelectable ? UIUtil.getListSelectionBackground(true) : null); setSelected(myMainPane, isSelected && isSelectable); } }