void (@NotNull AnActionEvent e) { PresentationFactory factory = new PresentationFactory(); ListPopup popup = new PopupFactoryImpl.ActionGroupPopup( LangBundle.message("popup.title.copy"), this, e.getDataContext(), true, true, false, true, null, -1, null, ActionPlaces.COPY_REFERENCE_POPUP, factory, false) { @Override protected ListCellRenderer<PopupFactoryImpl.ActionItem> getListElementRenderer() { return new PopupListElementRenderer<>(this) { private JLabel myInfoLabel; private JLabel myShortcutLabel; @Override protected void createLabel() { super.createLabel(); myIconLabel.setBorder(JBUI.Borders.empty(1, 1, 1, JBUI.CurrentTheme.ActionsList.elementIconGap())); myInfoLabel = new JLabel(); myInfoLabel.setBorder(JBUI.Borders.empty(1, DEFAULT_HGAP, 1, 1)); myShortcutLabel = new JLabel(); myShortcutLabel.setBorder(JBUI.Borders.emptyLeft(DEFAULT_HGAP)); myShortcutLabel.setForeground(UIUtil.getContextHelpForeground()); } @Override protected JComponent createItemComponent() { createLabel(); JPanel panel = new JPanel(new GridBagLayout()); GridBag gbc = new GridBag(); panel.add(myIconLabel, gbc.next()); panel.add(myTextLabel, gbc.next()); panel.add(myShortcutLabel, gbc.next()); panel.add(myInfoLabel, gbc.next().weightx(1)); return layoutComponent(panel); } @Override protected void customizeComponent(@NotNull JList<? extends PopupFactoryImpl.ActionItem> list, @NotNull PopupFactoryImpl.ActionItem actionItem, boolean isSelected) { myButtonsSeparator.setVisible(false); AnAction action = actionItem.getAction(); Presentation presentation = factory.getPresentation(action); String qualifiedName = presentation.getClientProperty(CopyPathProvider.QUALIFIED_NAME); myInfoLabel.setText(""); if (qualifiedName != null) { myInfoLabel.setText(qualifiedName); } Color foreground = isSelected ? NamedColorUtil.getListSelectionForeground(true) : NamedColorUtil.getInactiveTextColor(); myInfoLabel.setForeground(foreground); myShortcutLabel.setForeground(foreground); MnemonicNavigationFilter<Object> filter = myStep.getMnemonicNavigationFilter(); int pos = filter == null ? -1 : filter.getMnemonicPos(actionItem); if (pos != -1) { String text = myTextLabel.getText(); text = text.substring(0, pos) + text.substring(pos + 1); myTextLabel.setText(text); myTextLabel.setDisplayedMnemonicIndex(pos); } if (action instanceof CopyPathProvider) { Shortcut shortcut = ArrayUtil.getFirstElement(action.getShortcutSet().getShortcuts()); myShortcutLabel.setText(shortcut != null ? KeymapUtil.getShortcutText(shortcut) : null); } } }; } @Override protected boolean isResizable() { return true; } @Override public @NotNull Dimension getPreferredContentSize() { return new Dimension(DEFAULT_WIDTH, super.getPreferredContentSize().height); } @Override public Dimension getSize() { return getPreferredContentSize(); } }; updatePopupSize(popup); popup.showInBestPositionFor(e.getDataContext()); }