void () { myRemoveRepoButton.addActionListener(event -> { final int index = myJarRepositoryList.getSelectedIndex(); if (index < 0 || index > myJarRepositoryList.getItemsCount()) { return; } final RemoteRepositoryDescription remoteRepository = myReposModel.getElementAt(index); int bindLibrariesCount = countBindLibraries(myMutableEntityStorage, remoteRepository); if (bindLibrariesCount > 0) { var dialog = new RepositoryRemoveDialog(myProject, remoteRepository, myReposModel.getItems(), bindLibrariesCount); if (!dialog.showAndGet()) { return; } updateLibrariesRepositoryId(myMutableEntityStorage, remoteRepository, dialog.getSelectedRepository()); } removeSelectedItems(myJarRepositoryList); myJarRepositoryList.requestFocusInWindow(); }); }