Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaniszczyk2007-07-27 15:11:23 +0000
committercaniszczyk2007-07-27 15:11:23 +0000
commite74d20462af8be2424deb1699cc7739eb54335c8 (patch)
treeff877cd3beb8729694cf9a5f0cc32b1b04162a3d /providers/bundles/org.eclipse.ecf.provider.irc.ui
parentc777e8f5e3e2f82265eaf0083dfdc4db038fbeb3 (diff)
downloadorg.eclipse.ecf-e74d20462af8be2424deb1699cc7739eb54335c8.tar.gz
org.eclipse.ecf-e74d20462af8be2424deb1699cc7739eb54335c8.tar.xz
org.eclipse.ecf-e74d20462af8be2424deb1699cc7739eb54335c8.zip
RESOLVED - bug 197329: [IRC] Action should be supported better in the UI
https://bugs.eclipse.org/bugs/show_bug.cgi?id=197329
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.irc.ui')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCMessageRenderer.java60
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCUI.java9
2 files changed, 67 insertions, 2 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCMessageRenderer.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCMessageRenderer.java
new file mode 100644
index 000000000..b4903d064
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCMessageRenderer.java
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 2007 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jacek Pospychala <jacek.pospychala@pl.ibm.com> - bug 197329
+ *****************************************************************************/
+package org.eclipse.ecf.internal.irc.ui;
+
+import org.eclipse.ecf.presence.ui.chatroom.MessageRenderer;
+import org.eclipse.swt.SWT;
+
+public class IRCMessageRenderer extends MessageRenderer {
+
+ private final static String ME_PREFIX = "\01ACTION "; //$NON-NLS-1$
+ private final static String ME_SUFFIX = "\01"; //$NON-NLS-1$
+
+ private boolean isActionMessage;
+
+ protected void doRender() {
+ String actionMessage = getActionMessage(message);
+ isActionMessage = (actionMessage != null);
+
+ if (isActionMessage) {
+ message = actionMessage;
+ }
+
+ super.doRender();
+ }
+
+ protected void appendNickname() {
+ if (isActionMessage) {
+ String message = originator + " "; //$NON-NLS-1$
+ append(message, null, null, SWT.ITALIC);
+ } else {
+ super.appendNickname();
+ }
+ }
+
+ protected void appendMessage() {
+ if (isActionMessage) {
+ append(message, null, null, SWT.ITALIC);
+ } else {
+ super.appendMessage();
+ }
+ }
+
+ private String getActionMessage(String message) {
+ if (message.startsWith(ME_PREFIX) && message.endsWith(ME_SUFFIX)) {
+ return message.substring(ME_PREFIX.length(), message.length() - ME_SUFFIX.length());
+ } else {
+ return null;
+ }
+ }
+
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCUI.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCUI.java
index 67f667ea6..fe145ef2d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCUI.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/IRCUI.java
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2004 Composent, Inc. and others.
+ * Copyright (c) 2004, 2007 Composent, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Composent, Inc. - initial API and implementation
+ * Jacek Pospychala <jacek.pospychala@pl.ibm.com> - bug 197329
*****************************************************************************/
package org.eclipse.ecf.internal.irc.ui;
@@ -21,6 +22,7 @@ import org.eclipse.ecf.core.util.IExceptionHandler;
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
import org.eclipse.ecf.presence.ui.chatroom.ChatRoomManagerUI;
+import org.eclipse.ecf.presence.ui.chatroom.IMessageRenderer;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
@@ -120,5 +122,8 @@ public class IRCUI extends ChatRoomManagerUI {
return inputLine;
}
-
+
+ protected IMessageRenderer getDefaultMessageRenderer() {
+ return new IRCMessageRenderer();
+ }
}

Back to the top