From e0e36eddc71a36c721457029c2f575b9d77e6a5e Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Fri, 11 May 2012 15:30:06 -0500 Subject: [PATCH] Issue #427 cleanup properly on exiting session Change-Id: I4779ce49f9a9ee6d64cd908e04b007d808cb3bc6 Former-commit-id: 797f1e5ec10029c108906e16cbd1a31e298d41a8 [formerly e68e75d735aac760439ed43eae311edd9dd38288] [formerly 797f1e5ec10029c108906e16cbd1a31e298d41a8 [formerly e68e75d735aac760439ed43eae311edd9dd38288] [formerly 057b5eb3b994dd444be384c478be57cff178d62b [formerly c42b670e619beaba9b22bfa3bbdc6e1f0b9da075]]] Former-commit-id: 057b5eb3b994dd444be384c478be57cff178d62b Former-commit-id: fd16a8ee65ad4c147f61d4996e25e1dd70ec19be [formerly e5a84290deec658ca8e32c5609c133d4c3489bc5] Former-commit-id: 6f1cc36e72b77b4036e435b68ef1039080664e3b --- .../data/SharedDisplaySessionMgr.java | 6 ++++-- .../ui/CollaborationGroupView.java | 17 +++++++++++++++++ .../ui/role/DataProviderEventController.java | 11 ++++++++++- .../ui/role/ParticipantEventController.java | 7 +++++-- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SharedDisplaySessionMgr.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SharedDisplaySessionMgr.java index bd2c3bf827..df7fc29174 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SharedDisplaySessionMgr.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SharedDisplaySessionMgr.java @@ -107,10 +107,12 @@ public class SharedDisplaySessionMgr { * @param sessionId */ public static void exitSession(String sessionId) { - SessionContainer container = sharedDisplaySessionMap.remove(sessionId); + SessionContainer container = sharedDisplaySessionMap.get(sessionId); if (container != null) { container.getRoleEventController().shutdown(); + + // remove after shutting down event controller + sharedDisplaySessionMap.remove(sessionId); } } - } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java index aed586ef77..3210ae83aa 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java @@ -104,6 +104,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationGroupContainer; +import com.raytheon.uf.viz.collaboration.data.SessionContainer; import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer; import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor; @@ -116,6 +117,7 @@ import com.raytheon.uf.viz.collaboration.ui.session.SessionView; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.icon.IconUtil; import com.raytheon.uf.viz.drawing.PathToolbar; +import com.raytheon.viz.ui.VizWorkbenchManager; /** * This class is the main view to display the user's information and allow the @@ -1399,6 +1401,21 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { } } } + + if (part instanceof CollaborationSessionView) { + String sessionId = ((CollaborationSessionView) part).getSessionId(); + SessionContainer container = SharedDisplaySessionMgr + .getSessionContainer(sessionId); + if (container != null) { + CollaborationEditor assocEditor = container + .getCollaborationEditor(); + if (assocEditor != null) { + IWorkbenchPage page = VizWorkbenchManager.getInstance() + .getCurrentWindow().getActivePage(); + page.closeEditor(assocEditor, false); + } + } + } } @Override diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java index 77226e1d6e..b560d96612 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.collaboration.ui.role; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -48,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.ui.editor.event.InputEvent; import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.CollaborationDispatcher; import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResource; import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData; +import com.raytheon.uf.viz.collaboration.ui.rsc.DataProviderRsc; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.VizApp; @@ -342,6 +344,7 @@ public class DataProviderEventController extends AbstractRoleEventController { rp.setResourceData(((CollaborationWrapperResourceData) rp .getResourceData()).getWrappedResourceData()); } + } /* @@ -361,11 +364,18 @@ public class DataProviderEventController extends AbstractRoleEventController { for (IDisplayPaneContainer container : sc.getSharedEditors()) { for (IDisplayPane pane : container.getDisplayPanes()) { ResourceList list = pane.getDescriptor().getResourceList(); + List rscToRemoveList = new ArrayList(); for (ResourcePair rp : list) { unwrapResourcePair(rp); + if (rp.getResource() instanceof DataProviderRsc) { + rscToRemoveList.add(rp); + } } list.removePreAddListener(wrappingListener); list.removePostRemoveListener(wrappingListener); + for (ResourcePair remove : rscToRemoveList) { + list.remove(remove); + } } DispatchingGraphicsFactory .extractRemoteFunctionality(container); @@ -375,7 +385,6 @@ public class DataProviderEventController extends AbstractRoleEventController { for (CollaborationDispatcher dispatcher : dispatchers) { dispatcher.dispose(); } - // TODO should remove the SharedEditorIndiciatorRsc } private class ResourceWrapperListener implements AddListener, diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java index 6a8bccc546..f5936b146c 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java @@ -89,8 +89,11 @@ public class ParticipantEventController extends AbstractRoleEventController { SessionContainer container = SharedDisplaySessionMgr .getSessionContainer(sessionId); container.setCollaborationEditor(editor); - editor.setTabTitle(session.getVenue().getInfo() - .getVenueDescription()); + String title = session.getVenue().getInfo() + .getVenueDescription(); + editor.setTabTitle(title); + editor.disableClose("Please close the \"" + title + + "\" chat to exit the session."); // initialize resources if (se.getLocalResources() != null) {