PopupStep (AttachItem selectedValue, boolean finalChoice) { if (selectedValue instanceof AttachToProcessItem attachToProcessItem) { if (finalChoice) { addToRecent(myProject, attachToProcessItem); return doFinalStep(() -> attachToProcessItem.startDebugSession(myProject)); } else { return new ActionListStep(attachToProcessItem.getSubItems(), attachToProcessItem.mySelectedDebugger); } } if (selectedValue instanceof AttachHostItem attachHostItem) { AsyncPromise<PopupStep> promise = new AsyncPromise<>(); ApplicationManager.getApplication().executeOnPooledThread(() -> { List<AttachItem> attachItems = new ArrayList<>(attachHostItem.getSubItems()); ApplicationManager.getApplication().invokeLater(() -> promise.setResult(new AttachListStep(attachItems, null, myProject))); }); return new AsyncPopupStep(promise); } return null; }