Omaha #3078 added private chat to collaboration
Change-Id: Ifcc4a33c1551e4209721fcc181b0becb49bdb5ae Former-commit-id:8fee2a762c
[formerly86e89665bf
] [formerly37699395ef
] [formerly8fee2a762c
[formerly86e89665bf
] [formerly37699395ef
] [formerly97a6f5bfe8
[formerly37699395ef
[formerly 93f7d7088e7d7888a878558c6f2fcc368bf3ab05]]]] Former-commit-id:97a6f5bfe8
Former-commit-id:8487f6388c
[formerly51e2606277
] [formerly c1fad1a9cd12f9a3fc09ba809d66fab6463a6e1a [formerly60508bf674
]] Former-commit-id: c537c3bbdc8909d2bb251174082b96954a7eb632 [formerly4433482d56
] Former-commit-id:cdcf7d8143
This commit is contained in:
parent
e5f32c825e
commit
9a00d07136
7 changed files with 118 additions and 90 deletions
|
@ -20,7 +20,7 @@
|
|||
package com.raytheon.uf.viz.collaboration.comm.identity;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
|
||||
/**
|
||||
* Peer to peer chat messaging interface
|
||||
|
@ -33,6 +33,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 21, 2012 jkorman Initial creation
|
||||
* Feb 13, 2014 2751 bclement changed 'to' object to UserId
|
||||
* Jun 17, 2014 3078 bclement changed 'to' object to IUser
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +59,7 @@ public interface IPeerToPeer extends ISession, IEventPublisher {
|
|||
* @param message
|
||||
* The message to send.
|
||||
*/
|
||||
public void sendPeerToPeer(UserId to, String message)
|
||||
public void sendPeerToPeer(IUser to, String message)
|
||||
throws CollaborationException;
|
||||
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|||
* moved url validation from regex to java utility
|
||||
* Feb 24, 2014 2756 bclement moved xmpp objects to new packages
|
||||
* Apr 14, 2014 2903 bclement moved from session subpackage to connection
|
||||
* Jun 17, 2014 3078 bclement routing for private chat messages
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -119,8 +120,10 @@ public class PeerToPeerCommHelper implements PacketListener {
|
|||
fromStr = account.getHost();
|
||||
}
|
||||
if (IDConverter.isFromRoom(fromStr)) {
|
||||
// venues will have their own listeners
|
||||
return;
|
||||
if (msg.getType().equals(Message.Type.groupchat)) {
|
||||
/* group chat is picked up by listeners on the venue */
|
||||
return;
|
||||
}
|
||||
}
|
||||
String body = msg.getBody();
|
||||
if (body != null) {
|
||||
|
@ -186,7 +189,13 @@ public class PeerToPeerCommHelper implements PacketListener {
|
|||
* @param message
|
||||
*/
|
||||
private void routeMessage(Message message) {
|
||||
IUser fromId = IDConverter.convertFrom(message.getFrom());
|
||||
String fromStr = message.getFrom();
|
||||
IUser fromId;
|
||||
if (IDConverter.isFromRoom(fromStr)) {
|
||||
fromId = IDConverter.convertFromRoom(null, fromStr);
|
||||
} else {
|
||||
fromId = IDConverter.convertFrom(message.getFrom());
|
||||
}
|
||||
TextMessage textMsg = new TextMessage(fromId, message.getBody());
|
||||
textMsg.setFrom(fromId);
|
||||
textMsg.setBody(message.getBody());
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -53,6 +52,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|||
* Dec 6, 2013 2561 bclement removed ECF
|
||||
* Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser
|
||||
* Apr 11, 2014 2903 bclement made constructor public b/c connection code moved packages
|
||||
* Jun 17, 2014 3078 bclement changed sendPeerToPeer() 'to' object to IUser
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -120,7 +120,7 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
|
|||
* @throws CollaborationException
|
||||
*/
|
||||
@Override
|
||||
public void sendPeerToPeer(UserId to, String message)
|
||||
public void sendPeerToPeer(IUser to, String message)
|
||||
throws CollaborationException {
|
||||
TextMessage msg = new TextMessage(to, message);
|
||||
this.sendPeerToPeer(msg);
|
||||
|
|
|
@ -44,7 +44,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEve
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
|
||||
import com.raytheon.uf.viz.collaboration.ui.jobs.AwayTimeOut;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
|
@ -75,6 +74,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
|||
* Apr 08, 2014 2785 mpduff removed preference listener
|
||||
* Apr 11, 2014 2903 bclement added disconnect handler
|
||||
* Apr 24, 2014 2955 bclement ignore duplicate session invites
|
||||
* Jun 17, 2014 3078 bclement reworked peerToPeerMessage() to use IUser
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -263,18 +263,10 @@ public class ConnectionSubscriber {
|
|||
@Override
|
||||
public void run() {
|
||||
IUser peer = message.getFrom();
|
||||
|
||||
UserId user = null;
|
||||
if (peer instanceof UserId) {
|
||||
user = (UserId) peer;
|
||||
} else {
|
||||
user = CollaborationConnection.getConnection()
|
||||
.getContactsManager().getUser(peer.getFQName());
|
||||
}
|
||||
PeerToPeerView view = new PeerToPeerChatAction(user)
|
||||
PeerToPeerView view = new PeerToPeerChatAction(peer)
|
||||
.createP2PChat(IWorkbenchPage.VIEW_CREATE);
|
||||
message.setFrom(view.getPeer());
|
||||
if (view != null) {
|
||||
message.setFrom(view.getPeer());
|
||||
view.appendMessage(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.actions;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
@ -28,8 +30,11 @@ import org.jivesoftware.smack.packet.Presence.Type;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
@ -45,6 +50,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 3, 2012 bsteffen Initial creation
|
||||
* Jun 17, 2014 3078 bclement changed user type to IUser, added isAvailable()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,9 +63,9 @@ public class PeerToPeerChatAction extends Action {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PeerToPeerChatAction.class);
|
||||
|
||||
private final UserId user;
|
||||
private final IUser user;
|
||||
|
||||
public PeerToPeerChatAction(UserId user) {
|
||||
public PeerToPeerChatAction(IUser user) {
|
||||
super("Chat", IconUtil.getImageDescriptor(Activator.getDefault()
|
||||
.getBundle(), "chats.gif"));
|
||||
this.user = user;
|
||||
|
@ -68,15 +74,44 @@ public class PeerToPeerChatAction extends Action {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
Presence presence = CollaborationConnection.getConnection()
|
||||
.getContactsManager().getPresence(user);
|
||||
if (presence.getType() != Type.unavailable) {
|
||||
UserId loginUserId = CollaborationConnection.getConnection()
|
||||
.getUser();
|
||||
if (!loginUserId.equals(user)) {
|
||||
createP2PChat(IWorkbenchPage.VIEW_ACTIVATE);
|
||||
if (isAvailable(user)) {
|
||||
createP2PChat(IWorkbenchPage.VIEW_ACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user
|
||||
* @return true if user is available for chat
|
||||
*/
|
||||
private boolean isAvailable(IUser user) {
|
||||
boolean rval = false;
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
if (user instanceof UserId) {
|
||||
Presence presence = connection.getContactsManager().getPresence(
|
||||
(UserId) user);
|
||||
if (presence.getType() != Type.unavailable) {
|
||||
UserId loginUserId = CollaborationConnection.getConnection()
|
||||
.getUser();
|
||||
rval = !loginUserId.isSameUser(user);
|
||||
}
|
||||
} else if (user instanceof VenueParticipant) {
|
||||
VenueParticipant participant = (VenueParticipant) user;
|
||||
Collection<IVenueSession> sessions = connection
|
||||
.getJoinedVenueSessions();
|
||||
for (IVenueSession sesh : sessions) {
|
||||
String venueName = sesh.getVenueName();
|
||||
if (venueName.equals(participant.getRoom())) {
|
||||
Presence presence = sesh.getVenue().getPresence(
|
||||
(VenueParticipant) user);
|
||||
if (presence.getType() != Type.unavailable) {
|
||||
rval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,17 +119,7 @@ public class PeerToPeerChatAction extends Action {
|
|||
* users are available.
|
||||
*/
|
||||
public void updateEnabled() {
|
||||
boolean enabled = false;
|
||||
Presence presence = CollaborationConnection.getConnection()
|
||||
.getContactsManager().getPresence(user);
|
||||
if (presence.getType() != Type.unavailable) {
|
||||
UserId loginUserId = CollaborationConnection.getConnection()
|
||||
.getUser();
|
||||
if (!loginUserId.getName().equals(user.getName())) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
setEnabled(enabled);
|
||||
setEnabled(isAvailable(user));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,9 +133,9 @@ public class PeerToPeerChatAction extends Action {
|
|||
*/
|
||||
public PeerToPeerView createP2PChat(Integer viewMode) {
|
||||
try {
|
||||
String name = user.getName();
|
||||
String id = user.getFQName();
|
||||
PeerToPeerView p2pView = (PeerToPeerView) CaveWorkbenchPageManager
|
||||
.getActiveInstance().showView(PeerToPeerView.ID, name,
|
||||
.getActiveInstance().showView(PeerToPeerView.ID, id,
|
||||
viewMode);
|
||||
if (p2pView.getPeer() == null) {
|
||||
p2pView.setPeer(user);
|
||||
|
|
|
@ -42,9 +42,11 @@ 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.IPeerToPeer;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterItem;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
|
||||
import com.raytheon.uf.viz.collaboration.ui.notifier.NotifierTask;
|
||||
import com.raytheon.uf.viz.collaboration.ui.notifier.NotifierTools;
|
||||
|
@ -63,13 +65,14 @@ import com.raytheon.uf.viz.core.sounds.SoundUtil;
|
|||
* Jan 30, 2014 2698 bclement added getDisplayName
|
||||
* Feb 13, 2014 2751 bclement made parent generic
|
||||
* Feb 28, 2014 2632 mpduff Override appendMessage for notifiers
|
||||
* Jun 17, 2014 3078 bclement changed peer type to IUser
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
||||
public class PeerToPeerView extends AbstractSessionView<IUser> implements
|
||||
IPrintableView {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PeerToPeerView.class);
|
||||
|
@ -84,7 +87,7 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
|
||||
private static Color black = null;
|
||||
|
||||
private UserId peer;
|
||||
private IUser peer;
|
||||
|
||||
private boolean online = true;
|
||||
|
||||
|
@ -191,7 +194,7 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
|
||||
@Override
|
||||
protected void styleAndAppendText(StringBuilder sb, int offset,
|
||||
String name, UserId userId, String subject, List<StyleRange> ranges) {
|
||||
String name, IUser userId, String subject, List<StyleRange> ranges) {
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
if (connection == null) {
|
||||
|
@ -210,7 +213,7 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
|
||||
@Override
|
||||
public void styleAndAppendText(StringBuilder sb, int offset, String name,
|
||||
UserId userId, List<StyleRange> ranges, Color color) {
|
||||
IUser userId, List<StyleRange> ranges, Color color) {
|
||||
StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
|
||||
color, null, SWT.NORMAL);
|
||||
ranges.add(range);
|
||||
|
@ -244,11 +247,8 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
protected String getSessionName() {
|
||||
if (peer == null) {
|
||||
return getViewSite().getSecondaryId();
|
||||
} else if (peer instanceof UserId) {
|
||||
return CollaborationConnection.getConnection().getContactsManager()
|
||||
.getDisplayName(peer);
|
||||
} else {
|
||||
return peer.getFQName();
|
||||
return getDisplayName(peer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,13 +264,13 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
return new SessionMsgArchive(me.getHost(), me.getName(), peer.getName());
|
||||
}
|
||||
|
||||
public void setPeer(UserId peer) {
|
||||
public void setPeer(IUser peer) {
|
||||
this.peer = peer;
|
||||
setPartName(getSessionName());
|
||||
initMessageArchive();
|
||||
}
|
||||
|
||||
public UserId getPeer() {
|
||||
public IUser getPeer() {
|
||||
return peer;
|
||||
}
|
||||
|
||||
|
@ -340,8 +340,15 @@ public class PeerToPeerView extends AbstractSessionView<UserId> implements
|
|||
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
|
||||
*/
|
||||
@Override
|
||||
protected String getDisplayName(UserId userId) {
|
||||
CollaborationConnection conn = CollaborationConnection.getConnection();
|
||||
return conn.getContactsManager().getDisplayName(userId);
|
||||
protected String getDisplayName(IUser user) {
|
||||
if (user instanceof UserId) {
|
||||
return CollaborationConnection.getConnection().getContactsManager()
|
||||
.getDisplayName((UserId) user);
|
||||
} else if (user instanceof VenueParticipant) {
|
||||
VenueParticipant participant = (VenueParticipant) user;
|
||||
return participant.getHandle() + " in " + participant.getRoom();
|
||||
} else {
|
||||
return peer.getFQName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IContributionItem;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
@ -35,6 +34,10 @@ import org.eclipse.jface.action.MenuManager;
|
|||
import org.eclipse.jface.action.ToolBarManager;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
|
@ -58,7 +61,6 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.ui.IViewSite;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
|
@ -68,11 +70,11 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
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.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.UserNicknameChangedEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueUserEvent;
|
||||
|
@ -81,11 +83,11 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.actions.PeerToPeerChatAction;
|
||||
import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionItem;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.sounds.SoundUtil;
|
||||
import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
||||
|
||||
/**
|
||||
* The ViewPart of a text only room, contains methods that are used by the
|
||||
|
@ -111,6 +113,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
|||
* Mar 11, 2014 #2865 lvenable Added null checks in threads
|
||||
* Mar 28, 2014 #2960 lvenable Added check to make sure the SashForm is not getting
|
||||
* negative weights - set to zero if negative.
|
||||
* Jun 17, 2014 3078 bclement added private chat to menu and double click
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -142,8 +145,6 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
|
||||
private Image highlightedDownArrow;
|
||||
|
||||
protected Action chatAction;
|
||||
|
||||
protected SessionColorManager colorManager;
|
||||
|
||||
protected Map<RGB, Color> mappedColors;
|
||||
|
@ -189,24 +190,6 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
}
|
||||
|
||||
protected void createActions() {
|
||||
chatAction = new Action("Chat") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ISession session = CollaborationConnection.getConnection()
|
||||
.getPeerToPeerSession();
|
||||
CaveWorkbenchPageManager.getActiveInstance().showView(
|
||||
PeerToPeerView.ID, session.getSessionId(),
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open chat", e);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,6 +217,12 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
}
|
||||
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
VenueParticipant entry = (VenueParticipant) selection.getFirstElement();
|
||||
if (!entry.isSameUser(session.getUserID())) {
|
||||
manager.add(new PeerToPeerChatAction(entry));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -370,19 +359,24 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
|||
});
|
||||
|
||||
ColumnViewerToolTipSupport.enableFor(usersTable, ToolTip.RECREATE);
|
||||
// TODO this needs to be a private chat through the muc
|
||||
// usersTable.addDoubleClickListener(new IDoubleClickListener() {
|
||||
// @Override
|
||||
// public void doubleClick(DoubleClickEvent event) {
|
||||
// StructuredSelection selection = (StructuredSelection) usersTable
|
||||
// .getSelection();
|
||||
//
|
||||
// Object o = selection.getFirstElement();
|
||||
// if (o instanceof UserId) {
|
||||
// new PeerToPeerChatAction((UserId) o).run();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
usersTable.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
StructuredSelection selection = (StructuredSelection) usersTable
|
||||
.getSelection();
|
||||
|
||||
Object o = selection.getFirstElement();
|
||||
if (o instanceof IUser) {
|
||||
IUser user = (IUser) o;
|
||||
CollaborationConnection connection = CollaborationConnection
|
||||
.getConnection();
|
||||
UserId accountUser = connection.getUser();
|
||||
if (!accountUser.isSameUser(user)) {
|
||||
new PeerToPeerChatAction(user).run();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (session != null) {
|
||||
refreshParticipantList();
|
||||
|
|
Loading…
Add table
Reference in a new issue