Issue #693 add nws_collaborate view, and ability for default on startup or not

Former-commit-id: 73da2b1fe8 [formerly b50cfeb8633e2b9a0d2fc7bb848bbcf7d0404321]
Former-commit-id: 022e982aae
This commit is contained in:
Matt Nash 2012-06-11 10:24:35 -05:00
parent 4453a06f31
commit d5e3c97d98
11 changed files with 513 additions and 347 deletions

View file

@ -294,8 +294,16 @@ public class VenueSession extends BaseSession implements IVenueSession {
venueManager = getConnectionPresenceAdapter().getChatRoomManager(); venueManager = getConnectionPresenceAdapter().getChatRoomManager();
if (venueManager != null) { if (venueManager != null) {
venueInfo = venueManager.getChatRoomInfo(venueName); venueInfo = venueManager.getChatRoomInfo(venueName);
subject = venueInfo.getDescription(); if (venueInfo == null) {
for (IChatRoomInfo info : venueManager.getChatRoomInfos()) {
System.out.println(info.getName());
if (info.getName().equals(venueName)) {
venueInfo = info;
}
}
}
if (venueInfo != null) { if (venueInfo != null) {
subject = venueInfo.getDescription();
completeVenueConnection(venueInfo); completeVenueConnection(venueInfo);
} }
} }

View file

@ -82,6 +82,14 @@
icon="icons/chats.gif" icon="icons/chats.gif"
name="Private Session" name="Private Session"
restorable="false"/> restorable="false"/>
<view
allowMultiple="true"
category="com.raytheon.viz.ui"
class="com.raytheon.uf.viz.collaboration.ui.session.SessionFeedView"
id="com.raytheon.uf.viz.collaboration.SessionFeedView"
icon="icons/chats.gif"
name="Text Session"
restorable="false"/>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.views"> point="org.eclipse.ui.views">
@ -100,10 +108,6 @@
id="com.raytheon.uf.viz.collaboration.chatView" id="com.raytheon.uf.viz.collaboration.chatView"
name="Collaboration Browser" description="Command category for the Chat Room View"> name="Collaboration Browser" description="Command category for the Chat Room View">
</category> </category>
<command
id="com.raytheon.uf.viz.collaboration.ChatRoom"
name="Collaboration Browser">
</command>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.commands"> point="org.eclipse.ui.commands">
@ -116,13 +120,6 @@
name="Collaboration Browser"> name="Collaboration Browser">
</command> </command>
</extension> </extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="com.raytheon.uf.viz.collaboration.ui.session.SessionAction"
commandId="com.raytheon.uf.viz.collaboration.ChatRoom">
</handler>
</extension>
<extension <extension
point="org.eclipse.ui.handlers"> point="org.eclipse.ui.handlers">
<handler <handler
@ -192,11 +189,6 @@
id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationalertwordspreferencepage" id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationalertwordspreferencepage"
name="Significant Words" name="Significant Words"
category="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationpreferencepage"/> category="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationpreferencepage"/>
<page
class="com.raytheon.uf.viz.collaboration.ui.feed.CollaborationSiteFilterPreferencePage"
id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationsitefilterpreferencepage"
name="Site Filter"
category="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationpreferencepage"/>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.contexts"> point="org.eclipse.ui.contexts">

View file

@ -23,15 +23,20 @@ package com.raytheon.uf.viz.collaboration.ui;
import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
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.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.ui.session.SessionFeedView;
/** /**
* TODO Add Description * Action to open the group view, as well as the default chat room
* *
* <pre> * <pre>
* *
@ -52,9 +57,32 @@ public class CollaborationGroupAction extends AbstractHandler {
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
// this opens the collaboration group view
try { try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow() PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(CollaborationGroupView.ID); .getActivePage().showView(CollaborationGroupView.ID);
// if autojoin is selected (to join the default room)
if (Activator.getDefault().getPreferenceStore()
.getBoolean("autojoin")) {
CollaborationConnection connection = CollaborationConnection
.getConnection();
try {
// TODO, make this configurable?
IVenueSession session = connection
.joinTextOnlyVenue("nws-collaboration");
PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.showView(SessionFeedView.ID,
session.getSessionId(),
IWorkbenchPage.VIEW_ACTIVATE);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to join the collaboration feed", e);
}
}
} catch (PartInitException e) { } catch (PartInitException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to open collaboration contact list", e); "Unable to open collaboration contact list", e);

View file

@ -1,66 +0,0 @@
package com.raytheon.uf.viz.collaboration.ui.actions;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
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.ui.session.SessionView;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class ChatRoomAction extends AbstractHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ChatRoomAction.class);
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(SessionView.ID);
} catch (PartInitException e) {
statusHandler.handle(Priority.PROBLEM, "Unable to open chat room",
e);
}
return event;
}
}

View file

@ -1,220 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.feed;
import java.util.List;
import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollaborationPreferenceContentProvider;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollaborationPreferencesLabelProvider;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 4, 2012 mnash Initial creation
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public class CollaborationSiteFilterPreferencePage extends
FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private TableViewer viewer;
/**
*
*/
public CollaborationSiteFilterPreferencePage() {
}
/**
* @param style
*/
public CollaborationSiteFilterPreferencePage(int style) {
super(style);
}
/**
* @param title
* @param style
*/
public CollaborationSiteFilterPreferencePage(String title, int style) {
super(title, style);
// TODO Auto-generated constructor stub
}
/**
* @param title
* @param image
* @param style
*/
public CollaborationSiteFilterPreferencePage(String title,
ImageDescriptor image, int style) {
super(title, image, style);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
* ()
*/
@Override
protected void createFieldEditors() {
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.horizontalSpan = 3;
viewer = new TableViewer(getFieldEditorParent());
viewer.setContentProvider(new CollaborationPreferenceContentProvider());
viewer.setLabelProvider(new CollaborationPreferencesLabelProvider());
viewer.getTable().setLayoutData(data);
final StringFieldEditor stringEditor = new StringFieldEditor(
"sitename", "Site Name", getFieldEditorParent()) {
@Override
protected void doLoad() {
super.doLoad();
this.setStringValue("");
}
};
this.addField(stringEditor);
final ColorFieldEditor colorEditor = new ColorFieldEditor(
"coloreditor", "Color", getFieldEditorParent());
this.addField(colorEditor);
colorEditor.loadDefault();
Composite buttonComp = new Composite(getFieldEditorParent(), SWT.NONE);
buttonComp.setLayout(new GridLayout(3, false));
data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.horizontalSpan = 3;
buttonComp.setLayoutData(data);
Button saveButton = new Button(buttonComp, SWT.PUSH);
saveButton.setText("Save Current");
saveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!stringEditor.getStringValue().isEmpty()) {
AlertWord word = new AlertWord(stringEditor
.getStringValue(), colorEditor.getColorSelector()
.getColorValue());
int index = viewer.getTable().getSelectionIndex();
if (index != -1) {
((List<AlertWord>) viewer.getInput()).set(index, word);
} else {
((List<AlertWord>) viewer.getInput()).add(word);
}
viewer.refresh();
}
}
});
data = new GridData(SWT.NONE, SWT.NONE, false, true);
saveButton.setLayoutData(data);
Button addButton = new Button(buttonComp, SWT.PUSH);
addButton.setText("Add New");
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!stringEditor.getStringValue().isEmpty()) {
AlertWord word = new AlertWord(stringEditor
.getStringValue(), colorEditor.getColorSelector()
.getColorValue());
((List<AlertWord>) viewer.getInput()).add(word);
viewer.refresh();
}
}
});
data = new GridData(SWT.NONE, SWT.NONE, false, true);
addButton.setLayoutData(data);
Button removeButton = new Button(buttonComp, SWT.PUSH);
removeButton.setText("Remove Current");
removeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) viewer
.getSelection();
if (selection != null) {
AlertWord word = (AlertWord) selection.getFirstElement();
((List<AlertWord>) viewer.getInput()).remove(word);
viewer.refresh();
}
}
});
data = new GridData(SWT.NONE, SWT.NONE, false, true);
removeButton.setLayoutData(data);
viewer.getTable().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AlertWord word = (AlertWord) e.item.getData();
colorEditor.getColorSelector()
.setColorValue(
new RGB(word.getRed(), word.getGreen(), word
.getBlue()));
stringEditor.setStringValue(word.getText());
}
});
viewer.setInput(CollaborationUtils.getAlertWords());
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
// TODO Auto-generated method stub
}
}

View file

@ -25,6 +25,7 @@ import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.IWorkbenchPreferencePage;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.ui.Activator; import com.raytheon.uf.viz.collaboration.ui.Activator;
/** /**
@ -75,5 +76,24 @@ public class CollaborationPreferencePage extends FieldEditorPreferencePage
FieldEditor notifications = new BooleanFieldEditor("notifications", FieldEditor notifications = new BooleanFieldEditor("notifications",
"Show Notifications", getFieldEditorParent()); "Show Notifications", getFieldEditorParent());
this.addField(notifications); this.addField(notifications);
FieldEditor autojoinColl = new BooleanFieldEditor("autojoin",
"Join Discussion On Login", getFieldEditorParent());
this.addField(autojoinColl);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
*/
@Override
public boolean performOk() {
CollaborationConnection connection = CollaborationConnection
.getConnection();
if (connection != null && connection.isConnected()) {
CollaborationConnection.getConnection().getEventPublisher()
.post(Activator.getDefault().getPreferenceStore());
}
return super.performOk();
} }
} }

View file

@ -0,0 +1,69 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.prefs;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2012 mnash Initial creation
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public class CollaborationSubscribeListPreferences extends
FieldEditorPreferencePage {
/**
*
*/
public CollaborationSubscribeListPreferences() {
}
/**
* @param style
*/
public CollaborationSubscribeListPreferences(int style) {
super(GRID);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
* ()
*/
@Override
protected void createFieldEditors() {
// // TODO Auto-generated method stub
// CollaborationConnection.getConnection().getRosterManager().get
}
}

View file

@ -71,6 +71,8 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
protected Map<String, Image> imageMap; protected Map<String, Image> imageMap;
private List<String> enabledUsers;
protected Map<UserId, Color> colors; protected Map<UserId, Color> colors;
private SessionColorManager manager; private SessionColorManager manager;
@ -213,6 +215,7 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
break; break;
} }
} }
return name; return name;
} }
@ -335,6 +338,10 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
return new Point(5, 5); return new Point(5, 5);
} }
protected void setEnabledUsers(List<String> enabledUsers) {
this.enabledUsers = enabledUsers;
}
protected String buildParticipantTooltip(IRosterEntry user) { protected String buildParticipantTooltip(IRosterEntry user) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
UserId partUser = IDConverter.convertFrom(user.getUser()); UserId partUser = IDConverter.convertFrom(user.getUser());
@ -342,13 +349,18 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
builder.append("Name : ").append(user.getUser().getName()) builder.append("Name : ").append(user.getUser().getName())
.append("\n"); .append("\n");
} }
builder.append("Status : ") builder.append("Status : ").append(
.append(CollaborationUtils.formatMode(user.getPresence() CollaborationUtils.formatMode(user.getPresence().getMode()));
.getMode())).append("\n"); if (!user.getPresence().getStatus().isEmpty()) {
builder.append("Message : \"").append(user.getPresence().getStatus()) builder.append("\n").append("Message : \"")
.append("\""); .append(user.getPresence().getStatus()).append("\"");
ISession session = CollaborationConnection.getConnection().getSession( }
sessionId); if (user.getPresence().getProperties().containsKey("UserStatus")) {
builder.append("\n").append(
user.getPresence().getProperties().get("UserStatus"));
}
IVenueSession session = (IVenueSession) CollaborationConnection
.getConnection().getSession(sessionId);
if (session instanceof SharedDisplaySession) { if (session instanceof SharedDisplaySession) {
UserId id = IDConverter.convertFrom(user.getUser()); UserId id = IDConverter.convertFrom(user.getUser());
boolean isSessionLeader = id boolean isSessionLeader = id

View file

@ -0,0 +1,325 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.session;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXB;
import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.presence.Presence;
import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Display;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.VizApp;
/**
* Built for the session in which everyone joins
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2012 mnash Initial creation
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public class SessionFeedView extends SessionView {
public static final String ID = "com.raytheon.uf.viz.collaboration.SessionFeedView";
private Action muteAction;
private Action unMuteAction;
private Action colorChangeAction;
private Action autoJoinAction;
private List<String> enabledUsers;
/**
*
*/
public SessionFeedView() {
super();
enabledUsers = readEnabledUsers();
}
private List<String> readEnabledUsers() {
LocalizationFile file = getLocalizationFile();
if (file.exists()) {
SubscribeList list = JAXB.unmarshal(file.getFile(), SubscribeList.class);
return list.getEnabledUsers();
}
return new ArrayList<String>();
}
private void persistEnabledUsers() {
SubscribeList list = new SubscribeList();
list.setEnabledUsers(enabledUsers);
JAXB.marshal(list, getLocalizationFile().getFile());
}
@Subscribe
public void refreshBlockList(SubscribeList list) {
enabledUsers = list.getEnabledUsers();
}
private LocalizationFile getLocalizationFile() {
LocalizationFile file = null;
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
file = PathManagerFactory.getPathManager().getLocalizationFile(context,
"collaboration" + File.separator + "subscribeList.xml");
return file;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#createActions()
*/
@Override
protected void createActions() {
super.createActions();
muteAction = new Action("Ignore User") {
@Override
public void run() {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
IRosterEntry entry = (IRosterEntry) selection.getFirstElement();
UserId id = IDConverter.convertFrom(entry.getUser());
if (enabledUsers.contains(id.getName())) {
((Presence) entry.getPresence()).getProperties().put(
"UserStatus", "Ignored");
usersTable.refresh(entry);
enabledUsers.remove(id.getName());
}
}
};
unMuteAction = new Action("Subcribe User") {
@Override
public void run() {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
IRosterEntry entry = (IRosterEntry) selection.getFirstElement();
UserId id = IDConverter.convertFrom(entry.getUser());
if (!enabledUsers.contains(id.getName())) {
((Presence) entry.getPresence()).getProperties().put(
"UserStatus", "Subscribed");
usersTable.refresh(entry);
enabledUsers.add(id.getName());
}
}
};
colorChangeAction = new Action("Change Color...") {
@Override
public void run() {
ColorDialog dlg = new ColorDialog(Display.getCurrent()
.getActiveShell());
RGB rgb = dlg.open();
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
IRosterEntry entry = (IRosterEntry) selection.getFirstElement();
manager.setColorForUser(
IDConverter.convertFrom(entry.getUser()), rgb);
usersTable.refresh(entry);
}
};
autoJoinAction = new Action("Autojoin", SWT.TOGGLE) {
public void run() {
Activator.getDefault().getPreferenceStore()
.setValue("autojoin", autoJoinAction.isChecked());
};
};
autoJoinAction.setChecked(Activator.getDefault().getPreferenceStore()
.getBoolean("autojoin"));
Activator.getDefault().getPreferenceStore()
.addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
autoJoinAction.setChecked(Activator.getDefault()
.getPreferenceStore().getBoolean("autojoin"));
}
});
MenuManager manager = (MenuManager) getViewSite().getActionBars()
.getMenuManager();
manager.add(autoJoinAction);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#fillContextMenu
* (org.eclipse.jface.action.IMenuManager)
*/
@Override
protected void fillContextMenu(IMenuManager manager) {
super.fillContextMenu(manager);
IRosterEntry entry = (IRosterEntry) ((IStructuredSelection) usersTable
.getSelection()).getFirstElement();
UserId id = IDConverter.convertFrom(entry.getUser());
if (!id.equals(CollaborationConnection.getConnection().getUser())) {
if (enabledUsers.contains(id.getName())) {
manager.add(muteAction);
} else {
manager.add(unMuteAction);
}
}
manager.add(colorChangeAction);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#setParticipantValues
* (com.raytheon.uf.viz.collaboration.ui.session.ParticipantsLabelProvider)
*/
@Override
protected void setParticipantValues(ParticipantsLabelProvider labelProvider) {
super.setParticipantValues(labelProvider);
labelProvider.setEnabledUsers(enabledUsers);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#handleMessage
* (com.raytheon.uf.viz.collaboration.comm.identity.IMessage)
*/
@Override
public void handleMessage(IMessage message) {
final IMessage msg = message;
// so not to have delay, going to handle messages from yourself
// separately
if (message.getFrom().equals(
CollaborationConnection.getConnection().getUser())) {
return;
}
if (enabledUsers.contains(message.getFrom().getName())) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
appendMessage(msg);
}
});
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#participantArrived
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
protected void participantArrived(UserId participant) {
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
Map<UserId, IRosterEntry> usersMap = session.getConnection()
.getContactsManager().getUsersMap();
IRosterEntry user = usersMap.get(participant);
if (user != null) {
for (IUser usr : usersMap.keySet()) {
if (usr.getName().equals(participant.getName())) {
user = usersMap.get(usr);
users.add(user);
break;
}
}
}
usersTable.setInput(users);
usersTable.refresh();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.session.SessionView#participantDeparted
* (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId)
*/
@Override
protected void participantDeparted(UserId participant) {
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
for (int i = 0; i < users.size(); ++i) {
UserId otherId = IDConverter.convertFrom(users.get(i).getUser());
if (users.get(i) == null
|| participant.getName().equals(otherId.getName())) {
users.remove(i);
usersTable.refresh();
break;
}
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.session.SessionView#dispose()
*/
@Override
public void dispose() {
persistEnabledUsers();
super.dispose();
}
}

View file

@ -34,7 +34,6 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.IStructuredSelection;
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;
@ -105,7 +104,7 @@ public class SessionView extends AbstractSessionView {
protected String sessionId; protected String sessionId;
private IVenueSession session; protected IVenueSession session;
private Image downArrow; private Image downArrow;
@ -208,10 +207,6 @@ public class SessionView extends AbstractSessionView {
} }
protected void fillContextMenu(IMenuManager manager) { protected void fillContextMenu(IMenuManager manager) {
IStructuredSelection selection = (IStructuredSelection) usersTable
.getSelection();
// TODO do something here!
Object ob = selection.getFirstElement();
} }
@Subscribe @Subscribe
@ -341,8 +336,7 @@ public class SessionView extends AbstractSessionView {
ParticipantsContentProvider contentProvider = new ParticipantsContentProvider(); ParticipantsContentProvider contentProvider = new ParticipantsContentProvider();
ParticipantsLabelProvider labelProvider = new ParticipantsLabelProvider(); ParticipantsLabelProvider labelProvider = new ParticipantsLabelProvider();
labelProvider.setSessionId(sessionId); setParticipantValues(labelProvider);
labelProvider.setManager(manager);
usersTable.setContentProvider(contentProvider); usersTable.setContentProvider(contentProvider);
usersTable.setLabelProvider(labelProvider); usersTable.setLabelProvider(labelProvider);
@ -390,6 +384,11 @@ public class SessionView extends AbstractSessionView {
((GridData) usersComp.getLayoutData()).exclude = true; ((GridData) usersComp.getLayoutData()).exclude = true;
} }
protected void setParticipantValues(ParticipantsLabelProvider labelProvider) {
labelProvider.setSessionId(sessionId);
labelProvider.setManager(manager);
}
@Override @Override
public void dispose() { public void dispose() {
// dispose of the images first // dispose of the images first
@ -567,6 +566,8 @@ public class SessionView extends AbstractSessionView {
@Override @Override
protected void setMessageLabel(Composite comp) { protected void setMessageLabel(Composite comp) {
Label label = new Label(comp, SWT.WRAP); Label label = new Label(comp, SWT.WRAP);
GridData data = new GridData(SWT.FILL, SWT.NONE, true, false);
label.setLayoutData(data);
StringBuilder labelInfo = new StringBuilder(); StringBuilder labelInfo = new StringBuilder();
if (session != null) { if (session != null) {
IVenueInfo info = session.getVenue().getInfo(); IVenueInfo info = session.getVenue().getInfo();
@ -637,7 +638,7 @@ public class SessionView extends AbstractSessionView {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantArrived(UserId participant) { protected void participantArrived(UserId participant) {
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput(); List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
Map<UserId, IRosterEntry> usersMap = session.getConnection() Map<UserId, IRosterEntry> usersMap = session.getConnection()
.getContactsManager().getUsersMap(); .getContactsManager().getUsersMap();
@ -660,7 +661,7 @@ public class SessionView extends AbstractSessionView {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantDeparted(UserId participant) { protected void participantDeparted(UserId participant) {
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput(); List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
if (users != null) { if (users != null) {
for (int i = 0; i < users.size(); ++i) { for (int i = 0; i < users.size(); ++i) {
@ -685,7 +686,7 @@ public class SessionView extends AbstractSessionView {
* @param presence * @param presence
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void participantPresenceUpdated(UserId participant, protected void participantPresenceUpdated(UserId participant,
IPresence presence) { IPresence presence) {
// Ignore the presence's mode/type. May not be the same as the user's. // Ignore the presence's mode/type. May not be the same as the user's.
// TODO Keep as a place holder for now since it may be needed to set // TODO Keep as a place holder for now since it may be needed to set

View file

@ -1,5 +1,3 @@
package com.raytheon.uf.viz.collaboration.ui.session;
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
@ -19,16 +17,12 @@ package com.raytheon.uf.viz.collaboration.ui.session;
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.collaboration.ui.session;
import org.eclipse.core.commands.AbstractHandler; import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.UFStatus.Priority;
/** /**
* TODO Add Description * TODO Add Description
@ -39,27 +33,30 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 1, 2012 rferrel Initial creation * Jun 7, 2012 mnash Initial creation
* *
* </pre> * </pre>
* *
* @author rferrel * @author mnash
* @version 1.0 * @version 1.0
*/ */
public class SessionAction extends AbstractHandler { @DynamicSerialize
private static final transient IUFStatusHandler statusHandler = UFStatus public class SubscribeList {
.getHandler(SessionAction.class); @DynamicSerializeElement
private List<String> enabledUsers;
@Override /**
public Object execute(ExecutionEvent event) throws ExecutionException { * @return the enabledUsers
try { */
PlatformUI.getWorkbench().getActiveWorkbenchWindow() public List<String> getEnabledUsers() {
.getActivePage().showView(SessionView.ID); return enabledUsers;
} catch (PartInitException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to open product browser", e);
}
return event;
} }
/**
* @param enabledUsers
* the enabledUsers to set
*/
public void setEnabledUsers(List<String> enabledUsers) {
this.enabledUsers = enabledUsers;
}
} }