throw new ClassCastException();
}
tree.setSelectionPath(path);
AutomatedTreeNode node = (AutomatedTreeNode) path
.getLastPathComponent();
Object selectedUserObject = node.getUserObject();
if (selectedUserObject.getClass().equals(BuddyStatus.class)) {
buddy = (BuddyStatus) node.getUserObject();
buddyPopupMenu.showMenu(e.getComponent(), e.getX(), e
.getY(), buddy);
} else if (selectedUserObject.getClass().equals(
BuddyGroup.class)) {
// buddies that are not in any group are put in
// "Contacts" group by JBother
// if we need to send a message to them, we need to
// extract them from the tree
// because there is no way to do it from the roster
Enumeration iChildren = node.children();
String usersList = new String();
while (iChildren.hasMoreElements())
{
AutomatedTreeNode o = (AutomatedTreeNode) iChildren
.nextElement();
BuddyStatus buddyStatus = (BuddyStatus) o
.getUserObject();
usersList += buddyStatus.getUser() + MessagePanel.RECIPIENTS_DELIMITER + " ";
}
// get rid of 'unneeded delimiter + space' string at the end
usersList = usersList.substring(0, usersList.length() -