/** * Called to accept an incoming invitation. Adds the invitation chat room to the list of chat * rooms and joins it. * * @param invitation the invitation to accept. */ public void acceptInvitation(WhiteboardInvitation invitation) { WhiteboardSession whiteboard = invitation.getTargetWhiteboard(); byte[] password = invitation.getWhiteboardPassword(); try { if (password == null) whiteboard.join(); else whiteboard.join(password); } catch (OperationFailedException e) { WhiteboardActivator.getUiService() .getPopupDialog() .showMessagePopupDialog( Resources.getString( "failedToJoinWhiteboard", new String[] {whiteboard.getWhiteboardID()}), Resources.getString("error"), PopupDialog.ERROR_MESSAGE); logger.error("Failed to join whiteboard: " + whiteboard.getWhiteboardID(), e); } }
/** * Implements the <tt>WhiteboardSessionPresenceListener .whiteboardSessionPresenceChanged</tt> * method. */ public void whiteboardSessionPresenceChanged(WhiteboardSessionPresenceChangeEvent evt) { WhiteboardSession whiteboardSession = evt.getWhiteboardSession(); if (evt.getEventType().equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_JOINED)) { whiteboardSession.addWhiteboardObjectListener(WhiteboardSessionManager.this); WhiteboardFrame frame = getWhiteboardFrame(evt.getWhiteboardSession()); if (frame == null) { frame = new WhiteboardFrame(WhiteboardSessionManager.this, whiteboardSession); frame.setVisible(true); wbFrames.add(frame); } } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_JOIN_FAILED)) { WhiteboardActivator.getUiService() .getPopupDialog() .showMessagePopupDialog( Resources.getString( "failedToJoinWhiteboard", new String[] {whiteboardSession.getWhiteboardID()}) + evt.getReason(), Resources.getString("error"), PopupDialog.ERROR_MESSAGE); } else if (evt.getEventType().equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_LEFT)) { WhiteboardFrame frame = getWhiteboardFrame(whiteboardSession); if (frame == null) return; wbFrames.remove(frame); frame.dispose(); whiteboardSession.removeWhiteboardObjectListener(WhiteboardSessionManager.this); } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_KICKED)) { } else if (evt.getEventType() .equals(WhiteboardSessionPresenceChangeEvent.LOCAL_USER_DROPPED)) { } }