void (DependencyOnPlugin original, JBList dependenciesList) { DependencyOnPlugin dependency = editPluginDependency(dependenciesList, original); if (dependency != null) { for (ProjectExternalDependency dependency1 : new ArrayList<>(myListModel.getItems())) { if (dependency1 instanceof DependencyOnPlugin && ((DependencyOnPlugin)dependency1).getPluginId().equals(dependency.getPluginId())) { myListModel.remove(dependency1); } } myListModel.add(dependency); dependenciesList.setSelectedValue(dependency, true); } }