@NotNull
  private static JPanel createFilesViewPanel(@NotNull List<VirtualFile> files) {
    JPanel panel = new JPanel(new BorderLayout(0, 2));
    panel.add(new JLabel("Files to add:"), BorderLayout.NORTH);

    final JBList fileList = new JBList(ArrayUtil.EMPTY_STRING_ARRAY);
    fileList.setBorder(BorderFactory.createLineBorder(Color.lightGray));
    fileList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            fileList.clearSelection();
          }
        });
    fileList.setFocusable(false);
    fileList.setRequestFocusEnabled(false);
    fileList.setBackground(Gray._242);
    fileList.setCellRenderer(
        new ListCellRendererWrapper<VirtualFile>() {
          @Override
          public void customize(
              JList list, VirtualFile value, int index, boolean selected, boolean hasFocus) {
            setText(" " + value.getName());
          }
        });
    fileList.setListData(files.toArray());
    panel.add(fileList, BorderLayout.CENTER);
    return panel;
  }
  @Override
  public void setPopupVisible(boolean visible) {
    if (!isSwingPopup()) {
      if (visible && (myJBPopup == null || myJBPopup.isDisposed())) {
        final JBList list = createJBList(getModel());
        myJBPopup =
            JBPopupFactory.getInstance()
                .createListPopupBuilder(list)
                .setItemChoosenCallback(
                    new Runnable() {
                      @Override
                      public void run() {
                        final Object value = list.getSelectedValue();
                        if (value != null) {
                          configureEditor(getEditor(), value);
                          IdeFocusManager.getGlobalInstance().requestFocus(ComboBox.this, true);
                          assert myJBPopup != null;
                          ComboBox.this.getUI().setPopupVisible(ComboBox.this, false);
                          myJBPopup.cancel();
                        }
                      }
                    })
                .setFocusOwners(new Component[] {this})
                .setMinSize(new Dimension(getWidth(), -1))
                .createPopup();
        list.setBorder(IdeBorderFactory.createEmptyBorder());
        myJBPopup.showUnderneathOf(this);
        list.addFocusListener(
            new FocusAdapter() {
              @Override
              public void focusLost(FocusEvent e) {
                ComboBox.this.getUI().setPopupVisible(ComboBox.this, false);
                myJBPopup.cancel();
              }
            });
      }
      return;
    }

    if (getModel().getSize() == 0 && visible) return;
    if (visible && JBPopupFactory.getInstance().getChildFocusedPopup(this) != null) return;

    final boolean wasShown = isPopupVisible();
    super.setPopupVisible(visible);
    if (!wasShown
        && visible
        && isEditable()
        && !UIManager.getBoolean("ComboBox.isEnterSelectablePopup")) {

      final ComboBoxEditor editor = getEditor();
      final Object item = editor.getItem();
      final Object selectedItem = getSelectedItem();
      if (isSwingPopup() && (item == null || item != selectedItem)) {
        configureEditor(editor, selectedItem);
      }
    }
  }