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