Преглед на файлове

Move aliases DI code into its own module.

Change-Id: Ifafbf427cd1a1f6ac0a1635c72b065a5f911c8fe
Reviewed-on: http://gerrit.dmdirc.com/3525
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
pull/1/head
Chris Smith преди 10 години
родител
ревизия
9e9984e280
променени са 2 файла, в които са добавени 50 реда и са изтрити 11 реда
  1. 8
    11
      src/com/dmdirc/ClientModule.java
  2. 42
    0
      src/com/dmdirc/commandparser/aliases/AliasesModule.java

+ 8
- 11
src/com/dmdirc/ClientModule.java Целия файл

32
 import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
32
 import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
33
 import com.dmdirc.commandline.CommandLineParser;
33
 import com.dmdirc.commandline.CommandLineParser;
34
 import com.dmdirc.commandparser.CommandManager;
34
 import com.dmdirc.commandparser.CommandManager;
35
-import com.dmdirc.commandparser.aliases.AliasStore;
36
-import com.dmdirc.commandparser.aliases.YamlAliasStore;
35
+import com.dmdirc.commandparser.aliases.AliasesModule;
37
 import com.dmdirc.commandparser.commands.CommandModule;
36
 import com.dmdirc.commandparser.commands.CommandModule;
38
 import com.dmdirc.config.IdentityManager;
37
 import com.dmdirc.config.IdentityManager;
39
 import com.dmdirc.config.InvalidIdentityFileException;
38
 import com.dmdirc.config.InvalidIdentityFileException;
87
  */
86
  */
88
 @Module(
87
 @Module(
89
         injects = {Main.class, CommandLineParser.class},
88
         injects = {Main.class, CommandLineParser.class},
90
-        includes = {CommandLineOptionsModule.class, CommandModule.class, UpdaterModule.class},
89
+        includes = {
90
+            AliasesModule.class,
91
+            CommandLineOptionsModule.class,
92
+            CommandModule.class,
93
+            UpdaterModule.class
94
+        },
91
         library = true)
95
         library = true)
92
 public class ClientModule {
96
 public class ClientModule {
93
 
97
 
129
         }
133
         }
130
 
134
 
131
         if (commandLineParser.getDisableReporting()) {
135
         if (commandLineParser.getDisableReporting()) {
132
-            identityManager.getUserSettings()
133
-                    .setOption("temp", "noerrorreporting", true);
136
+            identityManager.getUserSettings().setOption("temp", "noerrorreporting", true);
134
         }
137
         }
135
 
138
 
136
         return identityManager;
139
         return identityManager;
306
         return new EventBus();
309
         return new EventBus();
307
     }
310
     }
308
 
311
 
309
-    @Provides
310
-    @Singleton
311
-    public AliasStore getAliasStore(final YamlAliasStore store) {
312
-        return store;
313
-    }
314
-
315
     /**
312
     /**
316
      * Sets the object graph that will be injected. Must be called before any provider method.
313
      * Sets the object graph that will be injected. Must be called before any provider method.
317
      *
314
      *

+ 42
- 0
src/com/dmdirc/commandparser/aliases/AliasesModule.java Целия файл

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.commandparser.aliases;
24
+
25
+import javax.inject.Singleton;
26
+
27
+import dagger.Module;
28
+import dagger.Provides;
29
+
30
+/**
31
+ * Dagger module for aliases.
32
+ */
33
+@Module(library = true, complete = false)
34
+public class AliasesModule {
35
+
36
+    @Provides
37
+    @Singleton
38
+    public AliasStore getAliasStore(final YamlAliasStore store) {
39
+        return store;
40
+    }
41
+
42
+}

Loading…
Отказ
Запис