Issue #244 added work on the chat for presence notifications
Former-commit-id:6f354374d6
[formerlyc96c33169b
[formerlyd264743199
] [formerly6f354374d6
[formerly ead836fb1bc7f5843a29dc26cf3d634c80e22a81]]] Former-commit-id:c96c33169b
[formerlyd264743199
] Former-commit-id:c96c33169b
Former-commit-id:b8cb02de4c
This commit is contained in:
parent
31af6b9634
commit
79ede3da29
9 changed files with 552 additions and 985 deletions
|
@ -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,8 +17,11 @@ 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.data;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -31,22 +32,34 @@ import org.eclipse.swt.widgets.Composite;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
* Mar 7, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CollaborationSessionComp extends SessionComp {
|
||||
|
||||
public CollaborationSessionComp(Composite parent) {
|
||||
super(parent);
|
||||
public class CollaborationKeywords {
|
||||
@XmlElement(name = "keyword")
|
||||
List<String> keywords;
|
||||
|
||||
/**
|
||||
* @param keywords
|
||||
* the keywords to set
|
||||
*/
|
||||
public void setKeywords(List<String> keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoomLabel() {
|
||||
return "(C) - " + getRoom();
|
||||
/**
|
||||
* @return the keywords
|
||||
*/
|
||||
public List<String> getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public static List<String> parseKeywords() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,237 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui;
|
||||
|
||||
/**
|
||||
* 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 java.util.Map;
|
||||
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
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.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.TabFolder;
|
||||
import org.eclipse.swt.widgets.TabItem;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionComp;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionComp;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CollaborationUsersDlg extends CaveSWTDialogBase {
|
||||
|
||||
private TreeViewer usersTreeViewer;
|
||||
|
||||
private UsersTree usersTree;
|
||||
|
||||
private TabFolder chatTabComp;
|
||||
|
||||
Map<String, String[]> groupMap;
|
||||
|
||||
protected CollaborationUsersDlg(Shell parentShell) {
|
||||
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE,
|
||||
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT
|
||||
| CAVE.INDEPENDENT_SHELL);
|
||||
setText("Collaboration Contacts");
|
||||
|
||||
usersTree = new UsersTree("kickstart");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
shell.setLayout(new GridLayout(1, false));
|
||||
createMenus(shell);
|
||||
createButtonBar(shell);
|
||||
createMainArea(shell);
|
||||
}
|
||||
|
||||
private void createMenus(Shell parent) {
|
||||
Menu bar = new Menu(parent, SWT.BAR);
|
||||
parent.setMenuBar(bar);
|
||||
MenuItem item = new MenuItem(bar, SWT.CASCADE);
|
||||
item.setText("&File");
|
||||
}
|
||||
|
||||
private void createButtonBar(Shell parent) {
|
||||
Composite bar = new Composite(parent, SWT.NONE);
|
||||
bar.setLayout(new GridLayout(3, false));
|
||||
Button button = new Button(bar, SWT.DEFAULT);
|
||||
button.setText("Invite");
|
||||
|
||||
button = new Button(bar, SWT.DEFAULT);
|
||||
button.setText("Collobration Chat");
|
||||
button.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
createCollaborationChat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
button = new Button(bar, SWT.DEFAULT);
|
||||
button.setText("Private Chat");
|
||||
button.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
createPrivateChat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void createCollaborationChat() {
|
||||
TabItem item = new TabItem(chatTabComp, SWT.DEFAULT);
|
||||
|
||||
CollaborationSessionComp child = new CollaborationSessionComp(
|
||||
chatTabComp);
|
||||
item.setControl(child);
|
||||
child.setRoom("Collaboration Room");
|
||||
|
||||
item.setText(child.getRoomLabel());
|
||||
}
|
||||
|
||||
private void createPrivateChat() {
|
||||
TabItem item = new TabItem(chatTabComp, SWT.DEFAULT);
|
||||
SessionComp child = new SessionComp(chatTabComp);
|
||||
item.setControl(child);
|
||||
child.setRoom("Private room");
|
||||
item.setText("Private Room");
|
||||
}
|
||||
|
||||
private void createMainArea(Shell parent) {
|
||||
Composite body = new Composite(parent, SWT.FILL);
|
||||
Color red = getParent().getDisplay().getSystemColor(SWT.COLOR_RED);
|
||||
body.setBackground(red);
|
||||
body.setLayout(new GridLayout());
|
||||
body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
SashForm mainForm = new SashForm(body, SWT.HORIZONTAL);
|
||||
mainForm.setLayout(new FillLayout());
|
||||
mainForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
Color blue = getParent().getDisplay().getSystemColor(SWT.COLOR_BLUE);
|
||||
mainForm.setBackground(blue);
|
||||
mainForm.setSashWidth(10);
|
||||
|
||||
createUsersTree(mainForm);
|
||||
createChatTabs(mainForm);
|
||||
mainForm.setWeights(new int[] { 20, 80 });
|
||||
}
|
||||
|
||||
private void createUsersTree(SashForm form) {
|
||||
Composite child = new Composite(form, SWT.NONE);
|
||||
child.setLayout(new GridLayout(1, false));
|
||||
Label label = new Label(child, SWT.NONE);
|
||||
label.setText("Groups");
|
||||
// usersTreeViewer = new TreeViewer(child, SWT.MULTI | SWT.BORDER
|
||||
// | SWT.FILL);
|
||||
usersTreeViewer = new TreeViewer(child);
|
||||
usersTreeViewer.getTree().setToolTipText("User groups");
|
||||
usersTreeViewer.getTree().setLayoutData(
|
||||
new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
usersTreeViewer.setContentProvider(new UsersTreeContentProvider(
|
||||
/* usersTree */));
|
||||
usersTreeViewer.setLabelProvider(new UsersTreeLabelProvider());
|
||||
usersTreeViewer.setSorter(new UsersTreeViewerSorter());
|
||||
}
|
||||
|
||||
private void createChatTabs(SashForm form) {
|
||||
Composite tabComp = new Composite(form, SWT.NONE);
|
||||
tabComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
chatTabComp = new TabFolder(tabComp, SWT.NONE);
|
||||
chatTabComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
}
|
||||
|
||||
private void populateUsers() {
|
||||
// TODO get from localization
|
||||
for (String g : new String[] { "Mybuddy1", "buddy1" }) {
|
||||
UsersTree root = usersTree.addChild(g);
|
||||
root.setText(g);
|
||||
for (String u : new String[] { "OAX_user1", "DSM_user3",
|
||||
"LBF_user2" }) {
|
||||
CollaborationUser item = new CollaborationUser(u);
|
||||
root.addChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO get from server
|
||||
for (String g : new String[] { "OAX", "DSM", "LBF", "FSD" }) {
|
||||
UsersTree root = usersTree.addChild(g);
|
||||
root.setText(g);
|
||||
for (String u : new String[] { g + "_user2", g + "_user3",
|
||||
g + "_user1" }) {
|
||||
CollaborationUser item = new CollaborationUser(u);
|
||||
root.addChild(item);
|
||||
}
|
||||
}
|
||||
usersTreeViewer.setInput(usersTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
populateUsers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
// TODO Auto-generated method stub
|
||||
super.disposed();
|
||||
System.err.println("Contact being disposed.");
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.RowLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
||||
|
||||
public class TestMain {
|
||||
private static CollaborationUsersDlg userDlg;
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
|
||||
public static void main(String[] args) {
|
||||
Display display = new Display();
|
||||
final Shell shell = new Shell(display);
|
||||
Button button = new Button(shell, SWT.PUSH);
|
||||
button.setText("Log on dialog");
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent ev) {
|
||||
super.widgetSelected(ev);
|
||||
LoginDialog d = new LoginDialog(shell);
|
||||
Object r = d.open();
|
||||
System.err.println("Result: "
|
||||
+ ((r == null) ? null : r.toString()));
|
||||
}
|
||||
});
|
||||
|
||||
button = new Button(shell, SWT.PUSH);
|
||||
button.setText("Contacts");
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent ev) {
|
||||
super.widgetSelected(ev);
|
||||
if (userDlg == null || userDlg.isDisposed()) {
|
||||
userDlg = new CollaborationUsersDlg(shell);
|
||||
userDlg.open();
|
||||
} else {
|
||||
userDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
shell.setDefaultButton(button);
|
||||
shell.setLayout(new RowLayout());
|
||||
shell.pack();
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui;
|
||||
|
||||
/**
|
||||
* 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 java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class UsersTree {
|
||||
private List<UsersTree> children;
|
||||
|
||||
private String text;
|
||||
|
||||
private CollaborationUser node;
|
||||
|
||||
public UsersTree(String text) {
|
||||
this.text = text;
|
||||
this.children = new LinkedList<UsersTree>();
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
public UsersTree(CollaborationUser user) {
|
||||
this.text = user.getId();
|
||||
this.children = null;
|
||||
this.node = user;
|
||||
}
|
||||
|
||||
public UsersTree addChild(String text) {
|
||||
UsersTree child = new UsersTree(text);
|
||||
children.add(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
public UsersTree addChild(CollaborationUser user) {
|
||||
UsersTree child = new UsersTree(user);
|
||||
children.add(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
public UsersTree findChildByText(String text) {
|
||||
CollaborationUser user = new CollaborationUser(text);
|
||||
if (hasChildren()) {
|
||||
for (UsersTree child : children) {
|
||||
if (user.compareTo(child.getUser()) == 0) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<UsersTree> getChildren() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
public boolean hasChildren() {
|
||||
return children != null && children.size() > 0;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public CollaborationUser getUser() {
|
||||
return this.node;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,10 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.IMenuCreator;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
|
||||
|
@ -47,50 +50,61 @@ public class CollaborationSessionView extends SessionView {
|
|||
|
||||
private static final String COLLABORATION_SESSION_IMAGE_NAME = "add_correction.gif";
|
||||
|
||||
private Action switchDataProviderAction;
|
||||
private Action switchToAction;
|
||||
|
||||
private Action switchLeaderAction;
|
||||
|
||||
public void createSwitchDataProviderAction() {
|
||||
switchDataProviderAction = new Action() {
|
||||
protected void createActions() {
|
||||
super.createActions();
|
||||
switchToAction = new Action("Switch to...", Action.AS_DROP_DOWN_MENU) {
|
||||
public void run() {
|
||||
switchDataProvider();
|
||||
if ("DataProvider".equals(switchToAction.getId())) {
|
||||
switchDataProvider();
|
||||
} else if ("SessionLeader".equals(switchToAction.getId())) {
|
||||
switchLeader();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
IMenuCreator creator = new IMenuCreator() {
|
||||
Menu menu;
|
||||
|
||||
@Override
|
||||
public Menu getMenu(Menu parent) {
|
||||
if (menu == null) {
|
||||
menu = new Menu(parent);
|
||||
}
|
||||
Action dataProviderAction = new Action("Data Provider") {
|
||||
public void run() {
|
||||
switchToAction.setId("DataProvider");
|
||||
switchToAction.run();
|
||||
};
|
||||
};
|
||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
||||
dataProviderAction);
|
||||
dataProviderItem.fill(menu, -1);
|
||||
|
||||
Action leaderAction = new Action("Session Leader") {
|
||||
public void run() {
|
||||
switchToAction.setId("SessionLeader");
|
||||
switchToAction.run();
|
||||
};
|
||||
};
|
||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
||||
leaderAction);
|
||||
leaderItem.fill(menu, -1);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
menu.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menu getMenu(Control parent) {
|
||||
return getMenu(parent.getMenu());
|
||||
}
|
||||
};
|
||||
// TODO find image and use instead of text
|
||||
// switchDataProviderAction.setImageDescriptor(CollaborationUtils
|
||||
// .getImageDescriptor("browser.gif"));
|
||||
switchDataProviderAction.setText("Data");
|
||||
switchDataProviderAction.setToolTipText("Switch Data Provider Request");
|
||||
}
|
||||
|
||||
public void createSwitchLeaderAction() {
|
||||
switchLeaderAction = new Action() {
|
||||
public void run() {
|
||||
switchLeader();
|
||||
}
|
||||
};
|
||||
// TODO find image and use instead of text
|
||||
// switchLeaderAction.setImageDescriptor(CollaborationUtils
|
||||
// .getImageDescriptor("browser.gif"));
|
||||
switchLeaderAction.setText("Leader");
|
||||
switchLeaderAction.setToolTipText("Switch Leader Request");
|
||||
}
|
||||
|
||||
protected void createToolBar() {
|
||||
IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
|
||||
createSwitchDataProviderAction();
|
||||
createSwitchLeaderAction();
|
||||
ActionContributionItem item = null;
|
||||
item = new ActionContributionItem(switchDataProviderAction);
|
||||
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
mgr.add(item);
|
||||
item = new ActionContributionItem(switchLeaderAction);
|
||||
item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
mgr.add(switchLeaderAction);
|
||||
// item = new ActionContributionItem(sendMessageAction);
|
||||
// item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
super.createToolBar();
|
||||
switchToAction.setMenuCreator(creator);
|
||||
}
|
||||
|
||||
public void switchDataProvider() {
|
||||
|
@ -125,8 +139,19 @@ public class CollaborationSessionView extends SessionView {
|
|||
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.sendMessageToVenue(message);
|
||||
}
|
||||
// @Override
|
||||
// public void dispose() {
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
/*
|
||||
* (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);
|
||||
// check if data provider
|
||||
// check if session leader
|
||||
manager.add(switchToAction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,9 @@ import org.eclipse.swt.graphics.Color;
|
|||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser.RoleType;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -49,6 +51,8 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
|||
public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||
ITableFontProvider, ITableLabelProvider {
|
||||
|
||||
private String sessionId = null;
|
||||
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -64,7 +68,7 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
// TODO Auto-generated method stub
|
||||
System.err.println("isLabelProperty");
|
||||
System.out.println("isLabelProperty");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -76,7 +80,7 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
System.err.println("getColumImage");
|
||||
System.out.println("getColumnImage");
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
@ -84,25 +88,86 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
RoleType[] roles = user.getRoles(sessionId);
|
||||
return user.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font getFont(Object element, int columnIndex) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("getFont");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getForeground(Object element, int columnIndex) {
|
||||
// TODO Auto-generated method stub
|
||||
CollaborationDataManager.getInstance().getUser(element.toString());
|
||||
System.out.println("getForeground");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackground(Object element, int columnIndex) {
|
||||
System.out.println("getBackground");
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sessionId
|
||||
* the sessionId to set
|
||||
*/
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sessionId
|
||||
*/
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
// usersList.setLabelProvider(new LabelProvider() {
|
||||
// public String getText(Object element) {
|
||||
// CollaborationUser user = (CollaborationUser) element;
|
||||
// DataUser.RoleType[] roles = user.getRoles(sessionId);
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// if (roles.length > 0
|
||||
// && roles[0] != DataUser.RoleType.PARTICIPANT) {
|
||||
// sb.append("[");
|
||||
// for (DataUser.RoleType r : roles) {
|
||||
// switch (r) {
|
||||
// case DATA_PROVIDER:
|
||||
// sb.append("D");
|
||||
// break;
|
||||
// case LEADER:
|
||||
// sb.append("L");
|
||||
// break;
|
||||
// default:
|
||||
// sb.append("?");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// sb.append("] - ");
|
||||
// }
|
||||
// sb.append(user.getId());
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
// public Image getImage(Object element) {
|
||||
// Image image = null;
|
||||
// if (element instanceof CollaborationNode) {
|
||||
// CollaborationNode node = (CollaborationNode) element;
|
||||
// String key = node.getImageKey();
|
||||
// if (key != null) {
|
||||
// image = imageMap.get(key);
|
||||
// if (image == null) {
|
||||
// image = CollaborationUtils.getNodeImage(node);
|
||||
// imageMap.put(key, image);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return image;
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* 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.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser.RoleType;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 6, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SessionColorAdvisor {
|
||||
private static Map<RoleType, Color> colors = null;
|
||||
|
||||
public static Color getColor(List<RoleType> type, boolean isSelf) {
|
||||
if (colors == null) {
|
||||
colors = new HashMap<RoleType, Color>();
|
||||
colors.put(RoleType.LEADER,
|
||||
Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
|
||||
colors.put(RoleType.DATA_PROVIDER, Display.getCurrent()
|
||||
.getSystemColor(SWT.COLOR_RED));
|
||||
colors.put(RoleType.PARTICIPANT, Display.getCurrent()
|
||||
.getSystemColor(SWT.COLOR_DARK_GREEN));
|
||||
}
|
||||
if (isSelf) {
|
||||
return Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
|
||||
}
|
||||
RoleType rType = null;
|
||||
if (type == null || type.isEmpty()) {
|
||||
rType = RoleType.PARTICIPANT;
|
||||
} else if (type.contains(RoleType.LEADER)) {
|
||||
rType = RoleType.LEADER;
|
||||
} else if (type.contains(RoleType.DATA_PROVIDER)) {
|
||||
rType = RoleType.DATA_PROVIDER;
|
||||
} else {
|
||||
rType = RoleType.PARTICIPANT;
|
||||
}
|
||||
return colors.get(rType);
|
||||
}
|
||||
}
|
|
@ -1,251 +0,0 @@
|
|||
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.
|
||||
*
|
||||
* 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.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.ListViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SessionComp extends Composite {
|
||||
protected static Image image;
|
||||
|
||||
private static int SASH_WIDTH = 3;
|
||||
|
||||
private static int SASH_COLOR = SWT.COLOR_DARK_GRAY;
|
||||
|
||||
private ListViewer usersList;
|
||||
|
||||
private Text chatMessages;
|
||||
|
||||
private Text messageToSend;
|
||||
|
||||
private String session;
|
||||
|
||||
public SessionComp(Composite parent) {
|
||||
this(parent, "UNKNOWN");
|
||||
}
|
||||
|
||||
public SessionComp(Composite parent, String session) {
|
||||
super(parent, SWT.NONE);
|
||||
this.session = session;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
Color sashColor = getParent().getDisplay().getSystemColor(SASH_COLOR);
|
||||
setLayout(new GridLayout(1, false));
|
||||
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
SashForm bar = new SashForm(this, SWT.HORIZONTAL);
|
||||
bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
bar.setBackground(sashColor);
|
||||
bar.setSashWidth(SASH_WIDTH);
|
||||
|
||||
Composite usersComp = new Composite(bar, SWT.NONE);
|
||||
bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
Composite messagesComp = new Composite(bar, SWT.NONE);
|
||||
bar.setWeights(new int[] { 20, 80 });
|
||||
|
||||
usersComp.setLayout(new GridLayout(1, false));
|
||||
Label label = null;
|
||||
label = new Label(usersComp, SWT.NONE);
|
||||
label.setText("Participants");
|
||||
|
||||
usersList = new ListViewer(usersComp, SWT.MULTI | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL);
|
||||
usersList.setContentProvider(new IStructuredContentProvider() {
|
||||
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput,
|
||||
Object newInput) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
|
||||
return (CollaborationUser[]) inputElement;
|
||||
}
|
||||
});
|
||||
|
||||
usersList.setLabelProvider(new LabelProvider() {
|
||||
public String getText(Object element) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
DataUser.RoleType[] roles = user.getRoles(session);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (roles.length > 0) {
|
||||
sb.append("[");
|
||||
for (DataUser.RoleType r : roles) {
|
||||
switch (r) {
|
||||
case DATA_PROVIDER:
|
||||
sb.append("D");
|
||||
break;
|
||||
case LEADER:
|
||||
sb.append("L");
|
||||
break;
|
||||
default:
|
||||
sb.append("P");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.append("] - ");
|
||||
}
|
||||
sb.append(user.getId());
|
||||
return sb.toString();
|
||||
}
|
||||
});
|
||||
|
||||
usersList.setSorter(new ViewerSorter() {
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
return super.compare(viewer, e1, e2);
|
||||
}
|
||||
});
|
||||
|
||||
usersList.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
CollaborationUser u = new CollaborationUser("OAX_user2");
|
||||
u.addRole(DataUser.RoleType.DATA_PROVIDER);
|
||||
u.addRole(DataUser.RoleType.LEADER);
|
||||
u.setStatus(DataUser.StatusType.AVAILABLE);
|
||||
usersList.add(u);
|
||||
u = new CollaborationUser("OAX_user1");
|
||||
u.addRole(DataUser.RoleType.PARTICIPANT);
|
||||
u.setStatus(DataUser.StatusType.MEETING);
|
||||
usersList.add(u);
|
||||
|
||||
messagesComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
SashForm messagesSash = new SashForm(messagesComp, SWT.VERTICAL);
|
||||
messagesSash
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
messagesSash.setBackground(sashColor);
|
||||
messagesSash.setSashWidth(SASH_WIDTH);
|
||||
Composite chatComp = new Composite(messagesSash, SWT.BORDER
|
||||
/* | SWT.H_SCROLL | SWT.V_SCROLL */);
|
||||
Composite sendComp = new Composite(messagesSash, SWT.NONE);
|
||||
messagesSash.setWeights(new int[] { 80, 20 });
|
||||
|
||||
chatComp.setLayout(new GridLayout(1, false));
|
||||
label = new Label(chatComp, SWT.NONE);
|
||||
label.setText("Messages");
|
||||
chatMessages = new Text(chatComp, SWT.MULTI | SWT.READ_ONLY);
|
||||
chatMessages
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
chatMessages.setText("Chat messages\n go here.");
|
||||
|
||||
sendComp.setLayout(new GridLayout(1, false));
|
||||
label = new Label(sendComp, SWT.NONE);
|
||||
label.setText("Compose");
|
||||
messageToSend = new Text(sendComp, SWT.MULTI);
|
||||
messageToSend
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
messageToSend.setText("send messages go here");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void addUsers(java.util.List<CollaborationUser> users) {
|
||||
for (CollaborationUser user : users) {
|
||||
addUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUser(CollaborationUser user) {
|
||||
usersList.add(user);
|
||||
}
|
||||
|
||||
public void clearUsers() {
|
||||
usersList.getList().removeAll();
|
||||
}
|
||||
|
||||
public void removeUser(CollaborationUser user) {
|
||||
usersList.remove(user);
|
||||
}
|
||||
|
||||
public void addMessage(CollaborationUser user, String timestamp,
|
||||
String message) {
|
||||
StringBuilder sb = new StringBuilder("\n");
|
||||
sb.append(user.getId()).append(" (").append(timestamp).append(") ==> ")
|
||||
.append(message);
|
||||
}
|
||||
|
||||
public void sendMessage() {
|
||||
System.out.println("Get and send message here");
|
||||
}
|
||||
|
||||
public String getRoom() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void setRoom(String room) {
|
||||
this.session = room;
|
||||
}
|
||||
|
||||
public String getRoomLabel() {
|
||||
return "(P) - " + getRoom();
|
||||
}
|
||||
|
||||
public Image getRoomImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void grabFocus() {
|
||||
messageToSend.setFocus();
|
||||
}
|
||||
}
|
|
@ -20,22 +20,26 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ControlListener;
|
||||
import org.eclipse.swt.events.ExpandEvent;
|
||||
import org.eclipse.swt.events.ExpandListener;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
|
@ -47,21 +51,34 @@ import org.eclipse.swt.graphics.Image;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.ExpandBar;
|
||||
import org.eclipse.swt.widgets.ExpandItem;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.part.ViewPart;
|
||||
|
||||
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.IMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
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.listener.IMessageFilter;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageListener;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IPresenceListener;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationKeywords;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser.RoleType;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
|
@ -82,7 +99,9 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
|||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SessionView extends ViewPart {
|
||||
public class SessionView extends ViewPart implements IPartListener {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SessionView.class);
|
||||
|
||||
protected static final String SESSION_IMAGE_KEY = "sessionId.key";
|
||||
|
||||
|
@ -92,13 +111,11 @@ public class SessionView extends ViewPart {
|
|||
|
||||
public static final String ID = "com.raytheon.uf.viz.collaboration.SessionView";
|
||||
|
||||
protected Composite view;
|
||||
|
||||
private static int SASH_WIDTH = 3;
|
||||
private static int SASH_WIDTH = 5;
|
||||
|
||||
private static int SASH_COLOR = SWT.COLOR_DARK_GRAY;
|
||||
|
||||
private TableViewer usersList;
|
||||
private TableViewer usersTable;
|
||||
|
||||
private StyledText messagesText;
|
||||
|
||||
|
@ -106,16 +123,14 @@ public class SessionView extends ViewPart {
|
|||
|
||||
protected String sessionId;
|
||||
|
||||
private int usersCollapsedHeight = -1;
|
||||
|
||||
private boolean usersExpanding = true;
|
||||
|
||||
private int usersBarExpandedHeight = -1;
|
||||
|
||||
private int[] usersExpandedWeights;
|
||||
|
||||
private Action sendMessageAction;
|
||||
|
||||
private Action chatAction;
|
||||
|
||||
protected IPresenceListener presListener;
|
||||
|
||||
protected IMessageListener messageListener;
|
||||
|
||||
public SessionView() {
|
||||
imageMap = new HashMap<String, Image>();
|
||||
}
|
||||
|
@ -124,7 +139,8 @@ public class SessionView extends ViewPart {
|
|||
public void createPartControl(Composite parent) {
|
||||
setTitleImage(getImage());
|
||||
initComponents(parent);
|
||||
createToolBar();
|
||||
createActions();
|
||||
createContextMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,22 +149,85 @@ public class SessionView extends ViewPart {
|
|||
}
|
||||
|
||||
private void initComponents(Composite parent) {
|
||||
view = new Composite(parent, SWT.NONE);
|
||||
Color sashColor = view.getParent().getDisplay()
|
||||
.getSystemColor(SASH_COLOR);
|
||||
view.setLayout(new GridLayout(1, false));
|
||||
view.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
SashForm bar = new SashForm(view, SWT.VERTICAL);
|
||||
bar.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
bar.setBackground(sashColor);
|
||||
bar.setSashWidth(SASH_WIDTH);
|
||||
bar.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
Composite view = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(1, false);
|
||||
layout.marginWidth = 0;
|
||||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
view.setLayout(layout);
|
||||
view.setData(data);
|
||||
|
||||
Color sashColor = Display.getCurrent().getSystemColor(SASH_COLOR);
|
||||
|
||||
SashForm sashForm = new SashForm(view, SWT.VERTICAL);
|
||||
layout = new GridLayout(1, false);
|
||||
sashForm.setLayout(layout);
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
sashForm.setLayoutData(data);
|
||||
sashForm.setBackground(sashColor);
|
||||
sashForm.setSashWidth(SASH_WIDTH);
|
||||
|
||||
createUsersComp(bar);
|
||||
createMessagesComp(bar);
|
||||
createComposeComp(bar);
|
||||
bar.setWeights(new int[] { 5, 85, 10 });
|
||||
createListeners();
|
||||
createUsersComp(sashForm);
|
||||
createMessagesComp(sashForm);
|
||||
createComposeComp(sashForm);
|
||||
sashForm.setWeights(new int[] { 1, 20, 5 });
|
||||
|
||||
}
|
||||
|
||||
protected void createActions() {
|
||||
chatAction = new Action("Chat") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
PlatformUI
|
||||
.getWorkbench()
|
||||
.getActiveWorkbenchWindow()
|
||||
.getActivePage()
|
||||
.showView(CollaborationSessionView.ID, null,
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
// }
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open chat", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void createContextMenu() {
|
||||
MenuManager menuManager = new MenuManager();
|
||||
menuManager.setRemoveAllWhenShown(true);
|
||||
menuManager.addMenuListener(new IMenuListener() {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse
|
||||
* .jface.action.IMenuManager)
|
||||
*/
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
fillContextMenu(manager);
|
||||
}
|
||||
});
|
||||
Menu menu = menuManager.createContextMenu(usersTable.getControl());
|
||||
usersTable.getControl().setMenu(menu);
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
.getActivePart().getSite()
|
||||
.registerContextMenu(menuManager, usersTable);
|
||||
usersTable.getTable().setMenu(menu);
|
||||
}
|
||||
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
// do something here!
|
||||
Object ob = selection.getFirstElement();
|
||||
manager.add(chatAction);
|
||||
manager.add(new Separator());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,248 +237,178 @@ public class SessionView extends ViewPart {
|
|||
*/
|
||||
private void createListeners() {
|
||||
sessionId = getViewSite().getSecondaryId();
|
||||
setPartName(CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId).getVenue().getInfo().getVenueName());
|
||||
if (CollaborationDataManager.getInstance().getSession(sessionId) != null) {
|
||||
setPartName(CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId).getVenue().getInfo().getVenueName());
|
||||
// Attach desired listeners to the session
|
||||
ISession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
messageListener = new IMessageListener() {
|
||||
|
||||
// Attach desired listeners to the session
|
||||
ISession session = CollaborationDataManager.getInstance().getSession(
|
||||
sessionId);
|
||||
session.addMessageListener(new IMessageListener() {
|
||||
@Override
|
||||
public void processMessage(final IMessage message) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void processMessage(final IMessage message) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
addMessage(message.getFrom().getName(),
|
||||
message.getTimeStamp(), message.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
session.addMessageListener(messageListener, new IMessageFilter() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
addMessage(message.getFrom().getFQName(),
|
||||
message.getTimeStamp(), message.getBody());
|
||||
@Override
|
||||
public boolean filter(IMessage message) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
presListener = new IPresenceListener() {
|
||||
|
||||
@Override
|
||||
public void notifyPresence(IPresence presence) {
|
||||
// not the best way to do it, should just be adding the new
|
||||
// user instead of requerying for participants
|
||||
Collection<IVenueParticipant> participants = CollaborationDataManager
|
||||
.getInstance().getSession(sessionId).getVenue()
|
||||
.getParticipants();
|
||||
final List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
||||
for (IVenueParticipant part : participants) {
|
||||
CollaborationUser user = new CollaborationUser(
|
||||
part.getName());
|
||||
user.setText(user.getId());
|
||||
users.add(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, new IMessageFilter() {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
usersTable.setInput(users
|
||||
.toArray(new CollaborationUser[users.size()]));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
session.addPresenceListener(presListener, new IMessageFilter() {
|
||||
@Override
|
||||
public boolean filter(IMessage message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filter(IMessage message) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// TODO populate participants table
|
||||
session.addPresenceListener(new IPresenceListener() {
|
||||
|
||||
@Override
|
||||
public void notifyPresence(IPresence presence) {
|
||||
System.out.println(presence.getMode());
|
||||
System.out.println(presence.getType());
|
||||
|
||||
}
|
||||
|
||||
}, new IMessageFilter() {
|
||||
@Override
|
||||
public boolean filter(IMessage message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// for (String id : users) {
|
||||
// CollaborationUser user = new CollaborationUser(id, sessionId);
|
||||
// usersList.add(user);
|
||||
// }
|
||||
}
|
||||
|
||||
private void setUsersHeight(ExpandBar bar) {
|
||||
ExpandItem item = bar.getItem(0);
|
||||
|
||||
// Composite comp = (Composite) item.getControl();
|
||||
// GridLayout gl = (GridLayout) comp.getLayout();
|
||||
int y = bar.getSize().y;
|
||||
// y -= usersCollapsedHeight + 0 * gl.verticalSpacing + gl.marginBottom;
|
||||
y -= usersCollapsedHeight;
|
||||
if (y < usersCollapsedHeight) {
|
||||
y = usersCollapsedHeight;
|
||||
}
|
||||
item.setHeight(y);
|
||||
}
|
||||
|
||||
private void createUsersComp(Composite parent) {
|
||||
Composite comp = new Composite(parent, SWT.NONE);
|
||||
comp.setLayout(new GridLayout(1, false));
|
||||
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
comp.addControlListener(new ControlListener() {
|
||||
GridLayout layout = new GridLayout(1, false);
|
||||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
comp.setLayout(layout);
|
||||
comp.setLayoutData(data);
|
||||
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
if (usersExpanding) {
|
||||
// Expand control listener is adjusting the height.
|
||||
usersExpanding = false;
|
||||
} else {
|
||||
Composite comp = (Composite) e.getSource();
|
||||
ExpandBar bar = (ExpandBar) comp.getChildren()[0];
|
||||
usersBarExpandedHeight = comp.getSize().y;
|
||||
bar.setSize(bar.getSize().x, usersBarExpandedHeight);
|
||||
setUsersHeight(bar);
|
||||
}
|
||||
}
|
||||
ExpandBar usersBar = new ExpandBar(comp, SWT.NONE);
|
||||
layout = new GridLayout(1, false);
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
usersBar.setLayout(layout);
|
||||
usersBar.setLayoutData(data);
|
||||
Image usersImage = Display.getCurrent().getSystemImage(SWT.ICON_SEARCH);
|
||||
|
||||
@Override
|
||||
public void controlMoved(ControlEvent e) {
|
||||
}
|
||||
});
|
||||
final Composite usersComp = new Composite(usersBar, SWT.NONE);
|
||||
layout = new GridLayout(1, false);
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
usersComp.setLayout(layout);
|
||||
usersComp.setLayoutData(data);
|
||||
|
||||
ExpandBar usersBar = new ExpandBar(comp, SWT.BORDER | SWT.V_SCROLL);
|
||||
usersBar.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
Image usersImage = parent.getParent().getDisplay()
|
||||
.getSystemImage(SWT.ICON_SEARCH);
|
||||
|
||||
Composite usersComp = new Composite(usersBar, SWT.NONE);
|
||||
usersComp.setLayout(new GridLayout(1, false));
|
||||
usersComp.addControlListener(new ControlListener() {
|
||||
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
System.err.println("controlResized: " + e.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void controlMoved(ControlEvent e) {
|
||||
System.err.println("controlMoved: " + e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
ExpandItem usersItem = new ExpandItem(usersBar, SWT.DEFAULT);
|
||||
ExpandItem usersItem = new ExpandItem(usersBar, SWT.NONE);
|
||||
usersItem.setText("Participants");
|
||||
usersItem.setControl(usersComp);
|
||||
usersItem.setImage(usersImage);
|
||||
|
||||
usersBar.addExpandListener(new ExpandListener() {
|
||||
|
||||
@Override
|
||||
public void itemExpanded(ExpandEvent e) {
|
||||
usersExpanding = true;
|
||||
ExpandBar bar = (ExpandBar) e.getSource();
|
||||
SashForm form = (SashForm) bar.getParent().getParent();
|
||||
form.setWeights(usersExpandedWeights);
|
||||
bar.setSize(bar.getSize().x, usersBarExpandedHeight);
|
||||
setUsersHeight(bar);
|
||||
usersComp.setSize(usersTable.getTable().computeSize(
|
||||
SWT.DEFAULT, 500));
|
||||
((SashForm) usersComp.getParent().getParent().getParent())
|
||||
.layout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void itemCollapsed(ExpandEvent e) {
|
||||
usersExpanding = true;
|
||||
ExpandBar bar = (ExpandBar) e.getSource();
|
||||
SashForm form = (SashForm) bar.getParent().getParent();
|
||||
ExpandItem item = bar.getItem(0);
|
||||
usersExpandedWeights = form.getWeights();
|
||||
Composite c = (Composite) item.getControl();
|
||||
GridLayout gl = (GridLayout) c.getLayout();
|
||||
int y = usersCollapsedHeight + 6 * gl.verticalSpacing
|
||||
+ gl.marginBottom;
|
||||
usersComp.setSize(usersTable.getTable().computeSize(
|
||||
SWT.DEFAULT, 100));
|
||||
|
||||
item.setHeight(y);
|
||||
int[] wts = usersExpandedWeights.clone();
|
||||
wts[0] = y;
|
||||
wts[1] += usersExpandedWeights[0] - y;
|
||||
form.setWeights(wts);
|
||||
((SashForm) usersComp.getParent().getParent().getParent())
|
||||
.layout();
|
||||
}
|
||||
});
|
||||
|
||||
usersList = new TableViewer(usersComp, SWT.BORDER | SWT.SINGLE
|
||||
usersTable = new TableViewer(usersComp, SWT.BORDER | SWT.SINGLE
|
||||
| SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
usersList.setContentProvider(new IStructuredContentProvider() {
|
||||
layout = new GridLayout(1, false);
|
||||
data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
data.heightHint = 100;
|
||||
usersTable.getTable().setLayout(layout);
|
||||
usersTable.getTable().setLayoutData(data);
|
||||
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput,
|
||||
Object newInput) {
|
||||
}
|
||||
usersItem.setHeight(usersComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
|
||||
usersItem.setControl(usersComp);
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
ParticipantsContentProvider contentProvider = new ParticipantsContentProvider();
|
||||
ParticipantsLabelProvider labelProvider = new ParticipantsLabelProvider();
|
||||
labelProvider.setSessionId(sessionId);
|
||||
usersTable.setContentProvider(contentProvider);
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
|
||||
return (CollaborationUser[]) inputElement;
|
||||
}
|
||||
});
|
||||
|
||||
usersList.setLabelProvider(new LabelProvider() {
|
||||
public String getText(Object element) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
DataUser.RoleType[] roles = user.getRoles(sessionId);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (roles.length > 0
|
||||
&& roles[0] != DataUser.RoleType.PARTICIPANT) {
|
||||
sb.append("[");
|
||||
for (DataUser.RoleType r : roles) {
|
||||
switch (r) {
|
||||
case DATA_PROVIDER:
|
||||
sb.append("D");
|
||||
break;
|
||||
case LEADER:
|
||||
sb.append("L");
|
||||
break;
|
||||
default:
|
||||
sb.append("?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.append("] - ");
|
||||
}
|
||||
sb.append(user.getId());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Image getImage(Object element) {
|
||||
Image image = null;
|
||||
if (element instanceof CollaborationNode) {
|
||||
CollaborationNode node = (CollaborationNode) element;
|
||||
String key = node.getImageKey();
|
||||
if (key != null) {
|
||||
image = imageMap.get(key);
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(node);
|
||||
imageMap.put(key, image);
|
||||
}
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
});
|
||||
|
||||
usersList.setSorter(new ViewerSorter() {
|
||||
usersTable.setLabelProvider(labelProvider);
|
||||
usersTable.setSorter(new ViewerSorter() {
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
// return ((CollaborationUser) e1)
|
||||
// .compareTo((CollaborationUser) e1);
|
||||
return super.compare(viewer, e1, e2);
|
||||
}
|
||||
});
|
||||
|
||||
usersList.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
usersCollapsedHeight = usersComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
|
||||
usersItem.setHeight(usersCollapsedHeight);
|
||||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
||||
for (IVenueParticipant part : session.getVenue().getParticipants()) {
|
||||
CollaborationUser user = new CollaborationUser(part.getName());
|
||||
user.setText(part.getName());
|
||||
users.add(user);
|
||||
}
|
||||
usersTable.setInput(users.toArray(new CollaborationUser[users.size()]));
|
||||
}
|
||||
|
||||
private void createMessagesComp(Composite parent) {
|
||||
Composite messagesComp = new Composite(parent, SWT.BORDER);
|
||||
messagesComp.setLayout(new GridLayout(1, false));
|
||||
Composite messagesComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(1, false);
|
||||
messagesComp.setLayout(layout);
|
||||
Label label = new Label(messagesComp, SWT.NONE);
|
||||
label.setText("Messages");
|
||||
|
||||
StringBuilder labelInfo = new StringBuilder();
|
||||
IVenueInfo info = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId).getVenue().getInfo();
|
||||
labelInfo.append(info.getVenueDescription());
|
||||
label.setToolTipText(info.getVenueSubject());
|
||||
if (info.getVenueSubject() != null && !info.getVenueSubject().isEmpty()) {
|
||||
labelInfo.append(":");
|
||||
labelInfo.append(info.getVenueSubject());
|
||||
}
|
||||
label.setText(labelInfo.toString());
|
||||
messagesText = new StyledText(messagesComp, SWT.MULTI | SWT.WRAP
|
||||
| SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
| SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
||||
messagesText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
}
|
||||
|
||||
private void createComposeComp(Composite parent) {
|
||||
Composite composeComp = new Composite(parent, SWT.BORDER);
|
||||
composeComp.setLayout(new GridLayout(1, false));
|
||||
Composite composeComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(1, false);
|
||||
composeComp.setLayout(layout);
|
||||
Label label = new Label(composeComp, SWT.NONE);
|
||||
label.setText("Compose");
|
||||
label.setText("Compose:");
|
||||
composeText = new StyledText(composeComp, SWT.MULTI | SWT.WRAP
|
||||
| SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
||||
composeText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
composeText.setToolTipText("Enter message here");
|
||||
composeText.addKeyListener(new KeyListener() {
|
||||
private boolean keyPressed;
|
||||
|
||||
|
@ -413,7 +422,8 @@ public class SessionView extends ViewPart {
|
|||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (!keyPressed && e.keyCode == SWT.CR) {
|
||||
if (!keyPressed
|
||||
&& (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR)) {
|
||||
sendMessage();
|
||||
}
|
||||
if (e.keyCode == SWT.SHIFT) {
|
||||
|
@ -454,6 +464,14 @@ public class SessionView extends ViewPart {
|
|||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (messageListener != null) {
|
||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.removeMessageListener(messageListener);
|
||||
}
|
||||
if (presListener != null) {
|
||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.removePresenceListener(presListener);
|
||||
}
|
||||
for (String key : imageMap.keySet()) {
|
||||
imageMap.get(key).dispose();
|
||||
}
|
||||
|
@ -469,26 +487,62 @@ public class SessionView extends ViewPart {
|
|||
}
|
||||
|
||||
public void addUser(CollaborationUser user) {
|
||||
usersList.add(user);
|
||||
usersTable.add(user);
|
||||
}
|
||||
|
||||
public void clearUsers() {
|
||||
usersList.getTable().removeAll();
|
||||
usersTable.getTable().removeAll();
|
||||
}
|
||||
|
||||
public void removeUser(CollaborationUser user) {
|
||||
usersList.remove(user);
|
||||
usersTable.remove(user);
|
||||
}
|
||||
|
||||
public void addMessage(String user, long timestamp, String message) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(timestamp);
|
||||
String time = String.format("%1$tI:%1$tM:%1$tS %1$Tp", cal);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (messagesText.getCharCount() != 0) {
|
||||
sb.append("\n");
|
||||
}
|
||||
int offset = 0;
|
||||
sb.append("(").append(time).append(") ");
|
||||
offset = sb.length();
|
||||
|
||||
StringBuilder sb = new StringBuilder("\n");
|
||||
sb.append(user).append(" (").append(time).append(") ==> ")
|
||||
.append(message);
|
||||
sb.append(user).append(": ").append(message);
|
||||
|
||||
// here is the place to put the font and color changes for keywords
|
||||
// read in localization file once and then don't read in again, per chat
|
||||
// room?
|
||||
List<String> keywords = CollaborationKeywords.parseKeywords();
|
||||
List<StyleRange> ranges = new ArrayList<StyleRange>();
|
||||
if (keywords != null) {
|
||||
for (String keyword : keywords) {
|
||||
if (sb.toString().toLowerCase().contains(keyword.toLowerCase())) {
|
||||
StyleRange keywordRange = new StyleRange(
|
||||
messagesText.getCharCount()
|
||||
+ sb.toString().toLowerCase()
|
||||
.indexOf(keyword.toLowerCase()),
|
||||
keyword.length(), null, null, SWT.BOLD | SWT.ITALIC);
|
||||
ranges.add(keywordRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX determine from the user data
|
||||
// get self
|
||||
List<RoleType> type = new ArrayList<RoleType>();
|
||||
type.add(RoleType.LEADER);
|
||||
Color color = SessionColorAdvisor.getColor(type, false);
|
||||
StyleRange range = new StyleRange(messagesText.getCharCount() + offset,
|
||||
user.length() + 1, color, null, SWT.BOLD);
|
||||
messagesText.append(sb.toString());
|
||||
messagesText.setStyleRange(range);
|
||||
for (StyleRange newRange : ranges) {
|
||||
messagesText.setStyleRange(newRange);
|
||||
}
|
||||
messagesText.setTopIndex(messagesText.getLineCount() - 1);
|
||||
}
|
||||
|
||||
public void sendMessage() {
|
||||
|
@ -509,42 +563,34 @@ public class SessionView extends ViewPart {
|
|||
return sessionId;
|
||||
}
|
||||
|
||||
public void setRoom(String room) {
|
||||
this.sessionId = room;
|
||||
setPartName(room);
|
||||
// setTitleImage(getImage());
|
||||
}
|
||||
|
||||
protected String getSessionImageName() {
|
||||
return SESSION_IMAGE_NAME;
|
||||
}
|
||||
|
||||
public void sendMessageAction() {
|
||||
sendMessageAction = new Action() {
|
||||
public void run() {
|
||||
sendMessage();
|
||||
}
|
||||
};
|
||||
// TODO this the image we want?
|
||||
sendMessageAction.setImageDescriptor(CollaborationUtils
|
||||
.getImageDescriptor("icon_show_advanced_prop.png"));
|
||||
sendMessageAction.setToolTipText("Send Message");
|
||||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
protected void createToolBar() {
|
||||
IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
|
||||
sendMessageAction();
|
||||
// switchDataProviderAction();
|
||||
// switchLeaderAction();
|
||||
// ActionContributionItem item = null;
|
||||
// item = new ActionContributionItem(switchDataProviderAction);
|
||||
// item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
// mgr.add(item);
|
||||
// item = new ActionContributionItem(switchLeaderAction);
|
||||
// item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
// mgr.add(switchLeaderAction);
|
||||
// // item = new ActionContributionItem(sendMessageAction);
|
||||
// // item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
|
||||
mgr.add(sendMessageAction);
|
||||
@Override
|
||||
public void partBroughtToTop(IWorkbenchPart part) {
|
||||
// TODO
|
||||
// if link with editor is on, need to activate the editor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partClosed(IWorkbenchPart part) {
|
||||
// TODO
|
||||
// here you need to end a session that is a temporary session
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partDeactivated(IWorkbenchPart part) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partOpened(IWorkbenchPart part) {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue