Issue #639 added view for collaboration chat logs. added search control for logs, sessions, and chats
Former-commit-id:78e44746d6
[formerly78e44746d6
[formerly e72e6741925cff7821816daf208cf2a1da5229ce]] Former-commit-id:60276e49e8
Former-commit-id:66040f56b4
This commit is contained in:
parent
f5b7de2568
commit
2955e85a78
4 changed files with 104 additions and 11 deletions
|
@ -33,6 +33,14 @@
|
|||
icon="icons/browser.gif"
|
||||
name="Collaboration Information"
|
||||
restorable="false"/>
|
||||
<view
|
||||
allowMultiple="true"
|
||||
category="com.raytheon.viz.ui"
|
||||
class="com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchiveView"
|
||||
id="com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchiveView"
|
||||
icon="icons/browser.gif"
|
||||
name="Log Browser"
|
||||
restorable="false"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.commands">
|
||||
|
|
|
@ -87,6 +87,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.osgi.framework.Bundle;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -114,6 +115,8 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
|||
import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchive;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchiveView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
@ -152,6 +155,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
|
||||
private Action createSessionAction;
|
||||
|
||||
private Action createArchiveViewerAction;
|
||||
|
||||
private Action linkToEditorAction;
|
||||
|
||||
private Action inviteAction;
|
||||
|
@ -268,6 +273,52 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
// TODO store to preferences
|
||||
}
|
||||
};
|
||||
createArchiveViewerAction = new Action("View Log...") {
|
||||
@Override
|
||||
public void runWithEvent(Event event) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTreeViewer
|
||||
.getSelection();
|
||||
Object o = selection.getFirstElement();
|
||||
String sessionName = null;
|
||||
|
||||
if (o instanceof IRosterEntry) {
|
||||
IRosterEntry otherUser = (IRosterEntry) o;
|
||||
if (otherUser != null) {
|
||||
String id = otherUser.getUser().getID().getName();
|
||||
sessionName = id.substring(0, id.indexOf("@"));
|
||||
}
|
||||
}
|
||||
CollaborationConnection conn = CollaborationDataManager
|
||||
.getInstance().getCollaborationConnection(true);
|
||||
UserId user = conn.getUser();
|
||||
LocalizationFile logDir = SessionMsgArchive.getArchiveDir(
|
||||
user.getHost(), user.getName(), sessionName);
|
||||
|
||||
// SessionMsgArchiveDialog smad = new SessionMsgArchiveDialog(
|
||||
// Display.getCurrent().getActiveShell());
|
||||
// smad.setText("Message Log");
|
||||
// smad.open(logDir);
|
||||
|
||||
try {
|
||||
IViewPart vPart = PlatformUI
|
||||
.getWorkbench()
|
||||
.getActiveWorkbenchWindow()
|
||||
.getActivePage()
|
||||
.showView(
|
||||
"com.raytheon.uf.viz.collaboration.ui.session.SessionMsgArchiveView");
|
||||
((SessionMsgArchiveView) vPart).setDir(logDir);
|
||||
// vPart.setPartName(name);
|
||||
} catch (PartInitException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to open Collaboration Log View", e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
createArchiveViewerAction.setImageDescriptor(IconUtil
|
||||
.getImageDescriptor(bundle, "browser.gif"));
|
||||
createArchiveViewerAction.setEnabled(true);
|
||||
|
||||
linkToEditorAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
||||
bundle, "link_to_editor.gif"));
|
||||
// TODO pull from prefs
|
||||
|
@ -536,6 +587,7 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
mgr.add(changeStatusAction);
|
||||
mgr.add(changeStatusMessageAction);
|
||||
mgr.add(changePasswordAction);
|
||||
mgr.add(createArchiveViewerAction);
|
||||
mgr.add(new Separator());
|
||||
|
||||
// mgr.add(drawToolbarAction);
|
||||
|
@ -614,6 +666,7 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
usersTreeViewer.getTree().setEnabled(true);
|
||||
usersTreeViewer.refresh(topLevel, true);
|
||||
this.disableOrEnableSessionAction();
|
||||
createArchiveViewerAction.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,6 +741,7 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
return;
|
||||
} else if (o instanceof IVenueSession) {
|
||||
manager.add(joinAction);
|
||||
manager.add(createArchiveViewerAction);
|
||||
return;
|
||||
} else if (o instanceof UserId) {
|
||||
createMenu(manager);
|
||||
|
@ -732,6 +786,7 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
manager.add(createSessionAction);
|
||||
}
|
||||
manager.add(aliasAction);
|
||||
manager.add(createArchiveViewerAction);
|
||||
} else if (o instanceof IRosterGroup) {
|
||||
manager.add(createSessionAction);
|
||||
}
|
||||
|
@ -1344,15 +1399,15 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the Creation session button / menu option
|
||||
* depending on whether or not the user is connected to the
|
||||
* xmpp server.
|
||||
* Enables or disables the Creation session button / menu option depending
|
||||
* on whether or not the user is connected to the xmpp server.
|
||||
*/
|
||||
private void disableOrEnableSessionAction() {
|
||||
final boolean isSessionEnabled = CollaborationDataManager.getInstance().isConnected();
|
||||
final boolean isSessionEnabled = CollaborationDataManager.getInstance()
|
||||
.isConnected();
|
||||
createSessionAction.setEnabled(isSessionEnabled);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds users to groups if necessary
|
||||
*
|
||||
|
|
|
@ -120,6 +120,8 @@ public abstract class AbstractSessionView extends CaveFloatingView {
|
|||
|
||||
private Map<RGB, Color> colors = null;
|
||||
|
||||
private SearchComposite searchComp;
|
||||
|
||||
protected abstract String getSessionImageName();
|
||||
|
||||
protected abstract String getSessionName();
|
||||
|
@ -171,6 +173,10 @@ public abstract class AbstractSessionView extends CaveFloatingView {
|
|||
GridLayout layout = new GridLayout(1, false);
|
||||
messagesComp.setLayout(layout);
|
||||
setMessageLabel(messagesComp);
|
||||
|
||||
searchComp = new SearchComposite(messagesComp, SWT.BORDER);
|
||||
searchComp.hide(true);
|
||||
|
||||
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));
|
||||
|
@ -184,6 +190,8 @@ public abstract class AbstractSessionView extends CaveFloatingView {
|
|||
composeText.setFocus();
|
||||
}
|
||||
});
|
||||
messagesComp.addKeyListener(searchComp.getSearchKeyListener());
|
||||
searchComp.setDefaultSearchView(messagesText);
|
||||
}
|
||||
|
||||
protected void createComposeComp(Composite parent) {
|
||||
|
@ -217,6 +225,9 @@ public abstract class AbstractSessionView extends CaveFloatingView {
|
|||
if (e.keyCode == SWT.SHIFT) {
|
||||
keyPressed = true;
|
||||
}
|
||||
if (searchComp != null) {
|
||||
searchComp.search(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -370,6 +381,7 @@ public abstract class AbstractSessionView extends CaveFloatingView {
|
|||
msgArchive = getMessageArchive();
|
||||
}
|
||||
msgArchive.archive(sb.toString());
|
||||
searchComp.appendText(sb.toString());
|
||||
}
|
||||
|
||||
protected abstract void styleAndAppendText(StringBuilder sb, int offset,
|
||||
|
|
|
@ -61,9 +61,6 @@ public class SessionMsgArchive {
|
|||
private StringBuffer log;
|
||||
|
||||
public SessionMsgArchive(String hostName, String userId, String sessionName) {
|
||||
String logFilePath = LOG_DIR + IPathManager.SEPARATOR + hostName
|
||||
+ IPathManager.SEPARATOR + userId + IPathManager.SEPARATOR
|
||||
+ sessionName;
|
||||
Calendar gmtTimestamp = Calendar.getInstance(TimeZone
|
||||
.getTimeZone("GMT"));
|
||||
String logFileName = new SimpleDateFormat("yyyy-MM-dd.hhmmss")
|
||||
|
@ -72,11 +69,32 @@ public class SessionMsgArchive {
|
|||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.USER);
|
||||
logFile = pm.getLocalizationFile(ctx, logFilePath
|
||||
+ IPathManager.SEPARATOR + logFileName);
|
||||
logFile = pm.getLocalizationFile(ctx,
|
||||
getLogFilePath(hostName, userId, sessionName)
|
||||
+ IPathManager.SEPARATOR + logFileName);
|
||||
log = new StringBuffer();
|
||||
}
|
||||
|
||||
private static String getLogFilePath(String hostName, String userId,
|
||||
String sessionName) {
|
||||
return LOG_DIR
|
||||
+ IPathManager.SEPARATOR
|
||||
+ hostName
|
||||
+ IPathManager.SEPARATOR
|
||||
+ userId
|
||||
+ (sessionName == null ? "" : IPathManager.SEPARATOR
|
||||
+ sessionName);
|
||||
}
|
||||
|
||||
public static LocalizationFile getArchiveDir(String hostName,
|
||||
String userId, String sessionName) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.USER);
|
||||
return pm.getLocalizationFile(ctx,
|
||||
getLogFilePath(hostName, userId, sessionName));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
// Write log contents to logFile
|
||||
try {
|
||||
|
@ -88,6 +106,6 @@ public class SessionMsgArchive {
|
|||
}
|
||||
|
||||
public void archive(String string) {
|
||||
log.append(string).append('\n');
|
||||
log.append(string);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue