@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    Project project = e.getProject();
    List<StopAction.HandlerItem> handlerItems = getItemsList(getCancellableProcesses(project));

    if (handlerItems.isEmpty()) {
      return;
    }

    final JBList<StopAction.HandlerItem> list = new JBList<>(handlerItems);
    list.setCellRenderer(new GroupedItemsListRenderer<>(new ListItemDescriptorAdapter<>() {
      @Override
      public @Nullable String getTextFor(StopAction.HandlerItem item) {
        return item.displayName;
      }

      @Override
      public @Nullable Icon getIconFor(StopAction.HandlerItem item) {
        return item.icon;
      }

      @Override
      public boolean hasSeparatorAboveOf(StopAction.HandlerItem item) {
        return item.hasSeparator;
      }
    }));

    JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list)
      .setMovable(true)
      .setTitle(handlerItems.size() == 1 ? ExecutionBundle.message("confirm.background.process.stop")
                                         : ExecutionBundle.message("stop.background.process"))
      .setNamerForFiltering(o -> o.displayName)
      .setItemChosenCallback(() -> {
        List valuesList = list.getSelectedValuesList();
        for (Object o : valuesList) {
          if (o instanceof StopAction.HandlerItem) ((StopAction.HandlerItem)o).stop();
        }
      })
      .setRequestFocus(true)
      .createPopup();

    InputEvent inputEvent = e.getInputEvent();
    Component component = inputEvent != null ? inputEvent.getComponent() : null;
    if (component != null && (ActionPlaces.MAIN_TOOLBAR.equals(e.getPlace())
                              || ActionPlaces.NAVIGATION_BAR_TOOLBAR.equals(e.getPlace()))) {
      popup.showUnderneathOf(component);
    }
    else if (project == null) {
      popup.showInBestPositionFor(dataContext);
    }
    else {
      popup.showCenteredInCurrentWindow(project);
    }

  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)