void (@NotNull Set<GithubTagInfo> tags) { if (!shouldUpdate(tags)) { return; } List<GithubTagInfo> sortedTags = createSortedTagList(tags); GithubTagInfo selectedItem = getSelectedValue(); if (selectedItem == null && sortedTags.size() > 0) { selectedItem = sortedTags.get(0); } myComboBox.removeAllItems(); if (myDefaultBranchTag != null) { myComboBox.addItem(myDefaultBranchTag); } for (GithubTagInfo tag : sortedTags) { myComboBox.addItem(tag); } if (selectedItem != null) { // restore previously selected item for (int i = 0; i < myComboBox.getItemCount(); i++) { GithubTagInfo item = GithubTagInfo.tryCast(myComboBox.getItemAt(i)); if (item != null && item.getName().equals(selectedItem.getName())) { myComboBox.setSelectedIndex(i); break; } } } myComboBox.updateUI(); fireStateChanged(); }