void (PopupMenuEvent e) { kotlinJpsPluginVersionComboBox.removePopupMenuListener(this); fetchAvailableJpsCompilersAsync( availableVersions -> { kotlinJpsPluginVersionComboBox.removeItem(loadingItem); if (availableVersions == null) { kotlinJpsPluginVersionComboBox.addItem( JpsVersionItem.createLabel( KotlinBaseCompilerConfigurationUiBundle.message("failed.fetching.all.available.versions.from.maven") ) ); } else { SortedSet<IdeKotlinVersion> newItems = new TreeSet<>(availableVersions); for (JpsVersionItem item : jpsPluginComboBoxModel.getItems()) { IdeKotlinVersion ideKotlinVersion = item.getVersion(); if (ideKotlinVersion != null) { newItems.add(ideKotlinVersion); } } Object selectedItem = jpsPluginComboBoxModel.getSelectedItem(); jpsPluginComboBoxModel.update( ContainerUtil.reverse(ContainerUtil.map(newItems, it -> new JpsVersionItem(it)))); kotlinJpsPluginVersionComboBox.setSelectedItem(selectedItem); } if (kotlinJpsPluginVersionComboBox.isPopupVisible()) { kotlinJpsPluginVersionComboBox.hidePopup(); kotlinJpsPluginVersionComboBox.showPopup(); } }); }