int[] selectedRows = regionTable.getSelectedRows();
if (selectedRows != null && selectedRows.length > 0
&& regions.size() >= selectedRows.length) //dhmay: this is hacky. Bad things can happen with clear regions
{
RegionOfInterest firstStartRegion = null;
RegionOfInterest lastEndRegion = null;
Set<String> selectedChrs = new HashSet<String>();
//Figure out which region has the first start and which has the last end
for (int selectedRowIndex : selectedRows) {
int selectedModelRow = regionTableRowSorter.convertRowIndexToModel(selectedRowIndex);
RegionOfInterest region = regions.get(selectedModelRow);
selectedChrs.add(region.getChr());
if (firstStartRegion == null || region.getStart() < firstStartRegion.getStart())
firstStartRegion = region;
if (lastEndRegion == null || region.getEnd() > lastEndRegion.getEnd())
lastEndRegion = region;
}
//If there are multiple chromosomes represented in the selection, do nothing.
//Because what would we do? Maybe a status message should be displayed somehow, but a