private void selectSourceAndDo() {
    // GUI part
    ImportCandidateHolder[] items =
        mySources.toArray(
            new ImportCandidateHolder
                [mySources.size()]); // silly JList can't handle modern collections
    final JList list = new JBList(items);
    list.setCellRenderer(new CellRenderer(myName));

    final Runnable runnable =
        new Runnable() {
          public void run() {
            final Object selected = list.getSelectedValue();
            if (selected instanceof ImportCandidateHolder) {
              final ImportCandidateHolder item = (ImportCandidateHolder) selected;
              PsiDocumentManager.getInstance(myTarget.getProject()).commitAllDocuments();
              doWriteAction(item);
            }
          }
        };

    DataManager.getInstance()
        .getDataContextFromFocus()
        .doWhenDone(
            new Consumer<DataContext>() {
              @Override
              public void consume(DataContext dataContext) {
                new PopupChooserBuilder(list)
                    .setTitle(
                        myUseQualifiedImport
                            ? PyBundle.message("ACT.qualify.with.module")
                            : PyBundle.message("ACT.from.some.module.import"))
                    .setItemChoosenCallback(runnable)
                    .setFilteringEnabled(
                        new Function<Object, String>() {
                          @Override
                          public String fun(Object o) {
                            return ((ImportCandidateHolder) o).getPresentableText(myName);
                          }
                        })
                    .createPopup()
                    .showInBestPositionFor(dataContext);
              }
            });
  }
    // value is a QualifiedHolder
    public Component getListCellRendererComponent(
        JList list,
        Object value, // expected to be
        int index,
        boolean isSelected,
        boolean cellHasFocus) {

      clear();

      ImportCandidateHolder item = (ImportCandidateHolder) value;
      setIcon(item.getImportable().getIcon(0));
      String item_name = item.getPresentableText(myName);
      append(item_name, SimpleTextAttributes.REGULAR_ATTRIBUTES);

      setFont(FONT);
      if (isSelected) {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
      } else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
      }
      return this;
    }