JBPopup () { if (myChooserComponent instanceof JList) { ((JList<?>)myChooserComponent).setCellRenderer(new ListItemRenderer(myProject, myDelegate)); } if (myDetailView == null) { setDetailView(new DetailViewImpl(myProject)); } myPathLabel = new JLabel(" "); myPathLabel.setHorizontalAlignment(SwingConstants.RIGHT); myPathLabel.setFont(myPathLabel.getFont().deriveFont((float)10)); JPanel footerPanel = new JPanel(new BorderLayout()) { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(BORDER_COLOR); g.drawLine(0, 0, getWidth(), 0); } }; footerPanel.setBorder(JBUI.Borders.empty(4, 4, 4, SystemInfo.isMac ? 20 : 4)); footerPanel.add(myPathLabel); Runnable itemCallback = () -> IdeFocusManager.getInstance(myProject).doWhenFocusSettlesDown(() -> chooseItems(false)); JComponent toolBar = null; if (myActions != null) { ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("MasterDetailPopup", myActions, true); actionToolbar.setReservePlaceAutoPopupIcon(false); actionToolbar.setMinimumButtonSize(new Dimension(20, 20)); toolBar = actionToolbar.getComponent(); toolBar.setBorder(JBUI.Borders.merge(toolBar.getBorder(), JBUI.Borders.emptyLeft(12), true)); toolBar.setOpaque(false); } PopupChooserBuilder builder = createInnerBuilder(). setMovable(true). setResizable(true). setAutoselectOnMouseMove(false). setMayBeParent(true). setDimensionServiceKey(myDimensionServiceKey). setUseDimensionServiceForXYLocation(myDimensionServiceKey != null). setSettingButton(toolBar). setSouthComponent(footerPanel). setItemChosenCallback(itemCallback). setFilteringEnabled(o -> ((ItemWrapper)o).speedSearchText()); if (myPopupTuner != null) { myPopupTuner.consume(builder); } if (myDoneRunnable != null) { ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent event) { myDoneRunnable.run(); } }; if (SystemInfoRt.isMac && !StartupUiUtil.isUnderDarcula()) { JButton done = new JButton(LangBundle.message("button.done")); done.setOpaque(false); done.setMnemonic('o'); done.addActionListener(actionListener); builder.setCommandButton(new ActiveComponent.Adapter() { @NotNull @Override public JComponent getComponent() { return done; } }); } else { IconButton close = new IconButton(LangBundle.message("button.close"), AllIcons.Actions.Close, AllIcons.Actions.CloseHovered); builder.setCommandButton(new InplaceButton(close, actionListener)); } } String title = myDelegate.getTitle(); if (title != null) { builder.setTitle(title); } myPopup = builder.createPopup(); builder.getScrollPane().setBorder(IdeBorderFactory.createBorder(SideBorder.RIGHT)); mySpeedSearch = ((ListWithFilter<?>)builder.getPreferableFocusComponent()).getSpeedSearch(); myPopup.addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { myDetailView.clearEditor(); } }); if (myDoneRunnable != null) { new AnAction(IdeBundle.messagePointer("action.Anonymous.text.done")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { myDoneRunnable.run(); } }.registerCustomShortcutSet(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK, myPopup.getContent()); } return myPopup; }