void () { myRepoNames.clear(); myRepositoryEditor.removeAll(); myRepositoryEditor.add(myEmptyPanel, EMPTY_PANEL); // ((CardLayout)myRepositoryEditor.getLayout()).show(myRepositoryEditor, ); myRepositories.clear(); CollectionListModel<TaskRepository> listModel = new CollectionListModel<>(new ArrayList<>()); for (TaskRepository repository : myManager.getAllRepositories()) { TaskRepository clone = repository.clone(); assert clone.equals(repository) : repository.getClass().getName(); myRepositories.add(clone); listModel.add(clone); } myRepositoriesList.setModel(listModel); for (TaskRepository clone : myRepositories) { addRepositoryEditor(clone); } if (!myRepositories.isEmpty()) { myRepositoriesList.setSelectedValue(myRepositories.get(0), true); } }