diff options
3 files changed, 64 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java index 478209d76..c46ed7379 100644 --- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java +++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java @@ -32,9 +32,14 @@ public class Messages extends NLS { public static String MultiRosterView_ShowEmptyGroups; public static String MultiRosterView_AddContact; + public static String MessagesView_ClearChatLog; + public static String MessagesView_ClearChatLogDialogTitle; + public static String MessagesView_ClearChatLogDialogMessage; public static String MessagesView_ShowTimestamps; public static String MessagesView_CouldNotSendMessage; public static String MessagesView_TypingNotification; + public static String MessagesView_Copy; + public static String MessagesView_SelectAll; public static String AddContactDialog_DialogTitle; public static String AddContactDialog_UserID; diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties index c719f1409..d81c1b4d6 100644 --- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties +++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties @@ -25,9 +25,14 @@ MultiRosterView_ShowOffline = Show &Offline Contacts MultiRosterView_ShowEmptyGroups = Show &Empty Groups MultiRosterView_AddContact = &Add Contact +MessagesView_ClearChatLog = &Clear Chat Log +MessagesView_ClearChatLogDialogTitle = Clear Chat Log +MessagesView_ClearChatLogDialogMessage = Are you sure you wish to clear the chat log with {0}? MessagesView_ShowTimestamps = &Show Timestamps MessagesView_CouldNotSendMessage = The message could not be sent: {0} MessagesView_TypingNotification = {0} is typing a message... +MessagesView_Copy = &Copy +MessagesView_SelectAll = &Select All AddContactDialog_DialogTitle = Add Contact AddContactDialog_UserID = User ID: diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MessagesView.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MessagesView.java index ee5e02426..fa16552a7 100644 --- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MessagesView.java +++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MessagesView.java @@ -34,6 +34,7 @@ import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; @@ -54,6 +55,8 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.ISharedImages; @@ -129,6 +132,35 @@ public class MessagesView extends ViewPart { } }; timestampAction.setChecked(true); + IAction clearChatLogAction = new Action( + Messages.MessagesView_ClearChatLog) { + public void run() { + CTabItem item = tabFolder.getSelection(); + if (item != null) { + Iterator iterator = tabs.values().iterator(); + while (iterator.hasNext()) { + ChatTab tab = (ChatTab) iterator.next(); + if (tab.item == item) { + if (MessageDialog + .openConfirm( + tabFolder.getShell(), + Messages.MessagesView_ClearChatLogDialogTitle, + NLS + .bind( + Messages.MessagesView_ClearChatLogDialogMessage, + MessagesView + .getUserName(tab.remoteID)))) { + synchronized (tab) { + tab.chatText.setText(""); //$NON-NLS-1$ + } + } + return; + } + } + } + } + }; + manager.add(clearChatLogAction); manager.add(timestampAction); redColor = new Color(parent.getDisplay(), 255, 0, 0); @@ -406,6 +438,28 @@ public class MessagesView extends ViewPart { sash.setWeights(WEIGHTS); + Menu menu = new Menu(chatText); + MenuItem mi = new MenuItem(menu, SWT.PUSH); + mi.setText(Messages.MessagesView_Copy); + mi.setImage(PlatformUI.getWorkbench().getSharedImages().getImage( + org.eclipse.ui.ISharedImages.IMG_TOOL_COPY)); + mi.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String text = chatText.getSelectionText(); + if (!text.equals("")) { //$NON-NLS-1$ + chatText.copy(); + } + } + }); + mi = new MenuItem(menu, SWT.PUSH); + mi.setText(Messages.MessagesView_SelectAll); + mi.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + chatText.selectAll(); + } + }); + chatText.setMenu(menu); + IAction action = new Action(getUserName(remoteID) + '\t', IAction.AS_RADIO_BUTTON) { public void run() { |