if (genomeItemList.isEmpty()) {
JOptionPane.showMessageDialog(IGV.getMainFrame(),
"There are no imported genomes to remove.");
} else {
GenomeListItem currentlySelectedDropdownGenome = IGV.getInstance().getGenomeSelectedInDropdown();
List<String> genomeNames = new ArrayList();
UserDefinedGenomeCheckList checkList = new UserDefinedGenomeCheckList(false);
for (GenomeListItem genomeListItem : genomeItemList) {
genomeNames.add(genomeListItem.getDisplayableName());
}
checkList.addItems(genomeNames);
checkList.sort();
int status = JOptionPane.showConfirmDialog(IGV.getMainFrame(), checkList,
"Imported Genomes to Remove", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE, null);
if ((status == JOptionPane.CANCEL_OPTION) || (status == JOptionPane.CLOSED_OPTION)) {
return;
}
boolean removed = false;
HashSet<String> selectedGenomes = checkList.getSelectedGenomes();
Iterator iterator = genomeItemList.iterator();
while (iterator.hasNext()) {
String genomeName = ((GenomeListItem) iterator.next()).getDisplayableName();
// Skip genome if not selected for removal
if (!selectedGenomes.contains(genomeName)) {
continue;
}
if (currentlySelectedDropdownGenome.getDisplayableName().equalsIgnoreCase(genomeName)) {
JOptionPane.showMessageDialog(
IGV.getMainFrame(),
"<html>Genome [" + genomeName + "] is currently in use and cannot be removed." +
"<br>Please select another genome to view before trying to remove it.</html>");
continue;