Issue #444 minor cleanup
Former-commit-id:966dbbf836
[formerly1c7f6861e4
] [formerlyba73d47044
[formerly b601ea017e09c9fcd74e974d3f5ce2f0104a75fc]] Former-commit-id:ba73d47044
Former-commit-id:d88b7e7c33
This commit is contained in:
parent
e9f053c037
commit
70653e8093
2 changed files with 43 additions and 10 deletions
|
@ -32,6 +32,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.ecf.core.user.IUser;
|
||||
import org.eclipse.ecf.core.user.User;
|
||||
import org.eclipse.ecf.presence.IPresence.Mode;
|
||||
import org.eclipse.ecf.presence.roster.IRoster;
|
||||
import org.eclipse.ecf.presence.roster.IRosterEntry;
|
||||
|
@ -98,7 +99,8 @@ public class CollaborationUtils {
|
|||
public static Collection<Object> readAliases() {
|
||||
UserId[] ids = getIds();
|
||||
Roster roster = (Roster) CollaborationDataManager.getInstance()
|
||||
.getCollaborationConnection(true).getRosterManager().getRoster();
|
||||
.getCollaborationConnection(true).getRosterManager()
|
||||
.getRoster();
|
||||
Collection<?> rosterObjects = new ArrayList<Object>();
|
||||
rosterObjects.addAll(roster.getItems());
|
||||
for (Object ob : rosterObjects) {
|
||||
|
@ -177,17 +179,33 @@ public class CollaborationUtils {
|
|||
if (ob instanceof IRosterEntry) {
|
||||
IRosterEntry entry = (IRosterEntry) ob;
|
||||
IUser id = entry.getUser();
|
||||
if (id.getNickname() != null
|
||||
&& !id.getNickname().isEmpty()) {
|
||||
ids.add(IDConverter.convertFrom(id));
|
||||
if (id instanceof User) {
|
||||
if (id.getNickname() != null
|
||||
&& !id.getNickname().isEmpty()) {
|
||||
ids.add(IDConverter.convertFrom(id));
|
||||
}
|
||||
} else if (id instanceof UserId) {
|
||||
UserId uid = (UserId) id;
|
||||
if (uid.getAlias() != null
|
||||
&& !uid.getAlias().isEmpty()) {
|
||||
ids.add(uid);
|
||||
}
|
||||
}
|
||||
} else if (ob instanceof IRosterGroup) {
|
||||
for (Object entryOb : ((IRosterGroup) ob).getEntries()) {
|
||||
IRosterEntry entry = (IRosterEntry) entryOb;
|
||||
IUser user = entry.getUser();
|
||||
if (user.getNickname() != null
|
||||
&& !user.getNickname().isEmpty()) {
|
||||
ids.add(IDConverter.convertFrom(user));
|
||||
IUser id = entry.getUser();
|
||||
if (id instanceof User) {
|
||||
if (id.getNickname() != null
|
||||
&& !id.getNickname().isEmpty()) {
|
||||
ids.add(IDConverter.convertFrom(id));
|
||||
}
|
||||
} else if (id instanceof UserId) {
|
||||
UserId uid = (UserId) id;
|
||||
if (uid.getAlias() != null
|
||||
&& !uid.getAlias().isEmpty()) {
|
||||
ids.add(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
|||
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.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||
|
@ -214,6 +215,19 @@ public class CollaborationSessionView extends SessionView {
|
|||
+ userId.getFQName());
|
||||
// TODO need to send invite/request for transfer, and then if successful
|
||||
// deactivate the local ones since we won't receive the message
|
||||
SharedDisplayVenueInvite invite = new SharedDisplayVenueInvite();
|
||||
invite.setMessage(session.getUserID().getName()
|
||||
+ " has requested you become the data provider...");
|
||||
invite.setSessionId(session.getSessionId());
|
||||
invite.setSubject(session.getVenue().getInfo().getVenueSubject());
|
||||
invite.setDataProvider(session.getCurrentDataProvider());
|
||||
invite.setSessionLeader(session.getCurrentSessionLeader());
|
||||
try {
|
||||
session.sendInvitation(userId, invite);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to switch data providers", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void switchLeader(UserId userId) {
|
||||
|
@ -222,7 +236,6 @@ public class CollaborationSessionView extends SessionView {
|
|||
// deactivate the local ones since we won't receive the message
|
||||
TransferRoleCommand trc = new TransferRoleCommand();
|
||||
trc.setUser(userId);
|
||||
session.setCurrentSessionLeader(userId);
|
||||
trc.setRole(SharedDisplayRole.SESSION_LEADER);
|
||||
try {
|
||||
session.sendObjectToVenue(trc);
|
||||
|
@ -303,9 +316,11 @@ public class CollaborationSessionView extends SessionView {
|
|||
.getSelection();
|
||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||
.getFirstElement();
|
||||
if (!selectedUser.getUser().equals(session.getUserID())) {
|
||||
if (!IDConverter.convertFrom(selectedUser.getUser()).equals(
|
||||
session.getUserID())) {
|
||||
manager.add(switchToAction);
|
||||
}
|
||||
|
||||
if (session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
||||
manager.add(new Separator());
|
||||
manager.add(colorChangeAction);
|
||||
|
|
Loading…
Add table
Reference in a new issue