void (final List<String> urls) { final String value = myRepositoriesList.getSelectedValue(); myRepositoriesList.removeAll(); myRepositoriesList.setListData(ArrayUtil.toStringArray(urls)); // for keeping selection if (value != null) { final ListModel<String> model = myRepositoriesList.getModel(); for (int i = 0; i < model.getSize(); i++) { final String element = model.getElementAt(i); if (value.equals(element)) { myRepositoriesList.setSelectedIndex(i); } } } // in order to check for groups ambiguity + maybe highlight another error myValidator.run(); }