Browse Source

Add basic status bar message debug command

Change-Id: I2cf9101abbd0bd7b717579443a61b6d3286b34d6
Reviewed-on: http://gerrit.dmdirc.com/1883
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.7rc1
Greg Holmes 13 years ago
parent
commit
da5cedbecc

+ 1
- 1
src/com/dmdirc/addons/debug/DebugPlugin.java View File

@@ -45,7 +45,7 @@ public class DebugPlugin extends Plugin {
45 45
         ForceUpdate.class, GlobalConfigInfo.class, Identities.class,
46 46
         MemInfo.class, Notify.class, RunGC.class, ServerInfo.class,
47 47
         ServerState.class, Services.class, ShowRaw.class, Threads.class,
48
-        Time.class,
48
+        Time.class, StatusbarMessage.class,
49 49
     };
50 50
     /** List of registered debug commands. */
51 51
     private final Map<String, DebugCommand> commands;

+ 68
- 0
src/com/dmdirc/addons/debug/commands/StatusbarMessage.java View File

@@ -0,0 +1,68 @@
1
+/*
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.debug.commands;
24
+
25
+import com.dmdirc.FrameContainer;
26
+import com.dmdirc.addons.debug.Debug;
27
+import com.dmdirc.addons.debug.DebugCommand;
28
+import com.dmdirc.commandparser.CommandArguments;
29
+import com.dmdirc.commandparser.commands.context.CommandContext;
30
+import com.dmdirc.config.IdentityManager;
31
+import com.dmdirc.ui.StatusMessage;
32
+import com.dmdirc.ui.core.components.StatusBarManager;
33
+
34
+/**
35
+ * Outputs a test message to the status bar.
36
+ */
37
+public class StatusbarMessage extends DebugCommand {
38
+
39
+    /**
40
+     * Creates a new instance of the command.
41
+     *
42
+     * @param command Parent command
43
+     */
44
+    public StatusbarMessage(final Debug command) {
45
+        super(command);
46
+    }
47
+
48
+    /** {@inheritDoc} */
49
+    @Override
50
+    public String getName() {
51
+        return "statusmessage";
52
+    }
53
+
54
+    /** {@inheritDoc} */
55
+    @Override
56
+    public String getUsage() {
57
+        return "message - Sets the status bar message";
58
+    }
59
+
60
+    /** {@inheritDoc} */
61
+    @Override
62
+    public void execute(final FrameContainer origin,
63
+            final CommandArguments args, final CommandContext context) {
64
+        StatusBarManager.getStatusBarManager().setMessage(new StatusMessage(
65
+                null, "Test: " + args.getArgumentsAsString(), null, 5,
66
+                IdentityManager.getGlobalConfig()));
67
+    }
68
+}

Loading…
Cancel
Save