Issue #244 Clean up and Link editor to chat now works.

Change-Id: I23b12fa44b8908b6a0c5ce79ca79ad73ff26df9d

Former-commit-id: 2c61bc2a50 [formerly fae1527331] [formerly 5d95a69f39] [formerly dc2f3316e6 [formerly 5d95a69f39 [formerly 51e85606ad7d7462ce84bb14bd4df0c792997a59]]]
Former-commit-id: dc2f3316e6
Former-commit-id: 27bd3129b256af64b1bce9adcab5ca25bc1e9327 [formerly 9712ba2751]
Former-commit-id: d29d2a1c92
This commit is contained in:
Roger Ferrel 2012-03-28 11:23:24 -05:00
parent f834bf7ca2
commit f1a9b8265c
9 changed files with 297 additions and 76 deletions

View file

@ -137,6 +137,7 @@
class="com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor" class="com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor"
default="true" default="true"
id="com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor" id="com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor"
icon="icons/messages.gif"
name="Map"> name="Map">
</editor> </editor>
</extension> </extension>

View file

@ -26,6 +26,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchListener; import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
@ -85,14 +87,16 @@ public class CollaborationDataManager {
*/ */
Map<String, DataUser> usersMap; Map<String, DataUser> usersMap;
private boolean linkCollaboration;
/** /**
* Mapping for all active chat sessions. * Mapping for all active chat sessions.
*/ */
Map<String, IVenueSession> sessionsMap; Map<String, IVenueSession> sessionsMap;
Map<String, AbstractRoleEventController> displaySessionsMap = new HashMap<String, AbstractRoleEventController>(); private Map<String, AbstractRoleEventController> roleEventControllersMap;
Map<String, CollaborationEditor> editorsMap = new HashMap<String, CollaborationEditor>(); Map<String, CollaborationEditor> editorsMap;
public static CollaborationDataManager getInstance() { public static CollaborationDataManager getInstance() {
if (instance == null) { if (instance == null) {
@ -116,9 +120,11 @@ public class CollaborationDataManager {
* Private constructor to for singleton class. * Private constructor to for singleton class.
*/ */
private CollaborationDataManager() { private CollaborationDataManager() {
linkCollaboration = false;
usersMap = new HashMap<String, DataUser>(); usersMap = new HashMap<String, DataUser>();
sessionsMap = new HashMap<String, IVenueSession>(); sessionsMap = new HashMap<String, IVenueSession>();
// displaySessionsMap = new HashMap<String, ISharedDisplaySession>(); roleEventControllersMap = new HashMap<String, AbstractRoleEventController>();
editorsMap = new HashMap<String, CollaborationEditor>();
} }
public String getLoginId() { public String getLoginId() {
@ -134,17 +140,15 @@ public class CollaborationDataManager {
return usersMap.get(id); return usersMap.get(id);
} }
public AbstractRoleEventController getDisplaySession(String sessonId) { public void setLinkCollaboration(boolean state) {
return displaySessionsMap.get(sessonId); this.linkCollaboration = state;
} }
public void setDisplaySession(String sessionId, public boolean getLinkCollaboration() {
AbstractRoleEventController controller) { return linkCollaboration;
displaySessionsMap.put(sessionId, controller);
} }
public void editorCreated(String venueId, CollaborationEditor editor) { public void editorCreated(String sessionId, CollaborationEditor editor) {
String sessionId = venueIdToSessionId(venueId);
editorsMap.put(sessionId, editor); editorsMap.put(sessionId, editor);
} }
@ -273,15 +277,75 @@ public class CollaborationDataManager {
IVenueSession session = sessionsMap.get(sessionId); IVenueSession session = sessionsMap.get(sessionId);
if (session != null) { if (session != null) {
sessionsMap.remove(sessionId); sessionsMap.remove(sessionId);
AbstractRoleEventController controller = displaySessionsMap
.remove(sessionId);
if (controller != null) {
controller.shutdown();
}
session.close(); session.close();
} }
} }
public void closeEditor(String sessionId) {
CollaborationEditor editor = editorsMap.remove(sessionId);
if (editor != null) {
for (IEditorReference ref : PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getEditorReferences()) {
if (editor == ref.getEditor(false)) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().hideEditor(ref);
}
}
}
AbstractRoleEventController controller = roleEventControllersMap
.remove(sessionId);
if (controller != null) {
controller.shutdown();
}
}
public void editorBringToTop(String sessionId) {
if (linkCollaboration) {
CollaborationEditor editor = CollaborationDataManager.getInstance()
.getEditor(sessionId);
if (editor != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().bringToTop(editor);
}
}
}
public String getSessinId(CollaborationEditor editor) {
String sessionId = null;
for (String key : editorsMap.keySet()) {
if (editor == editorsMap.get(key)) {
sessionId = key;
break;
}
}
return sessionId;
}
/**
* Bring the view associated with the sessionId to the top.
*
* @param sessionId
*/
public void viewBringToTop(String sessionId) {
if (linkCollaboration) {
for (IViewReference ref : PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getViewReferences()) {
if (sessionId.equals(ref.getSecondaryId())) {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().bringToTop(ref.getView(false));
} catch (NullPointerException ex) {
// Ignore happens during creation of view/editor.
}
break;
}
}
}
}
/** /**
* Generate a new session. * Generate a new session.
* *
@ -298,8 +362,9 @@ public class CollaborationDataManager {
String sessionId = null; String sessionId = null;
try { try {
session = manager.createCollaborationVenue(venue, subject); session = manager.createCollaborationVenue(venue, subject);
sessionId = venueIdToSessionId(session.getVenue().getInfo() // sessionId = venueIdToSessionId(session.getVenue().getInfo()
.getVenueID()); // .getVenueID());
sessionId = session.getSessionId();
// TODO throw an exception if unable to make connection? // TODO throw an exception if unable to make connection?
if (session.isConnected()) { if (session.isConnected()) {
ISharedDisplaySession displaySession = session ISharedDisplaySession displaySession = session
@ -308,7 +373,7 @@ public class CollaborationDataManager {
DataProviderEventController dpec = new DataProviderEventController( DataProviderEventController dpec = new DataProviderEventController(
displaySession); displaySession);
dpec.startup(); dpec.startup();
displaySessionsMap.put(sessionId, dpec); roleEventControllersMap.put(sessionId, dpec);
// TODO set displaySession's data provider and session leader. // TODO set displaySession's data provider and session leader.
} }
} catch (CollaborationException e) { } catch (CollaborationException e) {
@ -326,19 +391,23 @@ public class CollaborationDataManager {
} }
public String joinCollaborationSession(String venueName, String sessionId) { public String joinCollaborationSession(String venueName, String sessionId) {
String result = sessionId;
if (sessionsMap.get(sessionId) == null) { if (sessionsMap.get(sessionId) == null) {
IVenueSession session = null; IVenueSession session = null;
try { try {
session = getSessionManager().joinCollaborationVenue(venueName); session = getSessionManager().joinCollaborationVenue(venueName);
result = session.getSessionId();
ISharedDisplaySession displaySession = session ISharedDisplaySession displaySession = session
.spawnSharedDisplaySession(); .spawnSharedDisplaySession();
sessionsMap.put(sessionId, session); sessionsMap.put(result, session);
ParticipantEventController pec = new ParticipantEventController( ParticipantEventController pec = new ParticipantEventController(
displaySession); displaySession);
pec.startup(); pec.startup();
displaySessionsMap.put(sessionId, pec); roleEventControllersMap.put(sessionId, pec);
// displaySessionsMap.put(sessionId, displaySession); // TODO test only delete
// SharedEditor editor = EditorSetup.testLoadEditorData();
// pec.initDataArrived(editor);
} catch (CollaborationException e) { } catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as // TODO Auto-generated catch block. Please revise as
// appropriate. // appropriate.
@ -346,6 +415,6 @@ public class CollaborationDataManager {
e); e);
} }
} }
return sessionId; return result;
} }
} }

View file

@ -52,6 +52,10 @@ public class SessionGroup extends CollaborationGroup {
this.sessionRoot = sessionRoot; this.sessionRoot = sessionRoot;
} }
public void setId(String id) {
this.id = id;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -52,6 +52,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
@ -72,15 +74,13 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager; import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
import com.raytheon.uf.viz.collaboration.comm.provider.session.VenueSession;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup; import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
import com.raytheon.uf.viz.collaboration.data.CollaborationNode; import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser; import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.data.LoginUser; import com.raytheon.uf.viz.collaboration.data.LoginUser;
import com.raytheon.uf.viz.collaboration.data.SessionGroup; import com.raytheon.uf.viz.collaboration.data.SessionGroup;
import com.raytheon.uf.viz.collaboration.ui.role.DataProviderEventController; import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.role.ParticipantEventController;
import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView; import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView; import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView; import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
@ -198,13 +198,15 @@ public class CollaborationGroupView extends ViewPart {
Action.AS_CHECK_BOX) { Action.AS_CHECK_BOX) {
@Override @Override
public void run() { public void run() {
// TODO CollaborationDataManager.getInstance().setLinkCollaboration(
System.out.println("Link to editor here"); isChecked());
// createPrivateChat(); // createPrivateChat();
} }
}; };
linkToEditorAction.setImageDescriptor(CollaborationUtils linkToEditorAction.setImageDescriptor(CollaborationUtils
.getImageDescriptor("link_to_editor.gif")); .getImageDescriptor("link_to_editor.gif"));
linkToEditorAction.setChecked(CollaborationDataManager.getInstance()
.getLinkCollaboration());
inviteAction = new Action("Invite...") { inviteAction = new Action("Invite...") {
@Override @Override
@ -371,6 +373,7 @@ public class CollaborationGroupView extends ViewPart {
+ "close all collaboration views\n" + "and editors."); + "close all collaboration views\n" + "and editors.");
int result = messageBox.open(); int result = messageBox.open();
if (result == SWT.OK) { if (result == SWT.OK) {
// Close all Session Views
PlatformUI.getWorkbench().getActiveWorkbenchWindow() PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().hideView(this); .getActivePage().hideView(this);
for (IViewReference ref : PlatformUI.getWorkbench() for (IViewReference ref : PlatformUI.getWorkbench()
@ -382,16 +385,17 @@ public class CollaborationGroupView extends ViewPart {
.getActivePage().hideView(view); .getActivePage().hideView(view);
} }
} }
// TODO close collaboration CAVE editor(s).
// for (IEditorReference ref : // Close all Collaboration Editors.
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()) for (IEditorReference ref : PlatformUI.getWorkbench()
// { .getActiveWorkbenchWindow().getActivePage()
// IEditorPart editor = ref.getEditor(false); .getEditorReferences()) {
// if (editor instanceof CollaborationEditor) { IEditorPart editor = ref.getEditor(false);
// PlatformUI.getWorkbench().getActiveWorkbenchWindow() if (editor instanceof CollaborationEditor) {
// .getActivePage().hideEditor(ref); PlatformUI.getWorkbench().getActiveWorkbenchWindow()
// } .getActivePage().hideEditor(ref);
// } }
}
CollaborationDataManager.getInstance().closeManager(); CollaborationDataManager.getInstance().closeManager();
} }
} }
@ -511,10 +515,6 @@ public class CollaborationGroupView extends ViewPart {
.getInstance(); .getInstance();
sessionId = manager.createCollaborationSession(result.getName(), sessionId = manager.createCollaborationSession(result.getName(),
result.getSubject()); result.getSubject());
DataProviderEventController controller = new DataProviderEventController(
(VenueSession) manager.getSession(sessionId));
controller.startup();
manager.setDisplaySession(sessionId, controller);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@ -599,10 +599,12 @@ public class CollaborationGroupView extends ViewPart {
.getInstance(); .getInstance();
String sessionId = manager.joinCollaborationSession( String sessionId = manager.joinCollaborationSession(
sg.getText(), sg.getId()); sg.getText(), sg.getId());
ParticipantEventController controller = new ParticipantEventController( sg.setId(sessionId);
(VenueSession) manager.getSession(sessionId)); // ParticipantEventController controller = new
manager.setDisplaySession(sessionId, controller); // ParticipantEventController(
controller.startup(); // (VenueSession) manager.getSession(sessionId));
// manager.setDisplaySession(sessionId, controller);
// controller.startup();
try { try {
IViewPart part = PlatformUI IViewPart part = PlatformUI
.getWorkbench() .getWorkbench()
@ -610,7 +612,6 @@ public class CollaborationGroupView extends ViewPart {
.getActivePage() .getActivePage()
.showView(CollaborationSessionView.ID, sessionId, .showView(CollaborationSessionView.ID, sessionId,
IWorkbenchPage.VIEW_ACTIVATE); IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) { } catch (PartInitException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to open collaboation sesson", e); "Unable to open collaboation sesson", e);
@ -806,8 +807,9 @@ public class CollaborationGroupView extends ViewPart {
Collection<IVenueInfo> venuList = CollaborationDataManager Collection<IVenueInfo> venuList = CollaborationDataManager
.getInstance().getSessionManager().getVenueInfo(); .getInstance().getSessionManager().getVenueInfo();
for (IVenueInfo venu : venuList) { for (IVenueInfo venu : venuList) {
SessionGroup gp = new SessionGroup(CollaborationDataManager // SessionGroup gp = new SessionGroup(CollaborationDataManager
.getInstance().venueIdToSessionId(venu.getVenueID())); // .getInstance().venueIdToSessionId(venu.getVenueID()));
SessionGroup gp = new SessionGroup(null);
gp.setText(venu.getVenueName()); gp.setText(venu.getVenueName());
if (venu.getParticipantCount() > 0) { if (venu.getParticipantCount() > 0) {

View file

@ -19,6 +19,12 @@
**/ **/
package com.raytheon.uf.viz.collaboration.ui.editor; package com.raytheon.uf.viz.collaboration.ui.editor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.panes.PaneManager; import com.raytheon.viz.ui.panes.PaneManager;
@ -41,7 +47,8 @@ import com.raytheon.viz.ui.panes.PaneManager;
* @version 1.0 * @version 1.0
*/ */
public class CollaborationEditor extends AbstractEditor { public class CollaborationEditor extends AbstractEditor implements
IPartListener {
public static final String EDITOR_ID = "com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor"; public static final String EDITOR_ID = "com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor";
@ -53,4 +60,85 @@ public class CollaborationEditor extends AbstractEditor {
return pm; return pm;
} }
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
getEditorSite().getWorkbenchWindow().getPartService()
.addPartListener(this);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partActivated(IWorkbenchPart part) {
if (this == part) {
CollaborationDataManager manager = CollaborationDataManager
.getInstance();
String sessionId = manager.getSessinId(this);
manager.viewBringToTop(sessionId);
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart
* )
*/
@Override
public void partBroughtToTop(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partClosed(IWorkbenchPart part) {
if (this == part) {
getEditorSite().getWorkbenchWindow().getPartService()
.removePartListener(this);
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart
* )
*/
@Override
public void partDeactivated(IWorkbenchPart part) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partOpened(IWorkbenchPart part) {
if (this == part) {
CollaborationDataManager manager = CollaborationDataManager
.getInstance();
String sessionId = manager.getSessinId(this);
IVenueSession session = manager.getSession(sessionId);
String name = (session == null) ? sessionId : session.getVenue()
.getInfo().getVenueDescription();
setPartName(name);
}
}
} }

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.viz.collaboration.ui.editor; package com.raytheon.uf.viz.collaboration.ui.editor;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -157,6 +158,11 @@ public class EditorSetup {
// TODO delete // TODO delete
public static SharedEditor testLoadEditorData() { public static SharedEditor testLoadEditorData() {
File file = new File(PATH);
if (!file.exists()) {
testSaveEditorData();
}
SharedEditor se = null; SharedEditor se = null;
try { try {
se = (SharedEditor) SerializationUtil se = (SharedEditor) SerializationUtil

View file

@ -128,6 +128,8 @@ public abstract class AbstractSessionView extends ViewPart implements
} }
protected void createListeners() { protected void createListeners() {
getViewSite().getWorkbenchWindow().getPartService()
.addPartListener(this);
} }
private void createMessagesComp(Composite parent) { private void createMessagesComp(Composite parent) {
@ -251,8 +253,10 @@ public abstract class AbstractSessionView extends ViewPart implements
*/ */
@Override @Override
public void partClosed(IWorkbenchPart part) { public void partClosed(IWorkbenchPart part) {
getViewSite().getWorkbenchWindow().getPartService() if (this == part) {
.removePartListener(this); getViewSite().getWorkbenchWindow().getPartService()
.removePartListener(this);
}
} }
/* /*

View file

@ -27,6 +27,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
@ -139,7 +140,8 @@ public class CollaborationSessionView extends SessionView {
CollaborationDataManager.getInstance().getSession(sessionId) CollaborationDataManager.getInstance().getSession(sessionId)
.sendTextMessage(message); .sendTextMessage(message);
} catch (CollaborationException e) { } catch (CollaborationException e) {
// TODO Auto-generated catch block. Please revise as appropriate. // TODO Auto-generated catch block. Please revise as
// appropriate.
} }
} }
} }
@ -177,4 +179,48 @@ public class CollaborationSessionView extends SessionView {
} }
label.setText(labelInfo.toString()); label.setText(labelInfo.toString());
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#
* partActivated(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partActivated(IWorkbenchPart part) {
super.partActivated(part);
if (this == part) {
CollaborationDataManager.getInstance().editorBringToTop(sessionId);
}
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
super.partBroughtToTop(part);
}
@Override
public void partDeactivated(IWorkbenchPart part) {
super.partDeactivated(part);
}
@Override
public void partOpened(IWorkbenchPart part) {
super.partOpened(part);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#partClosed(org
* .eclipse.ui.IWorkbenchPart)
*/
@Override
public void partClosed(IWorkbenchPart part) {
super.partClosed(part);
if (part == this) {
CollaborationDataManager.getInstance().closeEditor(sessionId);
}
}
} }

View file

@ -214,10 +214,7 @@ public class SessionView extends AbstractSessionView {
*/ */
@Override @Override
protected void createListeners() { protected void createListeners() {
// this.getViewSite().getWorkbenchWindow().getPartService()
// .addPartListener(this);
super.createListeners(); super.createListeners();
// sessionId = getViewSite().getSecondaryId();
IVenueSession session = CollaborationDataManager.getInstance() IVenueSession session = CollaborationDataManager.getInstance()
.getSession(sessionId); .getSession(sessionId);
if (session != null) { if (session != null) {
@ -325,7 +322,6 @@ public class SessionView extends AbstractSessionView {
public int compare(Viewer viewer, Object e1, Object e2) { public int compare(Viewer viewer, Object e1, Object e2) {
CollaborationUser c1 = (CollaborationUser) e1; CollaborationUser c1 = (CollaborationUser) e1;
CollaborationUser c2 = (CollaborationUser) e1; CollaborationUser c2 = (CollaborationUser) e1;
// return super.compare(viewer, e1, e2);
return c1.compareTo(c2); return c1.compareTo(c2);
} }
}); });
@ -340,7 +336,7 @@ public class SessionView extends AbstractSessionView {
StringBuilder builder = new StringBuilder("-- Roles --"); StringBuilder builder = new StringBuilder("-- Roles --");
for (RoleType type : RoleType.values()) {// user.getRoles(sessionId)) for (RoleType type : RoleType.values()) {// user.getRoles(sessionId))
// { // {
// fake XXX take this out // TODO fake XXX take this out
if (type == RoleType.UNKNOWN) { if (type == RoleType.UNKNOWN) {
continue; continue;
} }
@ -379,15 +375,15 @@ public class SessionView extends AbstractSessionView {
@Override @Override
public void dispose() { public void dispose() {
CollaborationDataManager.getInstance().getSession(sessionId) // CollaborationDataManager.getInstance().getSession(sessionId)
.unRegisterEventHandler(this); // .unRegisterEventHandler(this);
// dispose of the images first // dispose of the images first
disposeArrow(highlightedDownArrow); disposeArrow(highlightedDownArrow);
disposeArrow(highlightedRightArrow); disposeArrow(highlightedRightArrow);
disposeArrow(downArrow); disposeArrow(downArrow);
disposeArrow(rightArrow); disposeArrow(rightArrow);
CollaborationDataManager.getInstance().closeSession(sessionId); // CollaborationDataManager.getInstance().closeSession(sessionId);
super.dispose(); super.dispose();
} }
@ -506,26 +502,31 @@ public class SessionView extends AbstractSessionView {
return SESSION_IMAGE_NAME; return SESSION_IMAGE_NAME;
} }
@Override // @Override
public void partActivated(IWorkbenchPart part) { // public void partActivated(IWorkbenchPart part) {
// nothing to do // // nothing to do
} // }
//
@Override // @Override
public void partBroughtToTop(IWorkbenchPart part) { // public void partBroughtToTop(IWorkbenchPart part) {
// TODO // // TODO
// if link with editor is on, need to activate the editor // // if link with editor is on, need to activate the editor
} // }
// @Override // @Override
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#partClosed
* (org.eclipse.ui.IWorkbenchPart)
*/
public void partClosed(IWorkbenchPart part) { public void partClosed(IWorkbenchPart part) {
super.partClosed(part); super.partClosed(part);
// TODO if (this == part) {
// here you need to end a session that is a temporary session CollaborationDataManager.getInstance().getSession(sessionId)
IVenueSession session = CollaborationDataManager.getInstance() .unRegisterEventHandler(this);
.getSession(sessionId); CollaborationDataManager.getInstance().closeSession(sessionId);
if (session != null) {
session.unRegisterEventHandler(this);
} }
} }