Issue #693 add nws_collaborate view, and ability for default on startup or not
Former-commit-id: b50cfeb8633e2b9a0d2fc7bb848bbcf7d0404321
This commit is contained in:
parent
4b72bb3d8e
commit
022e982aae
11 changed files with 513 additions and 347 deletions
|
@ -294,8 +294,16 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
venueManager = getConnectionPresenceAdapter().getChatRoomManager();
|
||||
if (venueManager != null) {
|
||||
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) {
|
||||
subject = venueInfo.getDescription();
|
||||
completeVenueConnection(venueInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,14 @@
|
|||
icon="icons/chats.gif"
|
||||
name="Private Session"
|
||||
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
|
||||
point="org.eclipse.ui.views">
|
||||
|
@ -100,10 +108,6 @@
|
|||
id="com.raytheon.uf.viz.collaboration.chatView"
|
||||
name="Collaboration Browser" description="Command category for the Chat Room View">
|
||||
</category>
|
||||
<command
|
||||
id="com.raytheon.uf.viz.collaboration.ChatRoom"
|
||||
name="Collaboration Browser">
|
||||
</command>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
|
@ -116,13 +120,6 @@
|
|||
name="Collaboration Browser">
|
||||
</command>
|
||||
</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
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
|
@ -192,11 +189,6 @@
|
|||
id="com.raytheon.uf.viz.collaboration.ui.prefs.collaborationalertwordspreferencepage"
|
||||
name="Significant Words"
|
||||
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
|
||||
point="org.eclipse.ui.contexts">
|
||||
|
|
|
@ -23,15 +23,20 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
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.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>
|
||||
*
|
||||
|
@ -52,9 +57,32 @@ public class CollaborationGroupAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
// this opens the collaboration group view
|
||||
try {
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.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) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open collaboration contact list", e);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
|||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
|
||||
/**
|
||||
|
@ -75,5 +76,24 @@ public class CollaborationPreferencePage extends FieldEditorPreferencePage
|
|||
FieldEditor notifications = new BooleanFieldEditor("notifications",
|
||||
"Show Notifications", getFieldEditorParent());
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -71,6 +71,8 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
protected Map<String, Image> imageMap;
|
||||
|
||||
private List<String> enabledUsers;
|
||||
|
||||
protected Map<UserId, Color> colors;
|
||||
|
||||
private SessionColorManager manager;
|
||||
|
@ -213,6 +215,7 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -335,6 +338,10 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
return new Point(5, 5);
|
||||
}
|
||||
|
||||
protected void setEnabledUsers(List<String> enabledUsers) {
|
||||
this.enabledUsers = enabledUsers;
|
||||
}
|
||||
|
||||
protected String buildParticipantTooltip(IRosterEntry user) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
UserId partUser = IDConverter.convertFrom(user.getUser());
|
||||
|
@ -342,13 +349,18 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
builder.append("Name : ").append(user.getUser().getName())
|
||||
.append("\n");
|
||||
}
|
||||
builder.append("Status : ")
|
||||
.append(CollaborationUtils.formatMode(user.getPresence()
|
||||
.getMode())).append("\n");
|
||||
builder.append("Message : \"").append(user.getPresence().getStatus())
|
||||
.append("\"");
|
||||
ISession session = CollaborationConnection.getConnection().getSession(
|
||||
sessionId);
|
||||
builder.append("Status : ").append(
|
||||
CollaborationUtils.formatMode(user.getPresence().getMode()));
|
||||
if (!user.getPresence().getStatus().isEmpty()) {
|
||||
builder.append("\n").append("Message : \"")
|
||||
.append(user.getPresence().getStatus()).append("\"");
|
||||
}
|
||||
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) {
|
||||
UserId id = IDConverter.convertFrom(user.getUser());
|
||||
boolean isSessionLeader = id
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -34,7 +34,6 @@ import org.eclipse.jface.action.IMenuListener;
|
|||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
|
@ -105,7 +104,7 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
protected String sessionId;
|
||||
|
||||
private IVenueSession session;
|
||||
protected IVenueSession session;
|
||||
|
||||
private Image downArrow;
|
||||
|
||||
|
@ -208,10 +207,6 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
// TODO do something here!
|
||||
Object ob = selection.getFirstElement();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -341,8 +336,7 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
ParticipantsContentProvider contentProvider = new ParticipantsContentProvider();
|
||||
ParticipantsLabelProvider labelProvider = new ParticipantsLabelProvider();
|
||||
labelProvider.setSessionId(sessionId);
|
||||
labelProvider.setManager(manager);
|
||||
setParticipantValues(labelProvider);
|
||||
usersTable.setContentProvider(contentProvider);
|
||||
|
||||
usersTable.setLabelProvider(labelProvider);
|
||||
|
@ -390,6 +384,11 @@ public class SessionView extends AbstractSessionView {
|
|||
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||
}
|
||||
|
||||
protected void setParticipantValues(ParticipantsLabelProvider labelProvider) {
|
||||
labelProvider.setSessionId(sessionId);
|
||||
labelProvider.setManager(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// dispose of the images first
|
||||
|
@ -567,6 +566,8 @@ public class SessionView extends AbstractSessionView {
|
|||
@Override
|
||||
protected void setMessageLabel(Composite comp) {
|
||||
Label label = new Label(comp, SWT.WRAP);
|
||||
GridData data = new GridData(SWT.FILL, SWT.NONE, true, false);
|
||||
label.setLayoutData(data);
|
||||
StringBuilder labelInfo = new StringBuilder();
|
||||
if (session != null) {
|
||||
IVenueInfo info = session.getVenue().getInfo();
|
||||
|
@ -637,7 +638,7 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void participantArrived(UserId participant) {
|
||||
protected void participantArrived(UserId participant) {
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
Map<UserId, IRosterEntry> usersMap = session.getConnection()
|
||||
.getContactsManager().getUsersMap();
|
||||
|
@ -660,7 +661,7 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void participantDeparted(UserId participant) {
|
||||
protected void participantDeparted(UserId participant) {
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
if (users != null) {
|
||||
for (int i = 0; i < users.size(); ++i) {
|
||||
|
@ -685,7 +686,7 @@ public class SessionView extends AbstractSessionView {
|
|||
* @param presence
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void participantPresenceUpdated(UserId participant,
|
||||
protected void participantPresenceUpdated(UserId participant,
|
||||
IPresence presence) {
|
||||
// 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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||
|
||||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* 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
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||
|
||||
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 java.util.List;
|
||||
|
||||
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.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -39,27 +33,30 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
* Jun 7, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SessionAction extends AbstractHandler {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SessionAction.class);
|
||||
@DynamicSerialize
|
||||
public class SubscribeList {
|
||||
@DynamicSerializeElement
|
||||
private List<String> enabledUsers;
|
||||
|
||||
@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 product browser", e);
|
||||
}
|
||||
return event;
|
||||
/**
|
||||
* @return the enabledUsers
|
||||
*/
|
||||
public List<String> getEnabledUsers() {
|
||||
return enabledUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param enabledUsers
|
||||
* the enabledUsers to set
|
||||
*/
|
||||
public void setEnabledUsers(List<String> enabledUsers) {
|
||||
this.enabledUsers = enabledUsers;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue