public void selectRemote(@NotNull String remoteName) { for (GitRemote remote : myRemotes) { if (remote.getName().equals(remoteName)) { myRemoteCombobox.setSelectedItem(remote); return; } } myRemoteCombobox.setSelectedIndex(0); }
public void updateLists(List<? extends ChangeList> lists) { //noinspection unchecked myChooser.setModel(new DefaultComboBoxModel(lists.toArray())); myChooser.setEnabled(lists.size() > 1); if (lists.contains(mySelectedChangeList)) { myChooser.setSelectedItem(mySelectedChangeList); } else { if (myChooser.getItemCount() > 0) { myChooser.setSelectedIndex(0); } } mySelectedChangeList = (ChangeList) myChooser.getSelectedItem(); }