From 34981c24eaf09a49e9e5fcb80eb117c88701d679 Mon Sep 17 00:00:00 2001 From: Brad Gonzales Date: Thu, 10 Apr 2014 14:01:53 -0500 Subject: [PATCH] Issue #2937 Connect to the venue after the feed view is available. Change-Id: I6e560014308e6d17c8d7af525ded82d2399fa936 Former-commit-id: 0380e02c770b01a8adc0ddcf7e3e5e114482c9b1 [formerly 5fcec2776558fd10bbd6443f41454fe37ecade99] [formerly cc0fd1e9af6447f53d331f895b1f4c358a85a593] [formerly 0380e02c770b01a8adc0ddcf7e3e5e114482c9b1 [formerly 5fcec2776558fd10bbd6443f41454fe37ecade99] [formerly cc0fd1e9af6447f53d331f895b1f4c358a85a593] [formerly ea030960317072a479484095e73c52d1d5f891eb [formerly cc0fd1e9af6447f53d331f895b1f4c358a85a593 [formerly 7b0e689a06eeee9f7c39dd79642fcde8e329c990]]]] Former-commit-id: ea030960317072a479484095e73c52d1d5f891eb Former-commit-id: ccc4bc5a277bd5ac26ec760d425a08da90c29b47 [formerly e41f9defa4802204fa240a9f1fa2f1667b05a947] [formerly 4877a895772c022be238b72f3f06a1ed801f3390 [formerly 3b25edad9a565ed9d324377004d99092aee82789]] Former-commit-id: 7532bd6c2903b0a647393634444c14f575bbb9a0 [formerly 8f72707b3a98a10a718e6478da7004edaefd649e] Former-commit-id: 91d546d015e047a6416acb6219a8b6600e9f74e1 --- .../ui/actions/DisplayFeedAction.java | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java index 2f1fbe9978..31505b2769 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/actions/DisplayFeedAction.java @@ -58,12 +58,14 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jul 5, 2012 bsteffen Initial creation - * Dec 19, 2013 2563 bclement added check for feed venue existence + * Jul 5, 2012 bsteffen Initial creation + * Dec 19, 2013 2563 bclement added check for feed venue existence * Jan 28, 2014 2698 bclement changed feed venue filter to match whole name * Jan 30, 2014 2698 bclement added default handle of username * Feb 3, 2014 2699 bclement use preference handle default, display error if handle taken * Mar 06, 2014 2848 bclement removed CollaborationConnection.joinTextOnlyVenue() + * Apr 10, 2014 2937 bgonzale Connect to the venue after the feed view is available + * to display messages. * * * @@ -117,12 +119,12 @@ public class DisplayFeedAction extends Action { /** * Attempt to join the feed venue on server using the handle set in - * preferences. Displays and error and returns null if join wasn't + * preferences. Displays an error and returns null if the join wasn't * successful. * - * @return + * @return the joined VenueSession; null if failed to join */ - private String joinFeedVenue() { + private VenueSession joinFeedVenue() { CollaborationConnection connection = CollaborationConnection .getConnection(); String defaultHandle = HandleUtil.getDefaultHandle(); @@ -130,9 +132,8 @@ public class DisplayFeedAction extends Action { defaultHandle); try { session.configureVenue(); - session.connectToRoom(); connection.postEvent(session); - return session.getSessionId(); + return session; } catch (CollaborationException e) { connection.removeSession(session); final String msg = e.getLocalizedMessage() @@ -160,37 +161,40 @@ public class DisplayFeedAction extends Action { return; } - String sessionId; if (isChecked()) { - sessionId = joinFeedVenue(); - if (sessionId == null) { + VenueSession session = joinFeedVenue(); + if (session == null) { // we couldn't join, stop action setChecked(false); return; } + // handle if it is clicked to close or open the view as + // necessary + CaveWorkbenchPageManager page = CaveWorkbenchPageManager + .getActiveInstance(); + try { + page.showView(SessionFeedView.ID, session.getSessionId(), + IWorkbenchPage.VIEW_ACTIVATE); + // Connect to the room after opening the feed view. + session.connectToRoom(); + } catch (PartInitException e) { + statusHandler.handle(Priority.PROBLEM, + "Unable to join collaboration feed", e); + } catch (CollaborationException e) { + statusHandler.handle(Priority.PROBLEM, + "Unable to join collaboration feed", e); + } } else { - sessionId = getSessionId(); - } - - // handle if it is clicked to close or open the view as - // necessary - CaveWorkbenchPageManager page = CaveWorkbenchPageManager - .getActiveInstance(); - - if (!isChecked()) { + String sessionId = getSessionId(); + // handle if it is clicked to close or open the view as + // necessary + CaveWorkbenchPageManager page = CaveWorkbenchPageManager + .getActiveInstance(); IViewReference ref = page.findViewReference(SessionFeedView.ID, sessionId); if (ref != null) { page.hideView(ref); } - } else { - try { - page.showView(SessionFeedView.ID, sessionId, - IWorkbenchPage.VIEW_ACTIVATE); - } catch (PartInitException e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to join collaboration feed", e); - } } }