From 6e5e2b500e11f52d88c2d4d8f6c0d67787202b2c Mon Sep 17 00:00:00 2001 From: Max Schenkelberg Date: Fri, 25 May 2012 15:24:18 -0500 Subject: [PATCH] Issue #663 Commented out drawing tool loading from group view and removed transfer role code Change-Id: Ie910b19d477a1281231486bc8f96083ea7598a0b Former-commit-id: f7183f82122387bc8051a1f794a44d2fb41ba09f [formerly 7bae56e8b5746b98f76f8ce5a3b5066dda13cdf6] [formerly f7183f82122387bc8051a1f794a44d2fb41ba09f [formerly 7bae56e8b5746b98f76f8ce5a3b5066dda13cdf6] [formerly 854f41eb7f15d2a86d4ef36ce9c8661060a2419d [formerly 209d658e61d7b595d4effbfb87f65b87a5f196a9]]] Former-commit-id: 854f41eb7f15d2a86d4ef36ce9c8661060a2419d Former-commit-id: e4350ca0ae6e6dc9418ce7bd083dd2ac877a245f [formerly d380895c56e0cf2865dba30795a21da32800f540] Former-commit-id: 079a247ee56655da3701e64cc6234cd80ffe4805 --- .../ui/CollaborationGroupView.java | 70 +++++----- .../ui/session/CollaborationSessionView.java | 124 ------------------ 2 files changed, 35 insertions(+), 159 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java index 10dcb7c28d..f908088a46 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java @@ -20,9 +20,6 @@ package com.raytheon.uf.viz.collaboration.ui; * further licensing information. **/ -import gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider; -import gov.noaa.nws.ncep.ui.pgen.PgenUtil; - import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -181,9 +178,10 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { private Action changePasswordAction; - private Action drawToolbarAction; - - private Action pgenAction; + // Drawing *will* be activated in collaboration views + // private Action drawToolbarAction; + // + // private Action pgenAction; private Action collapseAllAction; @@ -473,30 +471,32 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { }; changeStatusAction.setMenuCreator(creator); - drawToolbarAction = new Action("Drawing Toolbar") { - @Override - public void run() { - // TODO: What is this? - System.err.println("What is this method!?"); - } - }; - drawToolbarAction.setImageDescriptor(IconUtil.getImageDescriptor( - com.raytheon.uf.viz.drawing.Activator.getDefault().getBundle(), - "draw.gif")); - - pgenAction = new Action("PGEN") { - @Override - public void run() { - StaticDataProvider.getInstance(); - try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getActivePage().showView(PgenUtil.VIEW_ID); - } catch (PartInitException e) { - statusHandler.handle(Priority.PROBLEM, - "Unable to open PGEN palette", e); - } - } - }; + // TODO: Delete once drawing is activated in collaboration shared + // dispaly views + // drawToolbarAction = new Action("Drawing Toolbar") { + // @Override + // 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")); + // + // pgenAction = new Action("PGEN") { + // @Override + // public void run() { + // StaticDataProvider.getInstance(); + // try { + // PlatformUI.getWorkbench().getActiveWorkbenchWindow() + // .getActivePage().showView(PgenUtil.VIEW_ID); + // } 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(new Separator()); - mgr.add(drawToolbarAction); - mgr.add(pgenAction); + // mgr.add(drawToolbarAction); + // mgr.add(pgenAction); + // mgr.add(new Separator()); - mgr.add(new Separator()); if (CollaborationDataManager.getInstance().isConnected()) { mgr.add(logoutAction); } else { @@ -578,7 +578,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { addUserAction.setEnabled(false); selectGroups.setEnabled(false); changeStatusAction.setEnabled(false); - drawToolbarAction.setEnabled(false); + // drawToolbarAction.setEnabled(false); changeStatusMessageAction.setEnabled(false); changePasswordAction.setEnabled(false); return; @@ -589,7 +589,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { addUserAction.setEnabled(true); selectGroups.setEnabled(true); changeStatusAction.setEnabled(true); - drawToolbarAction.setEnabled(true); + // drawToolbarAction.setEnabled(true); changeStatusMessageAction.setEnabled(true); changePasswordAction.setEnabled(true); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java index c01cf72adf..34e35b541f 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java @@ -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.RosterEntry; 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.Separator; 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.widgets.ColorDialog; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; import com.google.common.eventbus.Subscribe; 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.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; @@ -79,8 +73,6 @@ public class CollaborationSessionView extends SessionView { private static final String COLLABORATION_SESSION_IMAGE_NAME = "messages.gif"; - private Action switchToAction; - private Action colorChangeAction; private ISharedDisplaySession session; @@ -101,78 +93,6 @@ public class CollaborationSessionView extends SessionView { protected void 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...") { @Override @@ -208,41 +128,6 @@ public class CollaborationSessionView extends SessionView { .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 public void refreshAfterTransfer(TransferRoleCommand command) { VizApp.runAsync(new Runnable() { @@ -292,15 +177,6 @@ public class CollaborationSessionView extends SessionView { super.fillContextMenu(manager); if (session.hasRole(SharedDisplayRole.DATA_PROVIDER) || 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)) { manager.add(new Separator()); manager.add(colorChangeAction);