Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2007-11-02 23:48:52 -0400
committerrsuen2007-11-02 23:48:52 -0400
commit00c49dc044e337f7be2c9f12088a9860cece6c73 (patch)
tree332d7c713298b814ee12420d30cddac3f19947c0 /applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos
parent835e155c271110d7f53b536b22fafed33afbcdc6 (diff)
downloadorg.eclipse.ecf-00c49dc044e337f7be2c9f12088a9860cece6c73.tar.gz
org.eclipse.ecf-00c49dc044e337f7be2c9f12088a9860cece6c73.tar.xz
org.eclipse.ecf-00c49dc044e337f7be2c9f12088a9860cece6c73.zip
Updated to sort the keys prior to printing out the table.
Diffstat (limited to 'applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos')
-rw-r--r--applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java b/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
index 55d9c6fc4..6031e814c 100644
--- a/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
+++ b/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
@@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -457,11 +458,13 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler {
FileWriter out = new FileWriter(HTML_FILE);
out
.write("<html>\n<head><title>KOS-MOS Commands</title></head>\n<body>\n<table cellspacing=\"2\" cellpadding=\"2\" border=\"0\">\n"); //$NON-NLS-1$
- Iterator it = messages.keySet().iterator();
- while (it.hasNext()) {
- String key = (String) it.next();
- String val = messages.getProperty(key);
- out.write(formatTableRow(key, val));
+ Set set = messages.keySet();
+ String[] commands = (String[]) set.toArray(new String[set.size()]);
+ Arrays.sort(commands);
+
+ for (int i = 0; i < commands.length; i++) {
+ String output = messages.getProperty(commands[i]);
+ out.write(formatTableRow(commands[i], output));
}
out.write("</table>\n</body></html>\n"); //$NON-NLS-1$

Back to the top