*/
protected void joinChatRoom(IContainer container, IChatRoomInfo roomInfo, String password) throws ECFException {
Assert.isNotNull(container);
Assert.isNotNull(roomInfo);
// Check to make sure given container is connected.
ID connectedID = container.getConnectedID();
if (connectedID == null)
throw new ECFException(Messages.MultiRosterView_EXCEPTION_JOIN_ROOM_NOT_CONNECTED);
// Check to make sure that the given container is one that we have in
// our accounts set
if (findAccountForContainer(container) == null)
throw new ECFException(Messages.MultiRosterView_EXCEPTION_JOIN_ROOM_INVALID_ACCOUNT);
IWorkbenchWindow ww = getViewSite().getPage().getWorkbenchWindow();
IWorkbenchPage wp = ww.getActivePage();
// Get existing roomView...if it's there
RoomWithAView roomView = (RoomWithAView) chatRooms.get(connectedID);
if (roomView != null) {
// We've already connected to this room, so just show it.
ChatRoomManagerView chatroommanagerview = roomView.getView();
wp.activate(chatroommanagerview);
chatroommanagerview.joinRoom(roomInfo, password);
return;
}
try {
IViewReference ref = wp.findViewReference(org.eclipse.ecf.presence.ui.chatroom.ChatRoomManagerView.VIEW_ID, connectedID.getName());
// Open view for given connectedID (secondaryID)
final ChatRoomManagerView chatroommanagerview = (ChatRoomManagerView) ((ref == null) ? wp.showView(org.eclipse.ecf.presence.ui.chatroom.ChatRoomManagerView.VIEW_ID, connectedID.getName(), IWorkbenchPage.VIEW_ACTIVATE) : ref.getView(true));
// initialize new view
chatroommanagerview.initializeWithoutManager(ChatRoomManagerView.getUsernameFromID(connectedID), ChatRoomManagerView.getHostnameFromID(connectedID), createChatRoomCommandListener(), createChatRoomViewCloseListener(connectedID));
// join room
chatroommanagerview.joinRoom(roomInfo, password);