Issue #244 Send and accept invites now works.
Change-Id: I8d2c5e04f0d7dab6eb81a7321130533e5cfd6148 Former-commit-id:dc50eb06d7
[formerly22fff3a4b8
] [formerlydc50eb06d7
[formerly22fff3a4b8
] [formerly108ac66214
[formerly 6929e4f068cc397d253b3fabd712e093c4c16dbe]]] Former-commit-id:108ac66214
Former-commit-id:d3a8343de0
[formerly1fd4aa5cf3
] Former-commit-id:e3f637d951
This commit is contained in:
parent
5ce1b1bdd6
commit
ef55405397
4 changed files with 103 additions and 34 deletions
|
@ -16,7 +16,7 @@ Require-Bundle: com.raytheon.viz.ui,
|
|||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
org.geotools;bundle-version="2.6.4",
|
||||
com.google.guava;bundle-version="1.0.0",
|
||||
com.raytheon.viz.core;bundle-version="1.12.1174"
|
||||
com.raytheon.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.drawing;bundle-version="1.0.0"
|
||||
Import-Package: com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.viz.core.maps.display,
|
||||
|
|
|
@ -30,8 +30,11 @@ import org.eclipse.ui.IEditorReference;
|
|||
import org.eclipse.ui.IViewReference;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchListener;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -39,6 +42,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
|
||||
|
@ -46,6 +51,7 @@ import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
|||
import com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.DataProviderEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.ParticipantEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
/**
|
||||
|
@ -77,6 +83,8 @@ public class CollaborationDataManager {
|
|||
|
||||
String loginId;
|
||||
|
||||
Shell shell;
|
||||
|
||||
/**
|
||||
* Created when connection made. Used to clean up connection when CAVE shuts
|
||||
* down.
|
||||
|
@ -169,7 +177,7 @@ public class CollaborationDataManager {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = Display.getDefault().getActiveShell();
|
||||
shell = Display.getDefault().getActiveShell();
|
||||
if (shell == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -192,34 +200,7 @@ public class CollaborationDataManager {
|
|||
user.setMode(loginData.getMode());
|
||||
user.type = Type.AVAILABLE;
|
||||
user.statusMessage = loginData.getModeMessage();
|
||||
wbListener = new IWorkbenchListener() {
|
||||
|
||||
@Override
|
||||
public boolean preShutdown(
|
||||
IWorkbench workbench, boolean forced) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postShutdown(IWorkbench workbench) {
|
||||
if (manager != null) {
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
PlatformUI.getWorkbench().addWorkbenchListener(
|
||||
wbListener);
|
||||
} catch (Exception e) {
|
||||
if (manager != null) {
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
}
|
||||
if (wbListener != null) {
|
||||
PlatformUI.getWorkbench()
|
||||
.removeWorkbenchListener(wbListener);
|
||||
wbListener = null;
|
||||
}
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
MessageBox box = new MessageBox(shell, SWT.ERROR);
|
||||
|
@ -231,12 +212,37 @@ public class CollaborationDataManager {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isConnected()) {
|
||||
// Register handlers and events for the new manager.
|
||||
manager.registerEventHandler(this);
|
||||
wbListener = new IWorkbenchListener() {
|
||||
|
||||
@Override
|
||||
public boolean preShutdown(IWorkbench workbench,
|
||||
boolean forced) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postShutdown(IWorkbench workbench) {
|
||||
if (manager != null) {
|
||||
manager.unRegisterEventHandler(this);
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
PlatformUI.getWorkbench().addWorkbenchListener(wbListener);
|
||||
}
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
synchronized public void closeManager() {
|
||||
if (manager != null) {
|
||||
manager.unRegisterEventHandler(this);
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
}
|
||||
|
@ -392,6 +398,58 @@ public class CollaborationDataManager {
|
|||
return manager != null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleInvitationEvent(IVenueInvitationEvent event) {
|
||||
final IVenueInvitationEvent invitation = event;
|
||||
System.out.println("==== handleInvitationEvent sessionId: "
|
||||
+ invitation.getSessionId());
|
||||
System.out.println("==== handleInvitationEvent inviter: "
|
||||
+ invitation.getInviter());
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IQualifiedID inviter = invitation.getInviter();
|
||||
IQualifiedID room = invitation.getRoomId();
|
||||
MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK | SWT.CANCEL);
|
||||
box.setText("Invitation");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("You are invited to a collaboration.\n");
|
||||
sb.append("Inviter: ").append(inviter.getName()).append("\n");
|
||||
sb.append("Room: ").append(room.getName()).append("\n");
|
||||
sb.append("Subject: ").append(invitation.getSubject());
|
||||
box.setMessage(sb.toString());
|
||||
if (SWT.OK != box.open()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
IVenueSession session = manager
|
||||
.joinCollaborationVenue(invitation);
|
||||
String sessionId = session.getSessionId();
|
||||
sessionsMap.put(sessionId, session);
|
||||
PlatformUI
|
||||
.getWorkbench()
|
||||
.getActiveWorkbenchWindow()
|
||||
.getActivePage()
|
||||
.showView(CollaborationSessionView.ID, sessionId,
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
} catch (PartInitException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String joinCollaborationSession(String venueName, String sessionId) {
|
||||
String result = sessionId;
|
||||
if (sessionsMap.get(sessionId) == null) {
|
||||
|
|
|
@ -20,8 +20,10 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -243,7 +245,20 @@ public class CollaborationGroupView extends ViewPart {
|
|||
String sessionId = getId();
|
||||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
// session.sendInvitation(invitation)
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (CollaborationUser user : getSelectedUsers()) {
|
||||
String id = user.getId();
|
||||
if (!ids.contains(id)) {
|
||||
System.out.println("Add Selected User: " + id);
|
||||
ids.add(id);
|
||||
}
|
||||
}
|
||||
IVenueInfo info = session.getVenue().getInfo();
|
||||
System.out.println("room: " + info.getVenueName());
|
||||
System.out.println("subject: "
|
||||
+ session.getVenue().getInfo().getVenueSubject());
|
||||
session.sendInvitation(info.getVenueName(), ids, session
|
||||
.getVenue().getInfo().getVenueSubject(), "body");
|
||||
};
|
||||
};
|
||||
inviteAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||
|
|
|
@ -109,10 +109,6 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
setText("Collaboration Server Log On");
|
||||
}
|
||||
|
||||
// public void setLoginData(LoginData loginData) {
|
||||
// this.loginData = loginData;
|
||||
// }
|
||||
|
||||
private Control createDialogArea(Composite parent) {
|
||||
GridData gd = null;
|
||||
Composite body = new Composite(parent, SWT.NONE);
|
||||
|
|
Loading…
Add table
Reference in a new issue