Ejemplo n.º 1
0
 public void close(Tab tab, boolean action) {
   if (getSelected().equals(tab)) {
     if (selectionModel.getSelectedIndex() == tabList.getItems().size()) {
       selectPrevious();
     } else {
       selectNext();
     }
   }
   {
     Iterator<Tab> it = tabList.getItems().iterator();
     while (it.hasNext()) {
       Tab _tab = it.next();
       if (_tab.equals(tab)) {
         it.remove();
         if (action) {
           if (tab.getEntity() instanceof Channel) {
             appPane.getContentPane().getConnection().part((Channel) tab.getEntity());
           } else if (tab.getEntity() instanceof Server) {
             appPane.getContentPane().getConnection().quit("");
           }
         }
         break;
       }
     }
   }
   if (tab.getEntity() instanceof Server) {
     Iterator<Tab> it = tabList.getItems().iterator();
     while (it.hasNext()) {
       Tab _tab = it.next();
       if (_tab.getConnection().equals(tab.getConnection())) {
         close(_tab);
       }
     }
   }
   Mercury.saveConnections();
 }