Exemplo n.º 1
0
 public void addUntargetedMessage(Connection connection, Message message, MessageRow.Type type) {
   Tab tab = getSelected();
   if (tab == null || !tab.getConnection().equals(connection)) {
     tab = null;
     for (Tab _tab : getItems()) {
       if (_tab.getConnection().equals(connection)) {
         tab = _tab;
         break;
       }
     }
     if (tab == null) {
       tab = create(connection, connection.getServer());
     }
   }
   tab.getContentPane().getMessagePane().addRow(new MessageRow(message, type));
 }
Exemplo n.º 2
0
 public Tab get(Connection connection, Entity entity) {
   for (Tab t : tabList.getItems()) {
     if (t.getConnection().equals(connection) && t.getEntity().equals(entity)) {
       return t;
     }
   }
   return create(connection, entity);
 }
Exemplo n.º 3
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();
 }