void (@NotNull List<? extends XExecutionStack> executionStacks, boolean last) { List<? extends XExecutionStack> copyStacks = new ArrayList<>(executionStacks); // to capture the current List elements ApplicationManager.getApplication().invokeLater(() -> { int initialCount = myThreadComboBox.getItemCount(); if (last) { removeLoading(); myThreadsCalculated = true; } myAddBeforeSelection = addExecutionStacks(copyStacks, myAddBeforeSelection); // reopen if popups height changed int newCount = myThreadComboBox.getItemCount(); int maxComboboxRows = myThreadComboBox.getMaximumRowCount(); if (newCount != initialCount && (initialCount < maxComboboxRows || newCount < maxComboboxRows)) { ComboPopup popup = myThreadComboBox.getPopup(); if (popup != null && popup.isVisible()) { popup.hide(); popup.show(); } } }); }