Quellcode durchsuchen

DI the contact list plugin

Change-Id: Iea0abd62774d14fadc4545ad9fbd32c5f0a1c056
Reviewed-on: http://gerrit.dmdirc.com/3175
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Greg Holmes vor 10 Jahren
Ursprung
Commit
2049c56405

+ 3
- 0
src/com/dmdirc/addons/contactlist/ContactListCommand.java Datei anzeigen

@@ -34,6 +34,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.interfaces.CommandController;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * Generates a contact list for the channel the command is used in.
39 41
  */
@@ -49,6 +51,7 @@ public class ContactListCommand extends Command implements IntelligentCommand {
49 51
      *
50 52
      * @param controller The controller to use for command information.
51 53
      */
54
+    @Inject
52 55
     public ContactListCommand(final CommandController controller) {
53 56
         super(controller);
54 57
     }

+ 32
- 0
src/com/dmdirc/addons/contactlist/ContactListModule.java Datei anzeigen

@@ -0,0 +1,32 @@
1
+/*
2
+ * Copyright (c) 2006-2014 DMDirc Developers
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.contactlist;
24
+
25
+import com.dmdirc.addons.ui_swing.injection.SwingModule;
26
+
27
+import dagger.Module;
28
+
29
+@Module(injects = ContactListCommand.class, addsTo = SwingModule.class)
30
+public class ContactListModule {
31
+
32
+}

+ 10
- 11
src/com/dmdirc/addons/contactlist/ContactListPlugin.java Datei anzeigen

@@ -22,22 +22,21 @@
22 22
 
23 23
 package com.dmdirc.addons.contactlist;
24 24
 
25
-import com.dmdirc.interfaces.CommandController;
25
+import com.dmdirc.plugins.PluginInfo;
26 26
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
27 27
 
28
+import dagger.ObjectGraph;
29
+
28 30
 /**
29 31
  * Plugin to provide a POC contact list.
30 32
  */
31
-public final class ContactListPlugin extends BaseCommandPlugin {
33
+public class ContactListPlugin extends BaseCommandPlugin {
32 34
 
33
-    /**
34
-     * Creates a new instance of this plugin.
35
-     *
36
-     * @param commandController Command controller to register commands
37
-     */
38
-    public ContactListPlugin(final CommandController commandController) {
39
-        super(commandController);
40
-        registerCommand(new ContactListCommand(commandController), ContactListCommand.INFO);
41
-    }
35
+    @Override
36
+    public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
37
+        super.load(pluginInfo, graph);
42 38
 
39
+        setObjectGraph(graph.plus(new ContactListModule()));
40
+        registerCommand(ContactListCommand.class, ContactListCommand.INFO);
41
+    }
43 42
 }

Laden…
Abbrechen
Speichern