Issue #437 Change to up date Presence in the Group View.
Change-Id: I59d4f4fcc14f59dc3017c118d3613f6f7040dca8 Former-commit-id:2109190752
[formerlyc5399687bc
[formerly b64a623cda4ec00d555d8542da496286e0210dac]] Former-commit-id:c5399687bc
Former-commit-id:225a8762d1
This commit is contained in:
parent
47a24a20c2
commit
61f3e1fb0e
5 changed files with 223 additions and 175 deletions
|
@ -39,6 +39,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -92,7 +93,7 @@ public class CollaborationDataManager {
|
|||
/**
|
||||
* The connection to the server.
|
||||
*/
|
||||
private SessionManager manager;
|
||||
private SessionManager sessionManager;
|
||||
|
||||
String loginId;
|
||||
|
||||
|
@ -120,6 +121,8 @@ public class CollaborationDataManager {
|
|||
|
||||
Map<String, CollaborationEditor> editorsMap;
|
||||
|
||||
private EventBus eventBus;
|
||||
|
||||
public static CollaborationDataManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new CollaborationDataManager();
|
||||
|
@ -147,6 +150,7 @@ public class CollaborationDataManager {
|
|||
sessionsMap = new HashMap<String, IVenueSession>();
|
||||
roleEventControllersMap = HashMultimap.create();
|
||||
editorsMap = new HashMap<String, CollaborationEditor>();
|
||||
eventBus = new EventBus();
|
||||
}
|
||||
|
||||
public String getLoginId() {
|
||||
|
@ -179,13 +183,13 @@ public class CollaborationDataManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the session manager and if needed the user/password.
|
||||
* Get the session sessionManager and if needed the user/password.
|
||||
*
|
||||
* @return manager or null if unable to get connection.
|
||||
* @return sessionManager or null if unable to get connection.
|
||||
*/
|
||||
synchronized public SessionManager getSessionManager() {
|
||||
// Get user's server account information and make connection.
|
||||
if (manager == null) {
|
||||
if (isConnected() == false) {
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
||||
@Override
|
||||
|
@ -196,16 +200,15 @@ public class CollaborationDataManager {
|
|||
}
|
||||
LoginDialog dlg = new LoginDialog(shell);
|
||||
LoginData loginData = null;
|
||||
while (manager == null) {
|
||||
while (isConnected() == false) {
|
||||
loginData = (LoginData) dlg.open();
|
||||
dlg.close();
|
||||
if (loginData == null) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
manager = new SessionManager(
|
||||
loginData.getAccount(), loginData
|
||||
.getPassword());
|
||||
sessionManager = new SessionManager(loginData
|
||||
.getAccount(), loginData.getPassword());
|
||||
loginId = loginData.getAccount();
|
||||
DataUser user = CollaborationDataManager
|
||||
.getInstance().getUser(loginId);
|
||||
|
@ -230,10 +233,10 @@ public class CollaborationDataManager {
|
|||
});
|
||||
|
||||
if (isConnected()) {
|
||||
// Register handlers and events for the new manager.
|
||||
manager.registerEventHandler(this);
|
||||
// Register handlers and events for the new sessionManager.
|
||||
sessionManager.registerEventHandler(this);
|
||||
try {
|
||||
ISession p2pSession = manager.getPeerToPeerSession();
|
||||
ISession p2pSession = sessionManager.getPeerToPeerSession();
|
||||
p2pSession.registerEventHandler(this);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
|
@ -251,9 +254,9 @@ public class CollaborationDataManager {
|
|||
|
||||
@Override
|
||||
public void postShutdown(IWorkbench workbench) {
|
||||
if (manager != null) {
|
||||
if (sessionManager != null) {
|
||||
try {
|
||||
ISession p2pSession = manager
|
||||
ISession p2pSession = sessionManager
|
||||
.getPeerToPeerSession();
|
||||
p2pSession.unRegisterEventHandler(this);
|
||||
} catch (CollaborationException e) {
|
||||
|
@ -262,9 +265,9 @@ public class CollaborationDataManager {
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
manager.unRegisterEventHandler(this);
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
sessionManager.unRegisterEventHandler(this);
|
||||
sessionManager.closeManager();
|
||||
sessionManager = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -272,14 +275,14 @@ public class CollaborationDataManager {
|
|||
}
|
||||
}
|
||||
|
||||
return manager;
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
synchronized public void closeManager() {
|
||||
if (manager != null) {
|
||||
manager.unRegisterEventHandler(this);
|
||||
manager.closeManager();
|
||||
manager = null;
|
||||
if (sessionManager != null) {
|
||||
sessionManager.unRegisterEventHandler(this);
|
||||
sessionManager.closeManager();
|
||||
sessionManager = null;
|
||||
}
|
||||
if (wbListener != null) {
|
||||
PlatformUI.getWorkbench().removeWorkbenchListener(wbListener);
|
||||
|
@ -445,7 +448,7 @@ public class CollaborationDataManager {
|
|||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return manager != null;
|
||||
return sessionManager != null && sessionManager.isConnected();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -481,7 +484,7 @@ public class CollaborationDataManager {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
IVenueSession session = manager
|
||||
IVenueSession session = sessionManager
|
||||
.joinCollaborationVenue(invitation);
|
||||
String sessionId = session.getSessionId();
|
||||
sessionsMap.put(sessionId, session);
|
||||
|
@ -562,13 +565,34 @@ public class CollaborationDataManager {
|
|||
* @return
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleModifiedPresence(IRosterEntry rosterEntry) {
|
||||
System.out.println("CollaborationDataManager.handleModifiedPresence");
|
||||
System.out.println(" user " + rosterEntry.getUser().getFQName());
|
||||
System.out.println(" mode " + rosterEntry.getPresence().getMode());
|
||||
System.out.println(" type " + rosterEntry.getPresence().getType());
|
||||
public void handleModifiedPresence(IRosterEntry entry) {
|
||||
final IRosterEntry rosterEntry = entry;
|
||||
// System.out.println("CollaborationDataManager.handleModifiedPresence");
|
||||
// System.out.println(" user " + rosterEntry.getUser().getFQName());
|
||||
// System.out.println(" mode " +
|
||||
// rosterEntry.getPresence().getMode());
|
||||
// System.out.println(" type " +
|
||||
// rosterEntry.getPresence().getType());
|
||||
// System.out.println(" message"
|
||||
// + rosterEntry.getPresence().getStatusMessage());
|
||||
// System.out.println(" groups " + rosterEntry.getGroups());
|
||||
String userId = rosterEntry.getUser().getFQName();
|
||||
DataUser user = usersMap.get(userId);
|
||||
if (user != null) {
|
||||
user.mode = rosterEntry.getPresence().getMode();
|
||||
user.type = rosterEntry.getPresence().getType();
|
||||
user.statusMessage = rosterEntry.getPresence().getStatusMessage();
|
||||
// Assumes only UI updates will be registered.
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
eventBus.post(rosterEntry);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public String joinCollaborationSession(String venueName, String sessionId) {
|
||||
String result = sessionId;
|
||||
|
@ -611,4 +635,12 @@ public class CollaborationDataManager {
|
|||
.getActiveEditor());
|
||||
return list;
|
||||
}
|
||||
|
||||
public void registerEventHandler(Object handler) {
|
||||
eventBus.register(handler);
|
||||
}
|
||||
|
||||
public void unRegisterEventHandler(Object handler) {
|
||||
eventBus.unregister(handler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.raytheon.uf.viz.collaboration.data;
|
|||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +46,8 @@ public class CollaborationUser extends CollaborationNode implements
|
|||
|
||||
String session;
|
||||
|
||||
IChatID iChatID;
|
||||
|
||||
public CollaborationUser(String id) {
|
||||
super(id);
|
||||
this.session = null;
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.part.ViewPart;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
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;
|
||||
|
@ -80,6 +81,7 @@ 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.IRosterManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||
|
@ -220,7 +222,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
inviteAction = new Action("Invite...") {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Invite... to join room " + getId());
|
||||
System.out.println("Invite... to join session" + getId());
|
||||
String sessionId = getId();
|
||||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
|
@ -244,6 +246,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
};
|
||||
inviteAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||
"invite.gif"));
|
||||
inviteAction
|
||||
.setToolTipText("Invite selected user(s) to join a session.");
|
||||
|
||||
joinAction = new Action("Join Session") {
|
||||
@Override
|
||||
|
@ -255,7 +259,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
peerToPeerChatAction = new Action("Private Chat") {
|
||||
@Override
|
||||
public void run() {
|
||||
createPrivateChat(getId());
|
||||
createP2PChat(getId());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -290,42 +294,50 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
@Override
|
||||
public void run() {
|
||||
System.out.println("Rename action");
|
||||
nyiFeature("Rename");
|
||||
}
|
||||
};
|
||||
|
||||
addUserAction = new Action("Add User") {
|
||||
public void run() {
|
||||
System.out.println("Add User");
|
||||
addUsersToGroup();
|
||||
};
|
||||
};
|
||||
addUserAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||
"add_contact.gif"));
|
||||
addUserAction.setEnabled(false);
|
||||
|
||||
addGroupAction = new Action("Create Group") {
|
||||
public void run() {
|
||||
System.out.println("Create Group here");
|
||||
nyiFeature("Create Group");
|
||||
};
|
||||
};
|
||||
addGroupAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||
"add_group.gif"));
|
||||
addGroupAction.setEnabled(false);
|
||||
|
||||
selectGroups = new Action("Select System Groups...") {
|
||||
public void run() {
|
||||
System.out.println("Select System Groups to Display...");
|
||||
nyiFeature("Select System Groups.");
|
||||
}
|
||||
};
|
||||
selectGroups.setEnabled(false);
|
||||
|
||||
changeStatusAction = new Action("Change Status...") {
|
||||
public void run() {
|
||||
changeStatus();
|
||||
};
|
||||
};
|
||||
changeStatusAction.setEnabled(false);
|
||||
|
||||
changePasswordAction = new Action("Change password...") {
|
||||
public void run() {
|
||||
changePassword();
|
||||
};
|
||||
};
|
||||
changePasswordAction.setEnabled(false);
|
||||
|
||||
// changeStatusAction = new Action("Change Status",
|
||||
// Action.AS_DROP_DOWN_MENU) {
|
||||
|
@ -425,6 +437,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
usersTreeViewer.refresh(loginUser, true);
|
||||
SessionManager sessionManager = CollaborationDataManager
|
||||
.getInstance().getSessionManager();
|
||||
// TODO this will change will be able to get existing presences.
|
||||
Presence presence = new Presence();
|
||||
presence.setProperty("dummy", "dummy");
|
||||
presence.setMode(loginData.getMode());
|
||||
|
@ -437,6 +450,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
System.out.println("send mode change here: "
|
||||
+ loginData.getMode().toString() + ", Message: \""
|
||||
|
@ -640,22 +655,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
|
||||
private void createPrivateView(CreateSessionData result) {
|
||||
String sessionId = result.getSessionId();
|
||||
// try {
|
||||
// // TODO Do not use createCollaborationSession once private session
|
||||
// // implemented.
|
||||
// sessionId = CollaborationDataManager.getInstance()
|
||||
// .createCollaborationSession(result.getName(),
|
||||
// result.getSubject());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// if (sessionId == null) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
try {
|
||||
IViewPart part = PlatformUI
|
||||
PlatformUI
|
||||
.getWorkbench()
|
||||
.getActiveWorkbenchWindow()
|
||||
.getActivePage()
|
||||
|
@ -669,12 +670,11 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
System.out.println("sessionId - Invite: " + user.getId());
|
||||
}
|
||||
}
|
||||
// refreshActiveSessions();
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open collaboation sesson", e);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, "Unexpected excepton", e);
|
||||
statusHandler.handle(Priority.ERROR, "Unexpected exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,27 +709,15 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void createPrivateChat(String user) {
|
||||
// IStructuredSelection selection = (IStructuredSelection)
|
||||
// usersTreeViewer
|
||||
// .getSelection();
|
||||
// TODO
|
||||
// List<ID> users = new ArrayList<ID>();
|
||||
// ID id = IDFactory.getDefault().createID(
|
||||
// CollaborationData.getInstance().getClient()
|
||||
// .getConnectNamespace(), "abc@awipscm.omaha.us.ray.com");
|
||||
// users.add(id);
|
||||
private void createP2PChat(String user) {
|
||||
System.err.println("createPrivateChat with " + user);
|
||||
try {
|
||||
// if (users.size() > 0) {
|
||||
// CollaborationUtils.createChat(users);
|
||||
PlatformUI
|
||||
.getWorkbench()
|
||||
.getActiveWorkbenchWindow()
|
||||
.getActivePage()
|
||||
.showView(PeerToPeerView.ID, user,
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
// }
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to open chat", e);
|
||||
}
|
||||
|
@ -899,8 +887,18 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
topLevel.removeChildren();
|
||||
if (sessionManager == null) {
|
||||
usersTreeViewer.getTree().setEnabled(false);
|
||||
addGroupAction.setEnabled(false);
|
||||
addUserAction.setEnabled(false);
|
||||
selectGroups.setEnabled(false);
|
||||
changeStatusAction.setEnabled(false);
|
||||
changePasswordAction.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
addGroupAction.setEnabled(true);
|
||||
addUserAction.setEnabled(true);
|
||||
selectGroups.setEnabled(true);
|
||||
changeStatusAction.setEnabled(true);
|
||||
changePasswordAction.setEnabled(true);
|
||||
|
||||
LoginUser user = new LoginUser(manager.getLoginId());
|
||||
topLevel.addChild(user);
|
||||
|
@ -975,19 +973,19 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
int rsize = -1;
|
||||
int gsize = -1;
|
||||
if (roster != null) {
|
||||
// TODO remove DEBUG start
|
||||
if (roster.getUser() != null) {
|
||||
name = roster.getUser().getName();
|
||||
}
|
||||
if (roster.getEntries() != null) {
|
||||
rsize = roster.getEntries().size();
|
||||
}
|
||||
if (roster.getGroups() != null) {
|
||||
gsize = roster.getGroups().size();
|
||||
}
|
||||
System.out.println("rosterManager Name " + name + ": group size "
|
||||
+ gsize + ": entry size " + rsize);
|
||||
// TODO DEBUG end remove
|
||||
// // TODO remove DEBUG start
|
||||
// if (roster.getUser() != null) {
|
||||
// name = roster.getUser().getName();
|
||||
// }
|
||||
// if (roster.getEntries() != null) {
|
||||
// rsize = roster.getEntries().size();
|
||||
// }
|
||||
// if (roster.getGroups() != null) {
|
||||
// gsize = roster.getGroups().size();
|
||||
// }
|
||||
// System.out.println("rosterManager Name " + name + ": group size "
|
||||
// + gsize + ": entry size " + rsize);
|
||||
// // TODO DEBUG end remove
|
||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||
if (rosterGroup != null) {
|
||||
populateGroup(topLevel, rosterGroup);
|
||||
|
@ -1003,49 +1001,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
+ e.getUser().getResource());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO get Groups from server.
|
||||
// for (String g : new String[] { "Mybuddy1", "buddy1" }) {
|
||||
// CollaborationGroup group = new CollaborationGroup(g);
|
||||
// group.setLocal(true);
|
||||
// group.setModifiable(true);
|
||||
// topLevel.addChild(group);
|
||||
// for (String u : new String[] {
|
||||
// "jkorman@awipscm.omaha.us.ray.com",
|
||||
// "abc@awipscm.omaha.us.ray.com",
|
||||
// "mnash@awipscm.omaha.us.ray.com" }) {
|
||||
// CollaborationUser item = new CollaborationUser(u);
|
||||
// group.addChild(item);
|
||||
// item.setMode(Mode.AVAILABLE);
|
||||
// item.setType(Type.AVAILABLE);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // TODO get from server
|
||||
// for (String g : new String[] { "OAX", "DSM", "LBF", "FSD" }) {
|
||||
// CollaborationGroup group = new CollaborationGroup(g);
|
||||
// group.setLocal(false);
|
||||
// topLevel.addChild(group);
|
||||
// for (String u : new String[] { g + "_user2", g + "_user3",
|
||||
// g + "_user1" }) {
|
||||
// CollaborationUser item = new CollaborationUser(u);
|
||||
// group.addChild(item);
|
||||
// item.setMode(Mode.AWAY);
|
||||
// item.setType(Type.AVAILABLE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
// CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
||||
// me.setMode(Mode.AVAILABLE);
|
||||
// me.setType(Type.AVAILABLE);
|
||||
// for (CollaborationNode node : topLevel.getChildren()) {
|
||||
// if ("OAX".equals(node.getId())) {
|
||||
// ((CollaborationGroup) node).addChild(me);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1147,6 +1103,59 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
return selectedUsers;
|
||||
}
|
||||
|
||||
private void addUsersToGroup() {
|
||||
Set<CollaborationUser> users = getSelectedUsers();
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTreeViewer
|
||||
.getSelection();
|
||||
Object[] nodes = selection.toArray();
|
||||
System.out.println("Add User: " + users.size());
|
||||
IRosterManager rosterManager = CollaborationDataManager.getInstance()
|
||||
.getSessionManager().getRosterManager();
|
||||
for (Object node : nodes) {
|
||||
if (node instanceof CollaborationUser) {
|
||||
CollaborationUser user = (CollaborationUser) node;
|
||||
try {
|
||||
String account = user.getId();
|
||||
String nickname = Tools.parseName(account);
|
||||
// String[] groups = new String[] { "rogerTestGroup" };
|
||||
String[] groups = null;
|
||||
rosterManager.sendRosterAdd(account, nickname, groups);
|
||||
// rosterManager.sendRosterRemove(userId)
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
// for (CollaborationUser user : users) {
|
||||
// try {
|
||||
// String account = user.getId();
|
||||
// String nickname = account.substring(0, account.indexOf('@'));
|
||||
// rosterManager.sendRosterAdd(account, nickname,
|
||||
// new String[] { "rogertestgroup" });
|
||||
// } catch (CollaborationException e) {
|
||||
// // TODO Auto-generated catch block. Please revise as
|
||||
// // appropriate.
|
||||
// statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
// e);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This should go away as all actions are implemented.
|
||||
*
|
||||
* @param feature
|
||||
*/
|
||||
private void nyiFeature(String feature) {
|
||||
MessageBox messageBox = new MessageBox(Display.getCurrent()
|
||||
.getActiveShell(), SWT.ICON_INFORMATION);
|
||||
messageBox.setText("Not Yet Implemented");
|
||||
messageBox.setMessage(feature);
|
||||
messageBox.open();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -1173,7 +1182,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
String loginUserId = CollaborationDataManager.getInstance()
|
||||
.getLoginId();
|
||||
if (loginUserId.equals(node.getId()) == false) {
|
||||
createPrivateChat(node.getId());
|
||||
createP2PChat(node.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1232,11 +1241,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
}
|
||||
}
|
||||
} else if (part == this) {
|
||||
// TODO Remove rosterManger handler.
|
||||
// IRosterManager rosterManager =
|
||||
// CollaborationDataManager.getInstance()
|
||||
// .getSessionManager().getRosterManager();
|
||||
// rosterManager.removeEventHandler(this);
|
||||
CollaborationDataManager.getInstance().unRegisterEventHandler(this);
|
||||
getViewSite().getWorkbenchWindow().getPartService()
|
||||
.removePartListener(this);
|
||||
}
|
||||
|
@ -1274,12 +1279,17 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
activeSessionGroup.addChild(child);
|
||||
usersTreeViewer.refresh(activeSessionGroup);
|
||||
} else if (part == this) {
|
||||
// TODO register even handler for
|
||||
// IRosterManager rosterManager =
|
||||
// CollaborationDataManager.getInstance()
|
||||
// .getSessionManager().getRosterManager();
|
||||
// rosterManager.registerEventHandler(this);
|
||||
CollaborationDataManager.getInstance().registerEventHandler(this);
|
||||
populateTree();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleModifiedPresence(IRosterEntry rosterEntry) {
|
||||
System.out.println("group view roster entry for:"
|
||||
+ rosterEntry.getUser().getFQName() + " "
|
||||
+ rosterEntry.getPresence().getMode() + "/"
|
||||
+ rosterEntry.getPresence().getType());
|
||||
usersTreeViewer.refresh(topLevel, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,45 +161,20 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
String toUser = getViewSite().getSecondaryId();
|
||||
String message = getComposedMessage();
|
||||
if (message.length() > 0) {
|
||||
// Get any open session to send peer-to-peer message
|
||||
IPeerToPeer p2p = null;
|
||||
try {
|
||||
p2p = (IPeerToPeer) CollaborationDataManager.getInstance()
|
||||
.getSessionManager().getPeerToPeerSession();
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
IPeerToPeer p2p = (IPeerToPeer) manager.getSessionManager()
|
||||
.getPeerToPeerSession();
|
||||
p2p.sendPeerToPeer(toUser, message);
|
||||
appendMessage(manager.getLoginId(), null,
|
||||
System.currentTimeMillis(), message);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
if (p2p != null) {
|
||||
p2p.sendPeerToPeer(toUser, message);
|
||||
// TODO need to put the message in messag text field here.
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
String fqName = manager.getLoginId();
|
||||
String name = null;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
appendMessage(fqName, name, timestamp, message);
|
||||
}
|
||||
|
||||
// ISession session = CollaborationDataManager.getInstance()
|
||||
// .getSession(null);
|
||||
// if (session != null) {
|
||||
// session.sendTextMessage(toUser, message);
|
||||
// } else {
|
||||
// try {
|
||||
// session = CollaborationDataManager.getInstance()
|
||||
// .getSessionManager().createPeerToPeerSession();
|
||||
// // session.sendTextMessage(toUser, message);
|
||||
// // session.close();
|
||||
// } catch (CollaborationException e) {
|
||||
// // TODO Auto-generated catch block. Please revise as
|
||||
// // appropriate.
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e.getLocalizedMessage(), e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||
|
@ -68,6 +66,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventTyp
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
|
@ -218,9 +217,9 @@ public class SessionView extends AbstractSessionView {
|
|||
super.createListeners();
|
||||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
if (session != null) {
|
||||
session.registerEventHandler(this);
|
||||
}
|
||||
// if (session != null) {
|
||||
// session.registerEventHandler(this);
|
||||
// }
|
||||
}
|
||||
|
||||
protected void createUsersComp(final Composite parent) {
|
||||
|
@ -361,10 +360,11 @@ public class SessionView extends AbstractSessionView {
|
|||
for (IVenueParticipant participant : session.getVenue()
|
||||
.getParticipants()) {
|
||||
|
||||
CollaborationUser user = new CollaborationUser(
|
||||
participant.getFQName());
|
||||
user.setMode(Mode.AVAILABLE);
|
||||
user.setType(Type.AVAILABLE);
|
||||
String userId = getParticipantUserId(participant);
|
||||
CollaborationUser user = new CollaborationUser(userId,
|
||||
sessionId);
|
||||
// user.setMode(Mode.AVAILABLE);
|
||||
// user.setType(Type.AVAILABLE);
|
||||
|
||||
// ParticipantRole[] roles = user.getRoles(sessionId);
|
||||
// for (ParticipantRole role : roles) {
|
||||
|
@ -387,6 +387,14 @@ public class SessionView extends AbstractSessionView {
|
|||
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||
}
|
||||
|
||||
private String getParticipantUserId(IVenueParticipant participant) {
|
||||
String pFQName = participant.getFQName();
|
||||
StringBuilder sb = new StringBuilder(pFQName.subSequence(0,
|
||||
pFQName.indexOf('@') + 1));
|
||||
sb.append(Tools.parseHost(pFQName).substring("conference.".length()));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// dispose of the images first
|
||||
|
@ -436,7 +444,6 @@ public class SessionView extends AbstractSessionView {
|
|||
return SESSION_IMAGE_NAME;
|
||||
}
|
||||
|
||||
// @Override
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -444,6 +451,7 @@ public class SessionView extends AbstractSessionView {
|
|||
* com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#partClosed
|
||||
* (org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partClosed(IWorkbenchPart part) {
|
||||
super.partClosed(part);
|
||||
if (this == part) {
|
||||
|
@ -453,6 +461,23 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#partOpened
|
||||
* (org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
@Override
|
||||
public void partOpened(IWorkbenchPart part) {
|
||||
// TODO Auto-generated method stub
|
||||
super.partOpened(part);
|
||||
if (this == part) {
|
||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.registerEventHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void createArrows() {
|
||||
int imgWidth = 11;
|
||||
int imgHeight = 11;
|
||||
|
@ -579,12 +604,13 @@ public class SessionView extends AbstractSessionView {
|
|||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
String name = participant.getFQName();
|
||||
String userId = getParticipantUserId(participant);
|
||||
for (CollaborationUser user : users) {
|
||||
if (name.equals(user.getId())) {
|
||||
if (userId.equals(user.getId())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CollaborationUser user = new CollaborationUser(name);
|
||||
CollaborationUser user = new CollaborationUser(userId, sessionId);
|
||||
user.setText(name);
|
||||
users.add(user);
|
||||
usersTable.refresh();
|
||||
|
@ -594,11 +620,12 @@ public class SessionView extends AbstractSessionView {
|
|||
private void participantDeparted(IVenueParticipant participant) {
|
||||
System.out.println("++++ handle departed here: "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
String userId = getParticipantUserId(participant);
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
String name = participant.getFQName();
|
||||
// String name = participant.getFQName();
|
||||
for (int i = 0; i < users.size(); ++i) {
|
||||
if (name.equals(users.get(i).getId())) {
|
||||
if (userId.equals(users.get(i).getId())) {
|
||||
users.remove(i);
|
||||
usersTable.refresh();
|
||||
break;
|
||||
|
@ -615,8 +642,9 @@ public class SessionView extends AbstractSessionView {
|
|||
+ presence.getMode() + "/" + presence.getType() + ": "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
String name = participant.getFQName();
|
||||
String userId = getParticipantUserId(participant);
|
||||
for (CollaborationUser user : users) {
|
||||
if (name.equals(user.getId())) {
|
||||
if (userId.equals(user.getId())) {
|
||||
user.setMode(presence.getMode());
|
||||
user.setType(presence.getType());
|
||||
usersTable.refresh();
|
||||
|
|
Loading…
Add table
Reference in a new issue