Issue #2937 Connect to the venue after the feed view is available.

Change-Id: I6e560014308e6d17c8d7af525ded82d2399fa936

Former-commit-id: 1bf427df2b [formerly 0380e02c77] [formerly 5fcec27765] [formerly 5fcec27765 [formerly cc0fd1e9af]] [formerly ea03096031 [formerly 5fcec27765 [formerly cc0fd1e9af] [formerly ea03096031 [formerly 7b0e689a06eeee9f7c39dd79642fcde8e329c990]]]]
Former-commit-id: ea03096031
Former-commit-id: e642cef69032186e6737d99673df7f1b5d2fbca1 [formerly 4877a895772c022be238b72f3f06a1ed801f3390] [formerly e41f9defa4 [formerly 3b25edad9a]]
Former-commit-id: e41f9defa4
Former-commit-id: ccc4bc5a27
This commit is contained in:
Brad Gonzales 2014-04-10 14:01:53 -05:00
parent edb203679b
commit f58b285c7c

View file

@ -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.
*
* </pre>
*
@ -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);
}
}
}