JPanel (@NotNull Project project, @NotNull Url rootUrl) { return ToolbarDecorator.createDecorator(myBranchLocationsList) .setAddAction(new AnActionButtonRunnable() { @Nullable private Url usedRootUrl; @Override public void run(AnActionButton button) { Pair<Url, Url> result = SelectLocationDialog.selectLocationAndRoot(project, notNull(usedRootUrl, rootUrl)); if (result != null) { Url selectedUrl = result.first; usedRootUrl = result.second; if (selectedUrl != null && !myConfiguration.getBranchLocations().contains(selectedUrl)) { myConfiguration.addBranches(selectedUrl, new InfoStorage<>(new ArrayList<>(), InfoReliability.empty)); mySvnBranchConfigManager.reloadBranchesAsync(myRoot, selectedUrl, InfoReliability.setByUser); myBranchLocationsModel.add(selectedUrl); myBranchLocationsList.setSelectedIndex(myBranchLocationsModel.getSize() - 1); } } } }) .setRemoveAction(button -> { int selectedIndex = myBranchLocationsList.getSelectedIndex(); for (Url url : myBranchLocationsList.getSelectedValuesList()) { myBranchLocationsModel.remove(url); myConfiguration.removeBranch(url); } if (myBranchLocationsModel.getSize() > 0) { selectedIndex = min(selectedIndex, myBranchLocationsModel.getSize() - 1); myBranchLocationsList.setSelectedIndex(selectedIndex); } }) .disableUpDownActions() .setToolbarPosition(ActionToolbarPosition.BOTTOM) .createPanel(); }