Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcaniszczyk2007-07-26 14:40:14 -0400
committercaniszczyk2007-07-26 14:40:14 -0400
commitb7a89bef57c35d545a9f919e270e034ead13e05e (patch)
tree6ff8bd4288301f6e74c900892f083e0986ecb9b5 /providers/bundles/org.eclipse.ecf.provider.irc.ui
parentbf7bd2d8adf89f27b0580371f7364a1a9ca5ba60 (diff)
downloadorg.eclipse.ecf-b7a89bef57c35d545a9f919e270e034ead13e05e.tar.gz
org.eclipse.ecf-b7a89bef57c35d545a9f919e270e034ead13e05e.tar.xz
org.eclipse.ecf-b7a89bef57c35d545a9f919e270e034ead13e05e.zip
bug 192762: [IRC] Support common operations on usernames like op,voice,etc
https://bugs.eclipse.org/bugs/show_bug.cgi?id=192762
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/actions/AbstractActionDelegate.java36
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/BanAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DeopAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DevoiceAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/KickAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/OpAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/VoiceAction.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/WhoisAction.java4
8 files changed, 31 insertions, 33 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/AbstractActionDelegate.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/AbstractActionDelegate.java
index c4458e975..2c12d5069 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/AbstractActionDelegate.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/AbstractActionDelegate.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.ecf.internal.irc.ui.actions;
+import java.util.Iterator;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.core.user.IUser;
@@ -26,38 +28,34 @@ import org.eclipse.ui.statushandlers.StatusManager;
abstract public class AbstractActionDelegate implements IViewActionDelegate {
- private IUser user;
- private String username;
+ private IStructuredSelection selection;
private IChatRoomContainer chatRoomContainer;
public AbstractActionDelegate() {
super();
}
- protected abstract String getMessage();
+ protected abstract String getMessage(String username);
- protected String getUsername() {
- if (username != null) {
- return username;
- }
-
- if (user != null) {
- username = user.getName();
- if (username.startsWith("@")) { //$NON-NLS-1$
- username = username.substring(1);
- }
- return username;
+ protected String getUsername(IUser user) {
+ String username = user.getName();
+ if (username.startsWith("@")) { //$NON-NLS-1$
+ username = username.substring(1);
}
-
- return null;
+ return username;
}
public void run(IAction action) {
- if ((chatRoomContainer == null) || (user == null)) {
+ if ((chatRoomContainer == null) || (selection == null)) {
return;
}
try {
- chatRoomContainer.getChatRoomMessageSender().sendMessage(getMessage()); //$NON-NLS-1$
+ Iterator iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ IUser user = (IUser) iterator.next();
+ String message = getMessage(getUsername(user));
+ chatRoomContainer.getChatRoomMessageSender().sendMessage(message);
+ }
} catch (ECFException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
}
@@ -68,7 +66,7 @@ abstract public class AbstractActionDelegate implements IViewActionDelegate {
return;
}
- user = (IUser) ((IStructuredSelection) selection).getFirstElement();
+ this.selection = (IStructuredSelection) selection;
}
public void init(IViewPart view) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/BanAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/BanAction.java
index 63d9d9950..52b210f8c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/BanAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/BanAction.java
@@ -13,7 +13,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class BanAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/ban "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/ban "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DeopAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DeopAction.java
index 089f3f57a..28aa99274 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DeopAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DeopAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class DeopAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/dop "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/dop "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DevoiceAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DevoiceAction.java
index b9463814c..4d54ca0b8 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DevoiceAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/DevoiceAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class DevoiceAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/mode -v "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/mode -v "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/KickAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/KickAction.java
index 06f767c61..ddba34ce9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/KickAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/KickAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class KickAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/kick "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/kick "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/OpAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/OpAction.java
index ad4096e74..c91b08d5c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/OpAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/OpAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class OpAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/op "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/op "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/VoiceAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/VoiceAction.java
index f564be60a..b03ef7b77 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/VoiceAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/VoiceAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class VoiceAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/mode +v "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/mode +v "+username; //$NON-NLS-1$
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/WhoisAction.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/WhoisAction.java
index a0395db4a..ed4a294f1 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/WhoisAction.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/actions/WhoisAction.java
@@ -12,7 +12,7 @@ package org.eclipse.ecf.internal.irc.ui.actions;
public class WhoisAction extends AbstractActionDelegate {
- protected String getMessage() {
- return "/whois "+getUsername(); //$NON-NLS-1$
+ protected String getMessage(String username) {
+ return "/whois "+username; //$NON-NLS-1$
}
}

Back to the top