Issue #663 Commented out drawing tool loading from group view and removed transfer role code
Change-Id: Ie910b19d477a1281231486bc8f96083ea7598a0b Former-commit-id: 209d658e61d7b595d4effbfb87f65b87a5f196a9
This commit is contained in:
parent
f6f2e1a4fb
commit
854f41eb7f
2 changed files with 35 additions and 159 deletions
cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui
|
@ -20,9 +20,6 @@ package com.raytheon.uf.viz.collaboration.ui;
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider;
|
|
||||||
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -181,9 +178,10 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
||||||
|
|
||||||
private Action changePasswordAction;
|
private Action changePasswordAction;
|
||||||
|
|
||||||
private Action drawToolbarAction;
|
// Drawing *will* be activated in collaboration views
|
||||||
|
// private Action drawToolbarAction;
|
||||||
private Action pgenAction;
|
//
|
||||||
|
// private Action pgenAction;
|
||||||
|
|
||||||
private Action collapseAllAction;
|
private Action collapseAllAction;
|
||||||
|
|
||||||
|
@ -473,30 +471,32 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
||||||
};
|
};
|
||||||
changeStatusAction.setMenuCreator(creator);
|
changeStatusAction.setMenuCreator(creator);
|
||||||
|
|
||||||
drawToolbarAction = new Action("Drawing Toolbar") {
|
// TODO: Delete once drawing is activated in collaboration shared
|
||||||
@Override
|
// dispaly views
|
||||||
public void run() {
|
// drawToolbarAction = new Action("Drawing Toolbar") {
|
||||||
// TODO: What is this?
|
// @Override
|
||||||
System.err.println("What is this method!?");
|
// public void run() {
|
||||||
}
|
// // TODO: What should this do now?
|
||||||
};
|
// System.err.println("What should this method do now!?");
|
||||||
drawToolbarAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
// }
|
||||||
com.raytheon.uf.viz.drawing.Activator.getDefault().getBundle(),
|
// };
|
||||||
"draw.gif"));
|
// drawToolbarAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
||||||
|
// com.raytheon.uf.viz.drawing.Activator.getDefault().getBundle(),
|
||||||
pgenAction = new Action("PGEN") {
|
// "draw.gif"));
|
||||||
@Override
|
//
|
||||||
public void run() {
|
// pgenAction = new Action("PGEN") {
|
||||||
StaticDataProvider.getInstance();
|
// @Override
|
||||||
try {
|
// public void run() {
|
||||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
// StaticDataProvider.getInstance();
|
||||||
.getActivePage().showView(PgenUtil.VIEW_ID);
|
// try {
|
||||||
} catch (PartInitException e) {
|
// PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
// .getActivePage().showView(PgenUtil.VIEW_ID);
|
||||||
"Unable to open PGEN palette", e);
|
// } catch (PartInitException e) {
|
||||||
}
|
// statusHandler.handle(Priority.PROBLEM,
|
||||||
}
|
// "Unable to open PGEN palette", e);
|
||||||
};
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -536,10 +536,10 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
||||||
mgr.add(changePasswordAction);
|
mgr.add(changePasswordAction);
|
||||||
mgr.add(new Separator());
|
mgr.add(new Separator());
|
||||||
|
|
||||||
mgr.add(drawToolbarAction);
|
// mgr.add(drawToolbarAction);
|
||||||
mgr.add(pgenAction);
|
// mgr.add(pgenAction);
|
||||||
|
// mgr.add(new Separator());
|
||||||
|
|
||||||
mgr.add(new Separator());
|
|
||||||
if (CollaborationDataManager.getInstance().isConnected()) {
|
if (CollaborationDataManager.getInstance().isConnected()) {
|
||||||
mgr.add(logoutAction);
|
mgr.add(logoutAction);
|
||||||
} else {
|
} else {
|
||||||
|
@ -578,7 +578,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
||||||
addUserAction.setEnabled(false);
|
addUserAction.setEnabled(false);
|
||||||
selectGroups.setEnabled(false);
|
selectGroups.setEnabled(false);
|
||||||
changeStatusAction.setEnabled(false);
|
changeStatusAction.setEnabled(false);
|
||||||
drawToolbarAction.setEnabled(false);
|
// drawToolbarAction.setEnabled(false);
|
||||||
changeStatusMessageAction.setEnabled(false);
|
changeStatusMessageAction.setEnabled(false);
|
||||||
changePasswordAction.setEnabled(false);
|
changePasswordAction.setEnabled(false);
|
||||||
return;
|
return;
|
||||||
|
@ -589,7 +589,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
||||||
addUserAction.setEnabled(true);
|
addUserAction.setEnabled(true);
|
||||||
selectGroups.setEnabled(true);
|
selectGroups.setEnabled(true);
|
||||||
changeStatusAction.setEnabled(true);
|
changeStatusAction.setEnabled(true);
|
||||||
drawToolbarAction.setEnabled(true);
|
// drawToolbarAction.setEnabled(true);
|
||||||
changeStatusMessageAction.setEnabled(true);
|
changeStatusMessageAction.setEnabled(true);
|
||||||
changePasswordAction.setEnabled(true);
|
changePasswordAction.setEnabled(true);
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import org.eclipse.ecf.presence.roster.IRosterEntry;
|
import org.eclipse.ecf.presence.roster.IRosterEntry;
|
||||||
import org.eclipse.ecf.presence.roster.RosterEntry;
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.ActionContributionItem;
|
|
||||||
import org.eclipse.jface.action.IMenuCreator;
|
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -32,10 +29,8 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.widgets.ColorDialog;
|
import org.eclipse.swt.widgets.ColorDialog;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
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 com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
@ -45,7 +40,6 @@ 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.ISharedDisplaySession;
|
||||||
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.info.IVenueInfo;
|
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.identity.user.SharedDisplayRole;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
|
||||||
|
@ -79,8 +73,6 @@ public class CollaborationSessionView extends SessionView {
|
||||||
|
|
||||||
private static final String COLLABORATION_SESSION_IMAGE_NAME = "messages.gif";
|
private static final String COLLABORATION_SESSION_IMAGE_NAME = "messages.gif";
|
||||||
|
|
||||||
private Action switchToAction;
|
|
||||||
|
|
||||||
private Action colorChangeAction;
|
private Action colorChangeAction;
|
||||||
|
|
||||||
private ISharedDisplaySession session;
|
private ISharedDisplaySession session;
|
||||||
|
@ -101,78 +93,6 @@ public class CollaborationSessionView extends SessionView {
|
||||||
|
|
||||||
protected void createActions() {
|
protected void createActions() {
|
||||||
super.createActions();
|
super.createActions();
|
||||||
switchToAction = new Action("Transfer Role...",
|
|
||||||
Action.AS_DROP_DOWN_MENU) {
|
|
||||||
public void run() {
|
|
||||||
// do nothing
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
IMenuCreator creator = new IMenuCreator() {
|
|
||||||
Menu menu;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Menu getMenu(Menu parent) {
|
|
||||||
if (menu == null || menu.isDisposed()) {
|
|
||||||
menu = new Menu(parent);
|
|
||||||
}
|
|
||||||
if (session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
|
||||||
Action leaderAction = new Action("Session Leader") {
|
|
||||||
public void run() {
|
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
|
||||||
.getSelection();
|
|
||||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
|
||||||
.getFirstElement();
|
|
||||||
usersTable.remove(selectedUser);
|
|
||||||
UserId id = IDConverter.convertFrom(selectedUser
|
|
||||||
.getUser());
|
|
||||||
selectedUser = new RosterEntry(
|
|
||||||
selectedUser.getParent(), id,
|
|
||||||
selectedUser.getPresence());
|
|
||||||
switchLeader(id);
|
|
||||||
usersTable.refresh(selectedUser);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
|
||||||
leaderAction);
|
|
||||||
leaderItem.fill(menu, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (session.hasRole(SharedDisplayRole.DATA_PROVIDER)) {
|
|
||||||
Action dataProviderAction = new Action("Data Provider") {
|
|
||||||
public void run() {
|
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
|
||||||
.getSelection();
|
|
||||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
|
||||||
.getFirstElement();
|
|
||||||
usersTable.remove(selectedUser);
|
|
||||||
UserId id = IDConverter.convertFrom(selectedUser
|
|
||||||
.getUser());
|
|
||||||
selectedUser = new RosterEntry(
|
|
||||||
selectedUser.getParent(), id,
|
|
||||||
selectedUser.getPresence());
|
|
||||||
switchDataProvider(id);
|
|
||||||
usersTable.refresh(selectedUser);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
|
||||||
dataProviderAction);
|
|
||||||
dataProviderItem.fill(menu, -1);
|
|
||||||
}
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
menu.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Menu getMenu(Control parent) {
|
|
||||||
return getMenu(parent.getMenu());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
switchToAction.setMenuCreator(creator);
|
|
||||||
|
|
||||||
colorChangeAction = new Action("Change Color...") {
|
colorChangeAction = new Action("Change Color...") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,41 +128,6 @@ public class CollaborationSessionView extends SessionView {
|
||||||
.getColorManager();
|
.getColorManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchDataProvider(UserId userId) {
|
|
||||||
System.out.println("Send switchDataProvider request. "
|
|
||||||
+ 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) {
|
|
||||||
System.out.println("Send switchLeader request. " + 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
|
|
||||||
TransferRoleCommand trc = new TransferRoleCommand();
|
|
||||||
trc.setUser(userId);
|
|
||||||
trc.setRole(SharedDisplayRole.SESSION_LEADER);
|
|
||||||
try {
|
|
||||||
session.sendObjectToVenue(trc);
|
|
||||||
} catch (CollaborationException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Unable to send message to transfer role", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void refreshAfterTransfer(TransferRoleCommand command) {
|
public void refreshAfterTransfer(TransferRoleCommand command) {
|
||||||
VizApp.runAsync(new Runnable() {
|
VizApp.runAsync(new Runnable() {
|
||||||
|
@ -292,15 +177,6 @@ public class CollaborationSessionView extends SessionView {
|
||||||
super.fillContextMenu(manager);
|
super.fillContextMenu(manager);
|
||||||
if (session.hasRole(SharedDisplayRole.DATA_PROVIDER)
|
if (session.hasRole(SharedDisplayRole.DATA_PROVIDER)
|
||||||
|| session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
|| session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
||||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
|
||||||
.getSelection();
|
|
||||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
|
||||||
.getFirstElement();
|
|
||||||
if (!IDConverter.convertFrom(selectedUser.getUser()).equals(
|
|
||||||
session.getUserID())) {
|
|
||||||
manager.add(switchToAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
if (session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
||||||
manager.add(new Separator());
|
manager.add(new Separator());
|
||||||
manager.add(colorChangeAction);
|
manager.add(colorChangeAction);
|
||||||
|
|
Loading…
Add table
Reference in a new issue