void (AnActionButton button) { int selected = myList.getSelectedIndex(); if (selected != -1) { // removing index final String path = (String) myListModel.get(selected); if (processor.removePath(myWorkingCollection, path)){ myListModel.remove(selected); } } }