void (final @NotNull AnActionEvent e) { final DataContext dataContext = e.getDataContext(); Project project = e.getProject(); List<RunContentDescriptor> stoppableDescriptors = getActiveStoppableDescriptors(project); int stopCount = stoppableDescriptors.size(); if (isPlaceGlobal(e)) { if (stopCount == 1) { ExecutionManagerImpl.stopProcess(stoppableDescriptors.get(0)); return; } if (ActionPlaces.NEW_UI_RUN_TOOLBAR.equals(e.getPlace()) && project != null) { JBPopup popup = RunToolbarPopupKt.createStopPopup(dataContext, project); showStopPopup(e, dataContext, project, popup); return; } Pair<List<HandlerItem>, HandlerItem> handlerItems = getItemsList(project, stoppableDescriptors, getRecentlyStartedContentDescriptor(dataContext)); if (handlerItems == null || handlerItems.first.isEmpty()) { return; } HandlerItem stopAllItem = new HandlerItem(ExecutionBundle.message("stop.all", KeymapUtil.getFirstKeyboardShortcutText("Stop")), getActionIcon(e), true) { @Override void stop() { for (HandlerItem item : handlerItems.first) { if(item == this) continue; item.stop(); } } }; JBPopup activePopup = SoftReference.dereference(myActivePopupRef); if (activePopup != null) { stopAllItem.stop(); activePopup.cancel(); return; } List<HandlerItem> items = handlerItems.first; if (stopCount > 1) { items.add(stopAllItem); } IPopupChooserBuilder<HandlerItem> builder = JBPopupFactory.getInstance().createPopupChooserBuilder(items) .setRenderer(new GroupedItemsListRenderer<>(new ListItemDescriptorAdapter<>() { @Override public @Nullable String getTextFor(HandlerItem item) { return item.displayName; } @Override public @Nullable Icon getIconFor(HandlerItem item) { return item.icon; } @Override public boolean hasSeparatorAboveOf(HandlerItem item) { return item.hasSeparator; } })) .setMovable(true) .setTitle(items.size() == 1 ? ExecutionBundle.message("confirm.process.stop") : ExecutionBundle.message("stop.process")) .setNamerForFiltering(o -> o.displayName) .setItemsChosenCallback((valuesList) -> { for (HandlerItem item : valuesList) { item.stop(); } }) .addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { myActivePopupRef = null; } }) .setRequestFocus(true); if (handlerItems.second != null) { builder.setSelectedValue(handlerItems.second, true); } JBPopup popup = builder .createPopup(); myActivePopupRef = new WeakReference<>(popup); showStopPopup(e, dataContext, project, popup); } else { ExecutionManagerImpl.stopProcess(getRecentlyStartedContentDescriptor(dataContext)); } }