コード例 #1
0
  /**
   * Creates an {@link OtrContactMenu} for each {@link Contact} contained in the
   * <tt>metaContact</tt>.
   *
   * @param metaContact The {@link MetaContact} this {@link OtrMetaContactMenu} refers to.
   */
  private void createOtrContactMenus(MetaContact metaContact) {
    JMenu menu = getMenu();

    // Remove any existing OtrContactMenu items.
    menu.removeAll();

    // Create the new OtrContactMenu items.
    if (metaContact != null) {
      Iterator<Contact> contacts = metaContact.getContacts();

      if (metaContact.getContactCount() == 1) {
        new OtrContactMenu(contacts.next(), inMacOSXScreenMenuBar, menu, false);
      } else
        while (contacts.hasNext()) {
          new OtrContactMenu(contacts.next(), inMacOSXScreenMenuBar, menu, true);
        }
    }
  }