void () { languageVersionComboBox.addItem(VersionView.LatestStable.INSTANCE); apiVersionComboBox.addItem(VersionView.LatestStable.INSTANCE); if (isProjectSettings && jpsPluginSettings != null) { defaultJpsVersionItem = JpsVersionItem.createFromRawVersion( KotlinJpsPluginSettingsKt.getVersionWithFallback(jpsPluginSettings) ); kotlinJpsPluginVersionComboBox.addItem(defaultJpsVersionItem); IdeKotlinVersion bundledVersion = KotlinJpsPluginSettings.getBundledVersion(); IdeKotlinVersion defaultVersion = defaultJpsVersionItem.getVersion(); Integer compare = defaultVersion != null ? defaultVersion.compareTo(bundledVersion) : null; if (compare == null || compare > 0) { jpsPluginComboBoxModel.add(new JpsVersionItem(bundledVersion)); } else if (compare < 0) { jpsPluginComboBoxModel.add(0, new JpsVersionItem(bundledVersion)); } JpsVersionItem loadingItem = JpsVersionItem.createLabel(KotlinBaseCompilerConfigurationUiBundle.message("loading.available.versions.from.maven")); kotlinJpsPluginVersionComboBox.addItem(loadingItem); PopupMenuListenerAdapter popupListener = new PopupMenuListenerAdapter() { @Override public void popupMenuWillBecomeVisible(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(); } }); } }; kotlinJpsPluginVersionComboBox.addPopupMenuListener(popupListener); } else { kotlinJpsPluginVersionPanel.setVisible(false); } for (LanguageVersion languageVersion : LanguageVersion.values()) { if (!LanguageVersionSettingsKt.isStableOrReadyForPreview(languageVersion)) { continue; } ApiVersion apiVersion = ApiVersion.createByLanguageVersion(languageVersion); if (!apiVersion.isUnsupported()) { apiVersionComboBox.addItem(new VersionView.Specific(languageVersion)); } if (!languageVersion.isUnsupported()) { languageVersionComboBox.addItem(new VersionView.Specific(languageVersion)); } } languageVersionComboBox.setRenderer(new DescriptionListCellRenderer()); kotlinJpsPluginVersionComboBox.setRenderer(new DescriptionListCellRenderer()); apiVersionComboBox.setRenderer(new DescriptionListCellRenderer()); }