Browse Source

Add a qualifier for ColourManager.

Change-Id: Icf9c64b84ddc129fe54765a4a3cac475c58cf1de
Depends-On: I81484e5df7b5dfeb7067ba211c11f2df198ac43c
Reviewed-on: http://gerrit.dmdirc.com/3893
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
pull/1/head
Greg Holmes 9 years ago
parent
commit
8e404a59b8

+ 2
- 1
src/com/dmdirc/ClientModule.java View File

180
 
180
 
181
     @Provides
181
     @Provides
182
     @Singleton
182
     @Singleton
183
-    public ColourManager getColourManager(final ColourManagerFactory colourManagerFactory,
183
+    @GlobalConfig
184
+    public ColourManager getGlobalColourManager(final ColourManagerFactory colourManagerFactory,
184
             @GlobalConfig final  AggregateConfigProvider globalConfig) {
185
             @GlobalConfig final  AggregateConfigProvider globalConfig) {
185
         return colourManagerFactory.getColourManager(globalConfig);
186
         return colourManagerFactory.getColourManager(globalConfig);
186
     }
187
     }

+ 3
- 2
src/com/dmdirc/actions/ColourActionComparison.java View File

22
 
22
 
23
 package com.dmdirc.actions;
23
 package com.dmdirc.actions;
24
 
24
 
25
+import com.dmdirc.ClientModule;
25
 import com.dmdirc.interfaces.actions.ActionComparison;
26
 import com.dmdirc.interfaces.actions.ActionComparison;
26
-import com.dmdirc.util.colours.Colour;
27
 import com.dmdirc.ui.messages.ColourManager;
27
 import com.dmdirc.ui.messages.ColourManager;
28
+import com.dmdirc.util.colours.Colour;
28
 
29
 
29
 import javax.inject.Inject;
30
 import javax.inject.Inject;
30
 import javax.inject.Provider;
31
 import javax.inject.Provider;
47
      * @param colourManager The colour manager to use.
48
      * @param colourManager The colour manager to use.
48
      */
49
      */
49
     @Inject
50
     @Inject
50
-    public ColourActionComparison(final Provider<ColourManager> colourManager) {
51
+    public ColourActionComparison(@ClientModule.GlobalConfig final Provider<ColourManager> colourManager) {
51
         this.equalsComparison = new Equals();
52
         this.equalsComparison = new Equals();
52
         this.notEqualsComparison = new NotEquals();
53
         this.notEqualsComparison = new NotEquals();
53
         this.colourManager = colourManager;
54
         this.colourManager = colourManager;

+ 10
- 9
src/com/dmdirc/commandparser/commands/channel/SetNickColour.java View File

35
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
 import com.dmdirc.interfaces.CommandController;
36
 import com.dmdirc.interfaces.CommandController;
37
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
37
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
38
-import com.dmdirc.util.colours.Colour;
39
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.AdditionalTabTargets;
40
 import com.dmdirc.ui.input.TabCompletionType;
39
 import com.dmdirc.ui.input.TabCompletionType;
41
-import com.dmdirc.ui.messages.ColourManager;
40
+import com.dmdirc.ui.messages.ColourManagerFactory;
41
+import com.dmdirc.util.colours.Colour;
42
 
42
 
43
 import javax.annotation.Nonnull;
43
 import javax.annotation.Nonnull;
44
 import javax.inject.Inject;
44
 import javax.inject.Inject;
54
             + "set the specified person's display colour",
54
             + "set the specified person's display colour",
55
             CommandType.TYPE_CHANNEL);
55
             CommandType.TYPE_CHANNEL);
56
     /** Manager to use to convert colours. */
56
     /** Manager to use to convert colours. */
57
-    private final ColourManager colourManager;
57
+    private final ColourManagerFactory colourManagerFactory;
58
 
58
 
59
     /**
59
     /**
60
      * Creates a new instance of the {@link SetNickColour} command.
60
      * Creates a new instance of the {@link SetNickColour} command.
61
      *
61
      *
62
-     * @param controller    The command controller that owns this command.
63
-     * @param colourManager The colour manager to use to convert colours.
62
+     * @param controller           The command controller that owns this command.
63
+     * @param colourManagerFactory The colour manager factory to use to convert colours.
64
      */
64
      */
65
     @Inject
65
     @Inject
66
-    public SetNickColour(final CommandController controller, final ColourManager colourManager) {
66
+    public SetNickColour(final CommandController controller,
67
+            final ColourManagerFactory colourManagerFactory) {
67
         super(controller);
68
         super(controller);
68
-        this.colourManager = colourManager;
69
+        this.colourManagerFactory = colourManagerFactory;
69
     }
70
     }
70
 
71
 
71
     @Override
72
     @Override
112
             channel.refreshClients();
113
             channel.refreshClients();
113
         } else {
114
         } else {
114
             // We're setting the colour
115
             // We're setting the colour
115
-            final Colour newColour = colourManager.getColourFromString(args.getArguments()[offset],
116
-                    null);
116
+            final Colour newColour = colourManagerFactory.getColourManager(origin.getConfigManager())
117
+                    .getColourFromString(args.getArguments()[offset], null);
117
             if (newColour == null) {
118
             if (newColour == null) {
118
                 sendLine(origin, args.isSilent(), FORMAT_ERROR, "Invalid colour specified.");
119
                 sendLine(origin, args.isSilent(), FORMAT_ERROR, "Invalid colour specified.");
119
                 return;
120
                 return;

+ 10
- 8
src/com/dmdirc/commandparser/commands/global/Notify.java View File

31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.interfaces.CommandController;
33
 import com.dmdirc.interfaces.CommandController;
34
-import com.dmdirc.util.colours.Colour;
35
 import com.dmdirc.ui.input.AdditionalTabTargets;
34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36
-import com.dmdirc.ui.messages.ColourManager;
35
+import com.dmdirc.ui.messages.ColourManagerFactory;
36
+import com.dmdirc.util.colours.Colour;
37
 
37
 
38
 import javax.annotation.Nonnull;
38
 import javax.annotation.Nonnull;
39
 import javax.inject.Inject;
39
 import javax.inject.Inject;
48
             "notify <colour> - sets the notification colour for this window",
48
             "notify <colour> - sets the notification colour for this window",
49
             CommandType.TYPE_GLOBAL);
49
             CommandType.TYPE_GLOBAL);
50
     /** Manager to use to convert colours. */
50
     /** Manager to use to convert colours. */
51
-    private final ColourManager colourManager;
51
+    private final ColourManagerFactory colourManagerFactory;
52
 
52
 
53
     /**
53
     /**
54
      * Creates a new instance of the {@link Notify} command.
54
      * Creates a new instance of the {@link Notify} command.
55
      *
55
      *
56
-     * @param controller    The controller to use for command information.
57
-     * @param colourManager The colour manager to use to convert colours.
56
+     * @param controller           The controller to use for command information.
57
+     * @param colourManagerFactory The colour manager factory to use to convert colours.
58
      */
58
      */
59
     @Inject
59
     @Inject
60
-    public Notify(final CommandController controller, final ColourManager colourManager) {
60
+    public Notify(final CommandController controller,
61
+            final ColourManagerFactory colourManagerFactory) {
61
         super(controller);
62
         super(controller);
62
-        this.colourManager = colourManager;
63
+        this.colourManagerFactory = colourManagerFactory;
63
     }
64
     }
64
 
65
 
65
     @Override
66
     @Override
70
             return;
71
             return;
71
         }
72
         }
72
 
73
 
73
-        final Colour colour = colourManager.getColourFromString(args.getArguments()[0], null);
74
+        final Colour colour = colourManagerFactory.getColourManager(origin.getConfigManager())
75
+                .getColourFromString(args.getArguments()[0], null);
74
 
76
 
75
         if (colour == null) {
77
         if (colour == null) {
76
             showUsage(origin, args.isSilent(), "notify",
78
             showUsage(origin, args.isSilent(), "notify",

+ 1
- 1
src/com/dmdirc/plugins/PluginInjectorInitialiser.java View File

87
             final LifecycleController lifecycleController,
87
             final LifecycleController lifecycleController,
88
             final CorePluginExtractor corePluginExtractor,
88
             final CorePluginExtractor corePluginExtractor,
89
             final URLBuilder urlBuilder,
89
             final URLBuilder urlBuilder,
90
-            final ColourManager colourManager,
90
+            @GlobalConfig final ColourManager colourManager,
91
             final ActionSubstitutorFactory actionSubstitutorFactory,
91
             final ActionSubstitutorFactory actionSubstitutorFactory,
92
             final DMDircMBassador eventBus,
92
             final DMDircMBassador eventBus,
93
             @GlobalConfig final IconManager iconManager) {
93
             @GlobalConfig final IconManager iconManager) {

+ 1
- 2
src/com/dmdirc/ui/core/feedback/FeedbackSender.java View File

22
 
22
 
23
 package com.dmdirc.ui.core.feedback;
23
 package com.dmdirc.ui.core.feedback;
24
 
24
 
25
-import com.dmdirc.ClientModule.GlobalConfig;
26
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
25
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
27
 import com.dmdirc.interfaces.ui.StatusBar;
26
 import com.dmdirc.interfaces.ui.StatusBar;
28
 import com.dmdirc.ui.StatusMessage;
27
 import com.dmdirc.ui.StatusMessage;
44
     private final Downloader downloader;
43
     private final Downloader downloader;
45
 
44
 
46
     public FeedbackSender(
45
     public FeedbackSender(
47
-            @GlobalConfig final AggregateConfigProvider config,
46
+            final AggregateConfigProvider config,
48
             final Downloader downloader,
47
             final Downloader downloader,
49
             final StatusBar statusBar,
48
             final StatusBar statusBar,
50
             final String name,
49
             final String name,

+ 9
- 4
test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java View File

26
 import com.dmdirc.commandparser.CommandArguments;
26
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
27
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
28
 import com.dmdirc.interfaces.CommandController;
28
 import com.dmdirc.interfaces.CommandController;
29
-import com.dmdirc.ui.messages.ColourManager;
29
+import com.dmdirc.ui.messages.ColourManagerFactory;
30
 
30
 
31
 import org.junit.Before;
31
 import org.junit.Before;
32
 import org.junit.Test;
32
 import org.junit.Test;
34
 import org.mockito.Mock;
34
 import org.mockito.Mock;
35
 import org.mockito.runners.MockitoJUnitRunner;
35
 import org.mockito.runners.MockitoJUnitRunner;
36
 
36
 
37
-import static org.mockito.Mockito.*;
37
+import static org.mockito.Mockito.anyChar;
38
+import static org.mockito.Mockito.anyString;
39
+import static org.mockito.Mockito.eq;
40
+import static org.mockito.Mockito.mock;
41
+import static org.mockito.Mockito.verify;
42
+import static org.mockito.Mockito.when;
38
 
43
 
39
 @RunWith(MockitoJUnitRunner.class)
44
 @RunWith(MockitoJUnitRunner.class)
40
 public class SetNickColourTest {
45
 public class SetNickColourTest {
41
 
46
 
42
     @Mock private Channel channel;
47
     @Mock private Channel channel;
43
-    @Mock private ColourManager colourManager;
48
+    @Mock private ColourManagerFactory colourManagerFactory;
44
     @Mock private CommandController controller;
49
     @Mock private CommandController controller;
45
     private SetNickColour command;
50
     private SetNickColour command;
46
 
51
 
47
     @Before
52
     @Before
48
     public void setUp() {
53
     public void setUp() {
49
-        command = new SetNickColour(controller, colourManager);
54
+        command = new SetNickColour(controller, colourManagerFactory);
50
         when(controller.getCommandChar()).thenReturn('/');
55
         when(controller.getCommandChar()).thenReturn('/');
51
         when(controller.getSilenceChar()).thenReturn('.');
56
         when(controller.getSilenceChar()).thenReturn('.');
52
     }
57
     }

Loading…
Cancel
Save