Kaynağa Gözat

Javadoc'd the CommandWindow interface

The origin argument is now passed to ServerCommand objects
Updated test/0 to output to the source window, rather than the server

git-svn-id: http://svn.dmdirc.com/trunk@167 00569f92-eb28-0410-84fd-f71c24880f
tags/0.1
Chris Smith 17 yıl önce
ebeveyn
işleme
65b3bcd74f

+ 7
- 1
src/uk/org/ownage/dmdirc/commandparser/CommandWindow.java Dosyayı Görüntüle

@@ -23,11 +23,17 @@
23 23
 package uk.org.ownage.dmdirc.commandparser;
24 24
 
25 25
 /**
26
- *
26
+ * A command window is a window that allows the user to input a command (that's
27
+ * passed to a command parser). This interface includes methods that are required
28
+ * to allow the commands to interact with the user via the window.
27 29
  * @author chris
28 30
  */
29 31
 public interface CommandWindow {
30 32
     
33
+    /**
34
+     * Adds a line of text to the main text area of the window
35
+     * @param line The line to be added
36
+     */
31 37
     public void addLine(String line);
32 38
     
33 39
 }

+ 2
- 1
src/uk/org/ownage/dmdirc/commandparser/ServerCommand.java Dosyayı Görüntüle

@@ -39,8 +39,9 @@ public abstract class ServerCommand extends Command {
39 39
     
40 40
     /**
41 41
      * Executes this command
42
+     * @param origin The window in which the command was typed
42 43
      * @param server The server instance that this command is being executed on
43 44
      * @param args Arguments passed to this command
44 45
      */    
45
-    public abstract void execute(Server server, String... args);
46
+    public abstract void execute(CommandWindow origin, Server server, String... args);
46 47
 }

+ 1
- 1
src/uk/org/ownage/dmdirc/commandparser/ServerCommandParser.java Dosyayı Görüntüle

@@ -57,7 +57,7 @@ public class ServerCommandParser extends CommandParser {
57 57
      * @param args The arguments to the command
58 58
      */
59 59
     protected void executeCommand(CommandWindow origin, Command command, String... args) {
60
-        ((ServerCommand)command).execute(server, args);
60
+        ((ServerCommand)command).execute(origin, server, args);
61 61
     }
62 62
     
63 63
     /**

+ 4
- 2
src/uk/org/ownage/dmdirc/commandparser/commands/Test.java Dosyayı Görüntüle

@@ -24,6 +24,7 @@ package uk.org.ownage.dmdirc.commandparser.commands;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26 26
 import uk.org.ownage.dmdirc.commandparser.Command;
27
+import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
29 30
 /**
@@ -45,11 +46,12 @@ public class Test extends ServerCommand {
45 46
 
46 47
     /**
47 48
      * Executes this command
49
+     * @param origin The window in which the command was typed
48 50
      * @param server The server instance that this command is being executed on
49 51
      * @param args Arguments passed to this command
50 52
      */
51
-    public void execute(Server server, String... args) {
52
-        server.addLine(server.getParser().getSvnInfo());
53
+    public void execute(CommandWindow origin, Server server, String... args) {
54
+        origin.addLine(server.getParser().getSvnInfo());
53 55
     }
54 56
     
55 57
 }

Loading…
İptal
Kaydet