Merge "Issue #244 Localization of login data and removal of messanger and participant listeners." into 11-Collaboration
Former-commit-id:f74079fc42
[formerly4d32c5e078
] [formerlyd40b15acc2
] [formerlyd09c8a9383
[formerlyd40b15acc2
[formerly 9dc29b49a619cca5613e72858099029b4ffc724e]]] Former-commit-id:d09c8a9383
Former-commit-id: 178e1688c450a9e861bb089ca84a1c5258705ee0 [formerlyf95cba545b
] Former-commit-id:4a2d3cd071
This commit is contained in:
commit
40a55a68e8
6 changed files with 218 additions and 276 deletions
|
@ -156,8 +156,8 @@ public class CollaborationDataManager {
|
|||
DataUser user = CollaborationDataManager
|
||||
.getInstance().getUser(loginId);
|
||||
// TODO set mode and message here.
|
||||
user.setMode(loginData.getStatus());
|
||||
user.statusMessage = loginData.getMessage();
|
||||
user.setMode(loginData.getMode());
|
||||
user.statusMessage = loginData.getModeMessage();
|
||||
wbListener = new IWorkbenchListener() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -814,25 +814,26 @@ public class CollaborationGroupView extends ViewPart {
|
|||
.getSessionManager().getRosterManager();
|
||||
|
||||
IRoster roster = rosterManager.getRoster();
|
||||
|
||||
// System.out.println("rosterManager Name " /* +
|
||||
// roster.getUser().getName() */
|
||||
|
||||
String name = null;
|
||||
int rsize = -1;
|
||||
int gsize = -1;
|
||||
if(roster != null) {
|
||||
if(roster.getUser() != null) {
|
||||
if (roster != null) {
|
||||
if (roster.getUser() != null) {
|
||||
name = roster.getUser().getName();
|
||||
}
|
||||
if(roster.getEntries() != null) {
|
||||
if (roster.getEntries() != null) {
|
||||
rsize = roster.getEntries().size();
|
||||
}
|
||||
if(roster.getGroups() != null) {
|
||||
if (roster.getGroups() != null) {
|
||||
gsize = roster.getGroups().size();
|
||||
}
|
||||
System.out.println("rosterManager Name " + name
|
||||
+ ": group size " + gsize + ": entry size "
|
||||
+ rsize);
|
||||
System.out.println("rosterManager Name " + name + ": group size "
|
||||
+ gsize + ": entry size " + rsize);
|
||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||
if(rosterGroup != null) {
|
||||
if (rosterGroup != null) {
|
||||
populateGroup(topLevel, rosterGroup);
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +844,8 @@ public class CollaborationGroupView extends ViewPart {
|
|||
group.setLocal(true);
|
||||
group.setModifiable(true);
|
||||
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",
|
||||
"mnash@awipscm.omaha.us.ray.com" }) {
|
||||
CollaborationUser item = new CollaborationUser(u);
|
||||
|
@ -864,9 +866,8 @@ public class CollaborationGroupView extends ViewPart {
|
|||
item.setMode(Mode.AWAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CollaborationUser me = new CollaborationUser("OAX_rferrel");
|
||||
me.setMode(Mode.AVAILABLE);
|
||||
|
|
|
@ -63,17 +63,45 @@ public class CollaborationUtils {
|
|||
public static final IPresence.Mode[] statusModes = { Mode.AVAILABLE,
|
||||
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;
|
||||
URL url = FileLocator.find(Activator.getDefault().getBundle(),
|
||||
new Path(iconPath + string), null);
|
||||
new Path(iconPath + name), null);
|
||||
if (url != null && url.getFile() == null) {
|
||||
url = FileLocator.find(Activator.getDefault().getBundle(),
|
||||
new Path(".." + File.separator + iconPath + string), null);
|
||||
new Path(".." + File.separator + iconPath + name), null);
|
||||
}
|
||||
return ImageDescriptor.createFromURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an image associated with the node.
|
||||
*
|
||||
* @param node
|
||||
* @return image
|
||||
*/
|
||||
public static Image getNodeImage(CollaborationNode node) {
|
||||
Image nodeImage = null;
|
||||
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
|
||||
* and from a localized file.
|
||||
* Data class that provides log on information. All but the password may be
|
||||
* saved in a localized file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -57,26 +57,17 @@ public class LoginData implements ISerializableObject {
|
|||
private transient String password;
|
||||
|
||||
@XmlElement(name = "mode")
|
||||
private String status;
|
||||
private IPresence.Mode mode;
|
||||
|
||||
@XmlElement(name = "statusMessage")
|
||||
private String statusMessage;
|
||||
@XmlElement(name = "modeMessage")
|
||||
private String modeMessage;
|
||||
|
||||
public LoginData() {
|
||||
this.user = "";
|
||||
this.server = "";
|
||||
this.password = "";
|
||||
this.status = IPresence.Mode.AVAILABLE.name();
|
||||
}
|
||||
|
||||
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;
|
||||
this.mode = IPresence.Mode.AVAILABLE;
|
||||
this.modeMessage = "";
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
|
@ -91,25 +82,46 @@ public class LoginData implements ISerializableObject {
|
|||
password = null;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
public IPresence.Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return statusMessage;
|
||||
public String getModeMessage() {
|
||||
return modeMessage;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
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() {
|
||||
return "userId: \"" + user + "\", server \"" + server + "\", mode:\""
|
||||
+ status + "\", statusMessage: \"" + statusMessage + "\", pw: "
|
||||
+ mode.toString() + "\", modeMessage: \"" + modeMessage
|
||||
+ "\", pw: "
|
||||
+ ((password == null) ? "null" : password.length());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,13 @@ package com.raytheon.uf.viz.collaboration.ui.login;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
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.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.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
@ -60,6 +75,13 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
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 serverTF;
|
||||
|
@ -87,9 +109,9 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
setText("Collaboration Server Log On");
|
||||
}
|
||||
|
||||
public void setLoginData(LoginData loginData) {
|
||||
this.loginData = loginData;
|
||||
}
|
||||
// public void setLoginData(LoginData loginData) {
|
||||
// this.loginData = loginData;
|
||||
// }
|
||||
|
||||
private Control createDialogArea(Composite parent) {
|
||||
GridData gd = null;
|
||||
|
@ -214,12 +236,14 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
if (loginData != null) {
|
||||
userTF.setText(loginData.getUser());
|
||||
serverTF.setText(loginData.getServer());
|
||||
statusCombo.select(statusCombo.indexOf(loginData.getStatus()));
|
||||
messageTF.setText(loginData.getMessage());
|
||||
}
|
||||
initLoginData();
|
||||
userTF.setText(loginData.getUser());
|
||||
serverTF.setText(loginData.getServer());
|
||||
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
.getMode()));
|
||||
messageTF.setText(loginData.getModeMessage());
|
||||
userTF.selectAll();
|
||||
userTF.setFocus();
|
||||
}
|
||||
|
||||
|
@ -266,7 +290,6 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
button.setData(new Integer(id));
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
// buttonPressed(((Integer) event.widget.getData()).intValue());
|
||||
Integer val = (Integer) event.widget.getData();
|
||||
if (val != IDialogConstants.OK_ID) {
|
||||
setReturnValue(null);
|
||||
|
@ -277,6 +300,9 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
String user = userTF.getText().trim();
|
||||
String server = serverTF.getText().trim();
|
||||
String password = passwordTF.getText();
|
||||
IPresence.Mode mode = CollaborationUtils.statusModes[statusCombo
|
||||
.getSelectionIndex()];
|
||||
String modeMessage = messageTF.getText().trim();
|
||||
if (user.length() <= 0) {
|
||||
if (focusField == null) {
|
||||
focusField = userTF;
|
||||
|
@ -284,13 +310,13 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
errorMessages.add("Must enter a user.");
|
||||
userTF.setText("");
|
||||
}
|
||||
// if (server.length() <= 0) {
|
||||
// if (focusField == null) {
|
||||
// focusField = serverTF;
|
||||
// }
|
||||
// errorMessages.add("Must have a server.");
|
||||
// serverTF.setText("");
|
||||
// }
|
||||
if (server.length() <= 0) {
|
||||
if (focusField == null) {
|
||||
focusField = serverTF;
|
||||
}
|
||||
errorMessages.add("Must have a server.");
|
||||
serverTF.setText("");
|
||||
}
|
||||
|
||||
if (password.length() <= 0) {
|
||||
if (focusField == null) {
|
||||
|
@ -300,10 +326,32 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
passwordTF.setText("");
|
||||
}
|
||||
if (focusField == null) {
|
||||
loginData = new LoginData(user, server, password,
|
||||
CollaborationUtils.statusModes[statusCombo
|
||||
.getSelectionIndex()], messageTF
|
||||
.getText().trim());
|
||||
boolean doSaveLoginData = false;
|
||||
if (!loginData.getUser().equals(user)) {
|
||||
doSaveLoginData = true;
|
||||
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);
|
||||
LoginDialog.this.getShell().dispose();
|
||||
} else {
|
||||
|
@ -315,7 +363,7 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
}
|
||||
MessageBox messageBox = new MessageBox(event.widget
|
||||
.getDisplay().getActiveShell(), SWT.ERROR);
|
||||
messageBox.setText("Login in error");
|
||||
messageBox.setText("Log On Error");
|
||||
messageBox.setMessage(sb.toString());
|
||||
messageBox.open();
|
||||
event.doit = false;
|
||||
|
@ -333,4 +381,59 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
}
|
||||
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.ParticipantEventType;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationKeywords;
|
||||
|
@ -115,10 +112,6 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
protected Action chatAction;
|
||||
|
||||
protected IVenueParticipantListener participantListener;
|
||||
|
||||
protected IMessageListener messageListener;
|
||||
|
||||
public SessionView() {
|
||||
super();
|
||||
}
|
||||
|
@ -155,7 +148,6 @@ public class SessionView extends AbstractSessionView {
|
|||
.getActivePage()
|
||||
.showView(CollaborationSessionView.ID, session,
|
||||
IWorkbenchPage.VIEW_ACTIVATE);
|
||||
// }
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open chat", e);
|
||||
|
@ -202,7 +194,6 @@ public class SessionView extends AbstractSessionView {
|
|||
// manager.add(new Separator());
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void handleMessage(IMessage message) {
|
||||
final IMessage msg = message;
|
||||
|
@ -210,12 +201,12 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
addMessage(msg.getFrom().getName(),
|
||||
msg.getTimeStamp(), msg.getBody());
|
||||
addMessage(msg.getFrom().getName(), msg.getTimeStamp(),
|
||||
msg.getBody());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ties the view to a session.
|
||||
*
|
||||
|
@ -230,75 +221,7 @@ public class SessionView extends AbstractSessionView {
|
|||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
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);
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
.unRegisterEventHandler(this);
|
||||
|
@ -677,13 +485,15 @@ public class SessionView extends AbstractSessionView {
|
|||
if (message.length() > 0) {
|
||||
// CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
// .sendTextMessage(message);
|
||||
|
||||
|
||||
try {
|
||||
CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.sendTextMessage(message);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -715,15 +525,8 @@ public class SessionView extends AbstractSessionView {
|
|||
IVenueSession session = CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId);
|
||||
if (session != null) {
|
||||
// session.removeMessageListener(messageListener);
|
||||
// for (IMessageListener list : session.getMessageListeners()) {
|
||||
// session.removeMessageListener(list);
|
||||
// }
|
||||
// session.removeVenueParticipantListener(participantListener);
|
||||
session.unRegisterEventHandler(this);
|
||||
}
|
||||
// this.getViewSite().getWorkbenchWindow().getPartService()
|
||||
// .removePartListener(this);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -827,10 +630,7 @@ public class SessionView extends AbstractSessionView {
|
|||
@Subscribe
|
||||
public void participantHandler(IVenueParticipantEvent event)
|
||||
throws Exception {
|
||||
System.out.println("++ ParticipantHander type " + event.getEventType()
|
||||
// + ": presence " + event.getPresence() + ": participant "
|
||||
// + event.getParticipant());
|
||||
);
|
||||
System.out.println("++ ParticipantHander type " + event.getEventType());
|
||||
final ParticipantEventType type = event.getEventType();
|
||||
final IVenueParticipant participant = event.getParticipant();
|
||||
final IPresence presence = event.getPresence();
|
||||
|
@ -849,7 +649,7 @@ public class SessionView extends AbstractSessionView {
|
|||
participantPresenceUpdated(participant, presence);
|
||||
break;
|
||||
case UPDATED:
|
||||
System.out.println("++++ handle update here: "
|
||||
System.out.println("---- handle update here: "
|
||||
+ participant.getName());
|
||||
break;
|
||||
default:
|
||||
|
@ -860,8 +660,6 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
|
||||
private void participantArrived(IVenueParticipant participant) {
|
||||
// System.out
|
||||
// .println("++++ handle arrival here: " + participant.getName());
|
||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||
String name = participant.getName();
|
||||
for (CollaborationUser user : users) {
|
||||
|
@ -877,8 +675,8 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
|
||||
private void participantDeparted(IVenueParticipant participant) {
|
||||
// System.out.println("++++ handle departed here: "
|
||||
// + participant.getName());
|
||||
System.out.println("++++ handle departed here: "
|
||||
+ participant.getName());
|
||||
int index = -1;
|
||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||
String name = participant.getName();
|
||||
|
@ -902,8 +700,8 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
private void participantPresenceUpdated(IVenueParticipant participant,
|
||||
IPresence presence) {
|
||||
System.out.println("++++ handle presence here: " + presence.getMode()
|
||||
+ ": " + participant.getName());
|
||||
System.out.println("++++ handle presence updated here: "
|
||||
+ presence.getMode() + ": " + participant.getName());
|
||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
||||
String name = participant.getName();
|
||||
int index = -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue