Issue #244 Localization of login data and removal of messanger and participant listeners.
Change-Id: I247199030152575c82b8320fa0cbdeddb62fa662 Former-commit-id:05c5b5339d
[formerlydf5a2662ba
] [formerlyb180f9b45e
] [formerly05c5b5339d
[formerlydf5a2662ba
] [formerlyb180f9b45e
] [formerly95d8d85fd0
[formerlyb180f9b45e
[formerly 4e4a705b98070d2e671133e6acc29dc72617505a]]]] Former-commit-id:95d8d85fd0
Former-commit-id:9d523d8366
[formerlyc132fbf641
] [formerly 90b8c63352a86a05c76f20466c3ca0e3dd390d83 [formerly8f75dd68de
]] Former-commit-id: 55b593bebab15bdffba13c00ef7e1c57d05fac2f [formerlyc06762598e
] Former-commit-id:cca7866880
This commit is contained in:
parent
e1e8d6c091
commit
d9b1d1715c
6 changed files with 218 additions and 276 deletions
|
@ -156,8 +156,8 @@ public class CollaborationDataManager {
|
||||||
DataUser user = CollaborationDataManager
|
DataUser user = CollaborationDataManager
|
||||||
.getInstance().getUser(loginId);
|
.getInstance().getUser(loginId);
|
||||||
// TODO set mode and message here.
|
// TODO set mode and message here.
|
||||||
user.setMode(loginData.getStatus());
|
user.setMode(loginData.getMode());
|
||||||
user.statusMessage = loginData.getMessage();
|
user.statusMessage = loginData.getModeMessage();
|
||||||
wbListener = new IWorkbenchListener() {
|
wbListener = new IWorkbenchListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -814,25 +814,26 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
.getSessionManager().getRosterManager();
|
.getSessionManager().getRosterManager();
|
||||||
|
|
||||||
IRoster roster = rosterManager.getRoster();
|
IRoster roster = rosterManager.getRoster();
|
||||||
|
// System.out.println("rosterManager Name " /* +
|
||||||
|
// roster.getUser().getName() */
|
||||||
|
|
||||||
String name = null;
|
String name = null;
|
||||||
int rsize = -1;
|
int rsize = -1;
|
||||||
int gsize = -1;
|
int gsize = -1;
|
||||||
if(roster != null) {
|
if (roster != null) {
|
||||||
if(roster.getUser() != null) {
|
if (roster.getUser() != null) {
|
||||||
name = roster.getUser().getName();
|
name = roster.getUser().getName();
|
||||||
}
|
}
|
||||||
if(roster.getEntries() != null) {
|
if (roster.getEntries() != null) {
|
||||||
rsize = roster.getEntries().size();
|
rsize = roster.getEntries().size();
|
||||||
}
|
}
|
||||||
if(roster.getGroups() != null) {
|
if (roster.getGroups() != null) {
|
||||||
gsize = roster.getGroups().size();
|
gsize = roster.getGroups().size();
|
||||||
}
|
}
|
||||||
System.out.println("rosterManager Name " + name
|
System.out.println("rosterManager Name " + name + ": group size "
|
||||||
+ ": group size " + gsize + ": entry size "
|
+ gsize + ": entry size " + rsize);
|
||||||
+ rsize);
|
|
||||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||||
if(rosterGroup != null) {
|
if (rosterGroup != null) {
|
||||||
populateGroup(topLevel, rosterGroup);
|
populateGroup(topLevel, rosterGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,7 +844,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
group.setLocal(true);
|
group.setLocal(true);
|
||||||
group.setModifiable(true);
|
group.setModifiable(true);
|
||||||
topLevel.addChild(group);
|
topLevel.addChild(group);
|
||||||
for (String u : new String[] { "jkorman@awipscm.omaha.us.ray.com",
|
for (String u : new String[] {
|
||||||
|
"jkorman@awipscm.omaha.us.ray.com",
|
||||||
"abc@awipscm.omaha.us.ray.com",
|
"abc@awipscm.omaha.us.ray.com",
|
||||||
"mnash@awipscm.omaha.us.ray.com" }) {
|
"mnash@awipscm.omaha.us.ray.com" }) {
|
||||||
CollaborationUser item = new CollaborationUser(u);
|
CollaborationUser item = new CollaborationUser(u);
|
||||||
|
@ -864,9 +866,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
item.setMode(Mode.AWAY);
|
item.setMode(Mode.AWAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
||||||
me.setMode(Mode.AVAILABLE);
|
me.setMode(Mode.AVAILABLE);
|
||||||
|
|
|
@ -63,17 +63,45 @@ public class CollaborationUtils {
|
||||||
public static final IPresence.Mode[] statusModes = { Mode.AVAILABLE,
|
public static final IPresence.Mode[] statusModes = { Mode.AVAILABLE,
|
||||||
Mode.DND, Mode.AWAY };
|
Mode.DND, Mode.AWAY };
|
||||||
|
|
||||||
public static ImageDescriptor getImageDescriptor(String string) {
|
/**
|
||||||
|
* Get the statusModes' index for desired mode.
|
||||||
|
*
|
||||||
|
* @param mode
|
||||||
|
* @return index - the mode's index or -1 if not in statusModes
|
||||||
|
*/
|
||||||
|
public static int statusModesIndex(IPresence.Mode mode) {
|
||||||
|
for (int index = 0; index < statusModes.length; ++index) {
|
||||||
|
if (mode.equals(statusModes[index])) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an descriptor for the file in the icon directory.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* - file name
|
||||||
|
* @return imageDescriptor
|
||||||
|
*/
|
||||||
|
public static ImageDescriptor getImageDescriptor(String name) {
|
||||||
String iconPath = "icons" + File.separator;
|
String iconPath = "icons" + File.separator;
|
||||||
URL url = FileLocator.find(Activator.getDefault().getBundle(),
|
URL url = FileLocator.find(Activator.getDefault().getBundle(),
|
||||||
new Path(iconPath + string), null);
|
new Path(iconPath + name), null);
|
||||||
if (url != null && url.getFile() == null) {
|
if (url != null && url.getFile() == null) {
|
||||||
url = FileLocator.find(Activator.getDefault().getBundle(),
|
url = FileLocator.find(Activator.getDefault().getBundle(),
|
||||||
new Path(".." + File.separator + iconPath + string), null);
|
new Path(".." + File.separator + iconPath + name), null);
|
||||||
}
|
}
|
||||||
return ImageDescriptor.createFromURL(url);
|
return ImageDescriptor.createFromURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an image associated with the node.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @return image
|
||||||
|
*/
|
||||||
public static Image getNodeImage(CollaborationNode node) {
|
public static Image getNodeImage(CollaborationNode node) {
|
||||||
Image nodeImage = null;
|
Image nodeImage = null;
|
||||||
if (node instanceof CollaborationUser) {
|
if (node instanceof CollaborationUser) {
|
||||||
|
|
|
@ -29,8 +29,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data class that provides logon information. All but the password may be saved
|
* Data class that provides log on information. All but the password may be
|
||||||
* and from a localized file.
|
* saved in a localized file.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -57,26 +57,17 @@ public class LoginData implements ISerializableObject {
|
||||||
private transient String password;
|
private transient String password;
|
||||||
|
|
||||||
@XmlElement(name = "mode")
|
@XmlElement(name = "mode")
|
||||||
private String status;
|
private IPresence.Mode mode;
|
||||||
|
|
||||||
@XmlElement(name = "statusMessage")
|
@XmlElement(name = "modeMessage")
|
||||||
private String statusMessage;
|
private String modeMessage;
|
||||||
|
|
||||||
public LoginData() {
|
public LoginData() {
|
||||||
this.user = "";
|
this.user = "";
|
||||||
this.server = "";
|
this.server = "";
|
||||||
this.password = "";
|
this.password = "";
|
||||||
this.status = IPresence.Mode.AVAILABLE.name();
|
this.mode = IPresence.Mode.AVAILABLE;
|
||||||
}
|
this.modeMessage = "";
|
||||||
|
|
||||||
public LoginData(final String user, final String server,
|
|
||||||
final String password, final IPresence.Mode status,
|
|
||||||
final String statusMessage) {
|
|
||||||
this.user = user;
|
|
||||||
this.server = server;
|
|
||||||
this.password = password;
|
|
||||||
this.status = status.name();
|
|
||||||
this.statusMessage = statusMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser() {
|
public String getUser() {
|
||||||
|
@ -91,25 +82,46 @@ public class LoginData implements ISerializableObject {
|
||||||
password = null;
|
password = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
public IPresence.Mode getMode() {
|
||||||
return status;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServer() {
|
public String getServer() {
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getModeMessage() {
|
||||||
return statusMessage;
|
return modeMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccount() {
|
public String getAccount() {
|
||||||
return user + "@" + server;
|
return user + "@" + server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUser(String user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServer(String server) {
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(IPresence.Mode mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModeMessage(String statusMessage) {
|
||||||
|
this.modeMessage = statusMessage;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "userId: \"" + user + "\", server \"" + server + "\", mode:\""
|
return "userId: \"" + user + "\", server \"" + server + "\", mode:\""
|
||||||
+ status + "\", statusMessage: \"" + statusMessage + "\", pw: "
|
+ mode.toString() + "\", modeMessage: \"" + modeMessage
|
||||||
|
+ "\", pw: "
|
||||||
+ ((password == null) ? "null" : password.length());
|
+ ((password == null) ? "null" : password.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,13 @@ package com.raytheon.uf.viz.collaboration.ui.login;
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXB;
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -39,8 +43,19 @@ import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
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.common.localization.exception.LocalizationException;
|
||||||
|
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.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||||
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,6 +75,13 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class LoginDialog extends CaveSWTDialog {
|
public class LoginDialog extends CaveSWTDialog {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(LoginDialog.class);
|
||||||
|
|
||||||
|
private static final String LOGIN_FILE_NAME = "collaboration"
|
||||||
|
+ File.separator + "config" + File.separator + "gui"
|
||||||
|
+ File.separator + "LoginData.xml";
|
||||||
|
|
||||||
private Text userTF;
|
private Text userTF;
|
||||||
|
|
||||||
private Text serverTF;
|
private Text serverTF;
|
||||||
|
@ -87,9 +109,9 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
setText("Collaboration Server Log On");
|
setText("Collaboration Server Log On");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginData(LoginData loginData) {
|
// public void setLoginData(LoginData loginData) {
|
||||||
this.loginData = loginData;
|
// this.loginData = loginData;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private Control createDialogArea(Composite parent) {
|
private Control createDialogArea(Composite parent) {
|
||||||
GridData gd = null;
|
GridData gd = null;
|
||||||
|
@ -214,12 +236,14 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
@Override
|
@Override
|
||||||
protected void preOpened() {
|
protected void preOpened() {
|
||||||
super.preOpened();
|
super.preOpened();
|
||||||
if (loginData != null) {
|
initLoginData();
|
||||||
userTF.setText(loginData.getUser());
|
userTF.setText(loginData.getUser());
|
||||||
serverTF.setText(loginData.getServer());
|
serverTF.setText(loginData.getServer());
|
||||||
statusCombo.select(statusCombo.indexOf(loginData.getStatus()));
|
|
||||||
messageTF.setText(loginData.getMessage());
|
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||||
}
|
.getMode()));
|
||||||
|
messageTF.setText(loginData.getModeMessage());
|
||||||
|
userTF.selectAll();
|
||||||
userTF.setFocus();
|
userTF.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +290,6 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
button.setData(new Integer(id));
|
button.setData(new Integer(id));
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
// buttonPressed(((Integer) event.widget.getData()).intValue());
|
|
||||||
Integer val = (Integer) event.widget.getData();
|
Integer val = (Integer) event.widget.getData();
|
||||||
if (val != IDialogConstants.OK_ID) {
|
if (val != IDialogConstants.OK_ID) {
|
||||||
setReturnValue(null);
|
setReturnValue(null);
|
||||||
|
@ -277,6 +300,9 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
String user = userTF.getText().trim();
|
String user = userTF.getText().trim();
|
||||||
String server = serverTF.getText().trim();
|
String server = serverTF.getText().trim();
|
||||||
String password = passwordTF.getText();
|
String password = passwordTF.getText();
|
||||||
|
IPresence.Mode mode = CollaborationUtils.statusModes[statusCombo
|
||||||
|
.getSelectionIndex()];
|
||||||
|
String modeMessage = messageTF.getText().trim();
|
||||||
if (user.length() <= 0) {
|
if (user.length() <= 0) {
|
||||||
if (focusField == null) {
|
if (focusField == null) {
|
||||||
focusField = userTF;
|
focusField = userTF;
|
||||||
|
@ -284,13 +310,13 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
errorMessages.add("Must enter a user.");
|
errorMessages.add("Must enter a user.");
|
||||||
userTF.setText("");
|
userTF.setText("");
|
||||||
}
|
}
|
||||||
// if (server.length() <= 0) {
|
if (server.length() <= 0) {
|
||||||
// if (focusField == null) {
|
if (focusField == null) {
|
||||||
// focusField = serverTF;
|
focusField = serverTF;
|
||||||
// }
|
}
|
||||||
// errorMessages.add("Must have a server.");
|
errorMessages.add("Must have a server.");
|
||||||
// serverTF.setText("");
|
serverTF.setText("");
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (password.length() <= 0) {
|
if (password.length() <= 0) {
|
||||||
if (focusField == null) {
|
if (focusField == null) {
|
||||||
|
@ -300,10 +326,32 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
passwordTF.setText("");
|
passwordTF.setText("");
|
||||||
}
|
}
|
||||||
if (focusField == null) {
|
if (focusField == null) {
|
||||||
loginData = new LoginData(user, server, password,
|
boolean doSaveLoginData = false;
|
||||||
CollaborationUtils.statusModes[statusCombo
|
if (!loginData.getUser().equals(user)) {
|
||||||
.getSelectionIndex()], messageTF
|
doSaveLoginData = true;
|
||||||
.getText().trim());
|
loginData.setUser(user);
|
||||||
|
}
|
||||||
|
if (!loginData.getServer().equals(server)) {
|
||||||
|
doSaveLoginData = true;
|
||||||
|
loginData.setServer(server);
|
||||||
|
}
|
||||||
|
loginData.setPassword(password);
|
||||||
|
if (!loginData.getMode().equals(mode)) {
|
||||||
|
doSaveLoginData = true;
|
||||||
|
loginData.setMode(mode);
|
||||||
|
}
|
||||||
|
if (!loginData.getModeMessage().equals(modeMessage)) {
|
||||||
|
doSaveLoginData = true;
|
||||||
|
loginData.setModeMessage(modeMessage);
|
||||||
|
}
|
||||||
|
if (doSaveLoginData) {
|
||||||
|
saveLoginData();
|
||||||
|
}
|
||||||
|
|
||||||
|
// loginData = new LoginData(user, server, password,
|
||||||
|
// CollaborationUtils.statusModes[statusCombo
|
||||||
|
// .getSelectionIndex()], messageTF
|
||||||
|
// .getText().trim());
|
||||||
setReturnValue(loginData);
|
setReturnValue(loginData);
|
||||||
LoginDialog.this.getShell().dispose();
|
LoginDialog.this.getShell().dispose();
|
||||||
} else {
|
} else {
|
||||||
|
@ -315,7 +363,7 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
MessageBox messageBox = new MessageBox(event.widget
|
MessageBox messageBox = new MessageBox(event.widget
|
||||||
.getDisplay().getActiveShell(), SWT.ERROR);
|
.getDisplay().getActiveShell(), SWT.ERROR);
|
||||||
messageBox.setText("Login in error");
|
messageBox.setText("Log On Error");
|
||||||
messageBox.setMessage(sb.toString());
|
messageBox.setMessage(sb.toString());
|
||||||
messageBox.open();
|
messageBox.open();
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
|
@ -333,4 +381,59 @@ public class LoginDialog extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initLoginData() {
|
||||||
|
loginData = null;
|
||||||
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
|
File fname = pm.getStaticFile(LOGIN_FILE_NAME);
|
||||||
|
try {
|
||||||
|
if (fname != null) {
|
||||||
|
loginData = JAXB.unmarshal(fname, LoginData.class);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
} finally {
|
||||||
|
if (loginData == null) {
|
||||||
|
loginData = new LoginData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveLoginData() {
|
||||||
|
try {
|
||||||
|
LocalizationFile lFile = getFile(LOGIN_FILE_NAME);
|
||||||
|
File file = lFile.getFile(false);
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
JAXB.marshal(loginData, file);
|
||||||
|
lFile.save();
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM, ex.getLocalizedMessage(), ex);
|
||||||
|
} catch (LocalizationException e) {
|
||||||
|
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains a localization file for desired file name.
|
||||||
|
*
|
||||||
|
* @param filename
|
||||||
|
* @return lFile
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
private LocalizationFile getFile(String filename)
|
||||||
|
throws FileNotFoundException {
|
||||||
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
|
LocalizationContext context = pm.getContext(
|
||||||
|
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||||
|
LocalizationFile lFile = pm.getLocalizationFile(context, filename);
|
||||||
|
if (lFile == null) {
|
||||||
|
String user = LocalizationManager.getInstance().getCurrentUser();
|
||||||
|
throw new FileNotFoundException("Unable to find \"" + filename
|
||||||
|
+ "\" under the directory for user " + user + ".");
|
||||||
|
|
||||||
|
}
|
||||||
|
return lFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageFilter;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IMessageListener;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IVenueParticipantListener;
|
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
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.CollaborationDataManager;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationKeywords;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationKeywords;
|
||||||
|
@ -115,10 +112,6 @@ public class SessionView extends AbstractSessionView {
|
||||||
|
|
||||||
protected Action chatAction;
|
protected Action chatAction;
|
||||||
|
|
||||||
protected IVenueParticipantListener participantListener;
|
|
||||||
|
|
||||||
protected IMessageListener messageListener;
|
|
||||||
|
|
||||||
public SessionView() {
|
public SessionView() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +148,6 @@ public class SessionView extends AbstractSessionView {
|
||||||
.getActivePage()
|
.getActivePage()
|
||||||
.showView(CollaborationSessionView.ID, session,
|
.showView(CollaborationSessionView.ID, session,
|
||||||
IWorkbenchPage.VIEW_ACTIVATE);
|
IWorkbenchPage.VIEW_ACTIVATE);
|
||||||
// }
|
|
||||||
} catch (PartInitException e) {
|
} catch (PartInitException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Unable to open chat", e);
|
"Unable to open chat", e);
|
||||||
|
@ -202,7 +194,6 @@ public class SessionView extends AbstractSessionView {
|
||||||
// manager.add(new Separator());
|
// manager.add(new Separator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handleMessage(IMessage message) {
|
public void handleMessage(IMessage message) {
|
||||||
final IMessage msg = message;
|
final IMessage msg = message;
|
||||||
|
@ -210,12 +201,12 @@ public class SessionView extends AbstractSessionView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
addMessage(msg.getFrom().getName(),
|
addMessage(msg.getFrom().getName(), msg.getTimeStamp(),
|
||||||
msg.getTimeStamp(), msg.getBody());
|
msg.getBody());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ties the view to a session.
|
* Ties the view to a session.
|
||||||
*
|
*
|
||||||
|
@ -230,75 +221,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
IVenueSession session = CollaborationDataManager.getInstance()
|
IVenueSession session = CollaborationDataManager.getInstance()
|
||||||
.getSession(sessionId);
|
.getSession(sessionId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
messageListener = new IMessageListener() {
|
|
||||||
|
|
||||||
@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 boolean filter(IMessage message) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
session.registerEventHandler(this);
|
session.registerEventHandler(this);
|
||||||
// participantListener = new IVenueParticipantListener() {
|
|
||||||
// @Override
|
|
||||||
// public void handleUpdated(IVenueParticipant participant) {
|
|
||||||
// System.out.println("updated");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void handlePresenceUpdated(IVenueParticipant fromID,
|
|
||||||
// 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.setMode(presence.getMode());
|
|
||||||
// user.setText(user.getId());
|
|
||||||
// users.add(user);
|
|
||||||
// }
|
|
||||||
// VizApp.runAsync(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// usersTable.setInput(users
|
|
||||||
// .toArray(new CollaborationUser[users.size()]));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void handleDeparted(IVenueParticipant participant) {
|
|
||||||
// System.out.println("goodbye");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void handleArrived(IVenueParticipant participant) {
|
|
||||||
// System.out.println("you've got mail");
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// session.addVenueParticipantListener(participantListener);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,123 +376,8 @@ public class SessionView extends AbstractSessionView {
|
||||||
((GridData) usersComp.getLayoutData()).exclude = true;
|
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected void createMessagesComp(Composite parent) {
|
|
||||||
// Composite messagesComp = new Composite(parent, SWT.NONE);
|
|
||||||
// GridLayout layout = new GridLayout(1, false);
|
|
||||||
// messagesComp.setLayout(layout);
|
|
||||||
// // TODO, wrap label in view
|
|
||||||
// Label label = new Label(messagesComp, SWT.WRAP);
|
|
||||||
//
|
|
||||||
// StringBuilder labelInfo = new StringBuilder();
|
|
||||||
// IVenueSession session = CollaborationDataManager.getInstance()
|
|
||||||
// .getSession(sessionId);
|
|
||||||
// if (session != null) {
|
|
||||||
// IVenueInfo info = session.getVenue().getInfo();
|
|
||||||
// labelInfo.append(info.getVenueSubject());
|
|
||||||
// label.setToolTipText(info.getVenueSubject());
|
|
||||||
// }
|
|
||||||
// messagesText = new StyledText(messagesComp, SWT.MULTI | SWT.WRAP
|
|
||||||
// | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
|
||||||
// messagesText.setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
||||||
//
|
|
||||||
// if (session == null) {
|
|
||||||
// labelInfo.append("There is no active session.");
|
|
||||||
// label.setEnabled(false);
|
|
||||||
// messagesText.setEnabled(false);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// label.setText(labelInfo.toString());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// protected void createComposeComp(Composite parent) {
|
|
||||||
// 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:");
|
|
||||||
// composeText = new StyledText(composeComp, SWT.MULTI | SWT.WRAP
|
|
||||||
// | 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;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void keyReleased(KeyEvent e) {
|
|
||||||
// if (e.keyCode == SWT.SHIFT) {
|
|
||||||
// keyPressed = false;
|
|
||||||
// }
|
|
||||||
// // do nothing, all done on key pressed
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void keyPressed(KeyEvent e) {
|
|
||||||
// if (!keyPressed
|
|
||||||
// && (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR)) {
|
|
||||||
// sendMessage();
|
|
||||||
// }
|
|
||||||
// if (e.keyCode == SWT.SHIFT) {
|
|
||||||
// keyPressed = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// composeText.addFocusListener(new FocusListener() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void focusLost(FocusEvent e) {
|
|
||||||
// // Restore other perspective's key bindings.
|
|
||||||
// VizPerspectiveListener.getCurrentPerspectiveManager()
|
|
||||||
// .activateContexts();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void focusGained(FocusEvent e) {
|
|
||||||
// // Remove other perspective's key bindings.
|
|
||||||
// VizPerspectiveListener.getCurrentPerspectiveManager()
|
|
||||||
// .deactivateContexts();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// IVenueSession session = CollaborationDataManager.getInstance()
|
|
||||||
// .getSession(sessionId);
|
|
||||||
// if (session == null) {
|
|
||||||
// composeComp.setEnabled(false);
|
|
||||||
// composeText.setEnabled(false);
|
|
||||||
// label.setEnabled(false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private Image getImage() {
|
|
||||||
// Image image = imageMap.get(SESSION_IMAGE_KEY);
|
|
||||||
// if (image == null) {
|
|
||||||
// image = CollaborationUtils
|
|
||||||
// .getImageDescriptor(getSessionImageName()).createImage();
|
|
||||||
// if (image != null) {
|
|
||||||
// imageMap.put(SESSION_IMAGE_KEY, image);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return image;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// if (messageListener != null) {
|
|
||||||
// CollaborationDataManager.getInstance().getSession(sessionId)
|
|
||||||
// .removeMessageListener(messageListener);
|
|
||||||
// }
|
|
||||||
// for (Image im : imageMap.values()) {
|
|
||||||
// im.dispose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// imageMap.clear();
|
|
||||||
// imageMap = null;
|
|
||||||
|
|
||||||
// if (participantListener != null) {
|
|
||||||
// CollaborationDataManager.getInstance().getSession(sessionId)
|
|
||||||
// .removeVenueParticipantListener(participantListener);
|
|
||||||
// }
|
|
||||||
|
|
||||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||||
.unRegisterEventHandler(this);
|
.unRegisterEventHandler(this);
|
||||||
|
@ -677,13 +485,15 @@ public class SessionView extends AbstractSessionView {
|
||||||
if (message.length() > 0) {
|
if (message.length() > 0) {
|
||||||
// CollaborationDataManager.getInstance().getSession(sessionId)
|
// CollaborationDataManager.getInstance().getSession(sessionId)
|
||||||
// .sendTextMessage(message);
|
// .sendTextMessage(message);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||||
.sendTextMessage(message);
|
.sendTextMessage(message);
|
||||||
} catch (CollaborationException e) {
|
} catch (CollaborationException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
// TODO Auto-generated catch block. Please revise as
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
// appropriate.
|
||||||
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -715,15 +525,8 @@ public class SessionView extends AbstractSessionView {
|
||||||
IVenueSession session = CollaborationDataManager.getInstance()
|
IVenueSession session = CollaborationDataManager.getInstance()
|
||||||
.getSession(sessionId);
|
.getSession(sessionId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
// session.removeMessageListener(messageListener);
|
|
||||||
// for (IMessageListener list : session.getMessageListeners()) {
|
|
||||||
// session.removeMessageListener(list);
|
|
||||||
// }
|
|
||||||
// session.removeVenueParticipantListener(participantListener);
|
|
||||||
session.unRegisterEventHandler(this);
|
session.unRegisterEventHandler(this);
|
||||||
}
|
}
|
||||||
// this.getViewSite().getWorkbenchWindow().getPartService()
|
|
||||||
// .removePartListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -827,10 +630,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void participantHandler(IVenueParticipantEvent event)
|
public void participantHandler(IVenueParticipantEvent event)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
System.out.println("++ ParticipantHander type " + event.getEventType()
|
System.out.println("++ ParticipantHander type " + event.getEventType());
|
||||||
// + ": presence " + event.getPresence() + ": participant "
|
|
||||||
// + event.getParticipant());
|
|
||||||
);
|
|
||||||
final ParticipantEventType type = event.getEventType();
|
final ParticipantEventType type = event.getEventType();
|
||||||
final IVenueParticipant participant = event.getParticipant();
|
final IVenueParticipant participant = event.getParticipant();
|
||||||
final IPresence presence = event.getPresence();
|
final IPresence presence = event.getPresence();
|
||||||
|
@ -849,7 +649,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
participantPresenceUpdated(participant, presence);
|
participantPresenceUpdated(participant, presence);
|
||||||
break;
|
break;
|
||||||
case UPDATED:
|
case UPDATED:
|
||||||
System.out.println("++++ handle update here: "
|
System.out.println("---- handle update here: "
|
||||||
+ participant.getName());
|
+ participant.getName());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -860,8 +660,6 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void participantArrived(IVenueParticipant participant) {
|
private void participantArrived(IVenueParticipant participant) {
|
||||||
// System.out
|
|
||||||
// .println("++++ handle arrival here: " + participant.getName());
|
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||||
String name = participant.getName();
|
String name = participant.getName();
|
||||||
for (CollaborationUser user : users) {
|
for (CollaborationUser user : users) {
|
||||||
|
@ -877,8 +675,8 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void participantDeparted(IVenueParticipant participant) {
|
private void participantDeparted(IVenueParticipant participant) {
|
||||||
// System.out.println("++++ handle departed here: "
|
System.out.println("++++ handle departed here: "
|
||||||
// + participant.getName());
|
+ participant.getName());
|
||||||
int index = -1;
|
int index = -1;
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||||
String name = participant.getName();
|
String name = participant.getName();
|
||||||
|
@ -902,8 +700,8 @@ public class SessionView extends AbstractSessionView {
|
||||||
|
|
||||||
private void participantPresenceUpdated(IVenueParticipant participant,
|
private void participantPresenceUpdated(IVenueParticipant participant,
|
||||||
IPresence presence) {
|
IPresence presence) {
|
||||||
System.out.println("++++ handle presence here: " + presence.getMode()
|
System.out.println("++++ handle presence updated here: "
|
||||||
+ ": " + participant.getName());
|
+ presence.getMode() + ": " + participant.getName());
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||||
String name = participant.getName();
|
String name = participant.getName();
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue