瀏覽代碼

Remove ActionComponentArgument.

This only exists to pass around global state, and is only used
by one plugin. It's nicer for now if that plugin just accesses
a singleton/static state directly until it can be injected,
rather than make lots of classes and tests depend on Main.

Change-Id: I8ed6e4c90b9c6bdbcaeb01fc276df5819cb47e1a
Depends-On: I4ec47f958b40eb0a03ab50d4a5611e00b0c83f39
Reviewed-on: http://gerrit.dmdirc.com/2656
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8rc1
Chris Smith 10 年之前
父節點
當前提交
29c0c560b6

+ 2
- 1
src/com/dmdirc/Main.java 查看文件

@@ -72,7 +72,8 @@ public class Main {
72 72
     private String configdir;
73 73
 
74 74
     /** Instance of main, protected to allow subclasses direct access. */
75
-    protected static Main mainInstance;
75
+    @Deprecated
76
+    public static Main mainInstance;
76 77
 
77 78
     /** Instance of pluginmanager used by this Main. */
78 79
     protected PluginManager pluginManager;

+ 4
- 5
src/com/dmdirc/actions/ActionComponentChain.java 查看文件

@@ -24,7 +24,6 @@ package com.dmdirc.actions;
24 24
 
25 25
 import com.dmdirc.Precondition;
26 26
 import com.dmdirc.interfaces.actions.ActionComponent;
27
-import com.dmdirc.interfaces.actions.ActionComponentArgument;
28 27
 import com.dmdirc.logger.Logger;
29 28
 
30 29
 import java.util.ArrayList;
@@ -82,15 +81,15 @@ public class ActionComponentChain implements ActionComponent {
82 81
 
83 82
     /** {@inheritDoc} */
84 83
     @Override
85
-    public Object get(final ActionComponentArgument arg) {
86
-        Object res = arg.getObject();
84
+    public Object get(final Object arg) {
85
+        Object res = arg;
87 86
 
88 87
         for (ActionComponent component : components) {
89 88
             if (res == null) {
90 89
                 return null;
91 90
             }
92 91
 
93
-            res = component.get(new ActionComponentArgument(arg.getMain(), res));
92
+            res = component.get(res);
94 93
         }
95 94
 
96 95
         return res;
@@ -165,7 +164,7 @@ public class ActionComponentChain implements ActionComponent {
165 164
         for (ActionComponent component : components) {
166 165
             try {
167 166
                 final ComponentOptions options = component.getClass()
168
-                        .getMethod("get", ActionComponentArgument.class).getAnnotation(ComponentOptions.class);
167
+                        .getMethod("get", Object.class).getAnnotation(ComponentOptions.class);
169 168
                 if (options != null) {
170 169
                     res |= options.requireConnected();
171 170
                 }

+ 1
- 2
src/com/dmdirc/actions/ActionCondition.java 查看文件

@@ -24,7 +24,6 @@ package com.dmdirc.actions;
24 24
 
25 25
 import com.dmdirc.interfaces.actions.ActionComparison;
26 26
 import com.dmdirc.interfaces.actions.ActionComponent;
27
-import com.dmdirc.interfaces.actions.ActionComponentArgument;
28 27
 
29 28
 /**
30 29
  * An action condition represents one condition within an action.
@@ -96,7 +95,7 @@ public class ActionCondition {
96 95
             final String thisStarget = sub.doSubstitution(starget, args);
97 96
             return getComparison().test(thisStarget, thisTarget);
98 97
         } else {
99
-            return getComparison().test(getComponent().get(new ActionComponentArgument(ActionManager.getActionManager().getMain(), args[getArg()])), thisTarget);
98
+            return getComparison().test(getComponent().get(args[getArg()]), thisTarget);
100 99
         }
101 100
     }
102 101
 

+ 1
- 2
src/com/dmdirc/actions/ActionSubstitutor.java 查看文件

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandArguments;
30 30
 import com.dmdirc.config.ConfigManager;
31 31
 import com.dmdirc.config.IdentityManager;
32 32
 import com.dmdirc.interfaces.actions.ActionComponent;
33
-import com.dmdirc.interfaces.actions.ActionComponentArgument;
34 33
 import com.dmdirc.interfaces.actions.ActionType;
35 34
 import com.dmdirc.interfaces.ui.Window;
36 35
 
@@ -297,7 +296,7 @@ public class ActionSubstitutor {
297 296
         if ((chain.requiresConnection() && args[0] instanceof FrameContainer
298 297
                     && ((FrameContainer) args[0]).getServer().getState()
299 298
                     == ServerState.CONNECTED) || !chain.requiresConnection()) {
300
-            final Object res = chain.get(new ActionComponentArgument(ActionManager.getActionManager().getMain(), argument));
299
+            final Object res = chain.get(argument);
301 300
             return res == null ? ERR_NULL_CHAIN : res.toString();
302 301
         }
303 302
 

+ 36
- 37
src/com/dmdirc/actions/CoreActionComponent.java 查看文件

@@ -28,7 +28,6 @@ import com.dmdirc.Query;
28 28
 import com.dmdirc.Server;
29 29
 import com.dmdirc.config.Identity;
30 30
 import com.dmdirc.interfaces.actions.ActionComponent;
31
-import com.dmdirc.interfaces.actions.ActionComponentArgument;
32 31
 import com.dmdirc.interfaces.ui.Window;
33 32
 import com.dmdirc.logger.ErrorLevel;
34 33
 import com.dmdirc.logger.Logger;
@@ -53,7 +52,7 @@ public enum CoreActionComponent implements ActionComponent {
53 52
     SERVER_NAME {
54 53
         /** {@inheritDoc} */
55 54
         @Override
56
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getAddress(); }
55
+        public Object get(final Object arg) { return ((Server) arg).getAddress(); }
57 56
         /** {@inheritDoc} */
58 57
         @Override
59 58
         public Class<?> appliesTo() { return Server.class; }
@@ -70,7 +69,7 @@ public enum CoreActionComponent implements ActionComponent {
70 69
         /** {@inheritDoc} */
71 70
         @Override
72 71
         @ComponentOptions(requireConnected = true)
73
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getNetwork(); }
72
+        public Object get(final Object arg) { return ((Server) arg).getNetwork(); }
74 73
         /** {@inheritDoc} */
75 74
         @Override
76 75
         public Class<?> appliesTo() { return Server.class; }
@@ -90,7 +89,7 @@ public enum CoreActionComponent implements ActionComponent {
90 89
     SERVER_PROTOCOL {
91 90
         /** {@inheritDoc} */
92 91
         @Override
93
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getProtocol(); }
92
+        public Object get(final Object arg) { return ((Server) arg).getProtocol(); }
94 93
         /** {@inheritDoc} */
95 94
         @Override
96 95
         public Class<?> appliesTo() { return Server.class; }
@@ -106,7 +105,7 @@ public enum CoreActionComponent implements ActionComponent {
106 105
     SERVER_MYAWAYREASON {
107 106
         /** {@inheritDoc} */
108 107
         @Override
109
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getAwayMessage(); }
108
+        public Object get(final Object arg) { return ((Server) arg).getAwayMessage(); }
110 109
         /** {@inheritDoc} */
111 110
         @Override
112 111
         public Class<?> appliesTo() { return Server.class; }
@@ -123,7 +122,7 @@ public enum CoreActionComponent implements ActionComponent {
123 122
         /** {@inheritDoc} */
124 123
         @Override
125 124
         @ComponentOptions(requireConnected = true)
126
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getParser().getChannelUserModes(); }
125
+        public Object get(final Object arg) { return ((Server) arg).getParser().getChannelUserModes(); }
127 126
         /** {@inheritDoc} */
128 127
         @Override
129 128
         public Class<?> appliesTo() { return Server.class; }
@@ -140,8 +139,8 @@ public enum CoreActionComponent implements ActionComponent {
140 139
         /** {@inheritDoc} */
141 140
         @Override
142 141
         @ComponentOptions(requireConnected = true)
143
-        public Object get(final ActionComponentArgument arg) {
144
-            final Server server = (Server) arg.getObject();
142
+        public Object get(final Object arg) {
143
+            final Server server = (Server) arg;
145 144
 
146 145
             if (server == null || server.getParser() == null) {
147 146
                 Logger.appError(ErrorLevel.LOW, "SERVER_MYNICKNAME.get() called with null element",
@@ -171,7 +170,7 @@ public enum CoreActionComponent implements ActionComponent {
171 170
     SERVER_PROFILE {
172 171
         /** {@inheritDoc} */
173 172
         @Override
174
-        public Object get(final ActionComponentArgument arg) { return ((Server) arg.getObject()).getProfile(); }
173
+        public Object get(final Object arg) { return ((Server) arg).getProfile(); }
175 174
         /** {@inheritDoc} */
176 175
         @Override
177 176
         public Class<?> appliesTo() { return Server.class; }
@@ -187,7 +186,7 @@ public enum CoreActionComponent implements ActionComponent {
187 186
     CHANNEL_NAME {
188 187
         /** {@inheritDoc} */
189 188
         @Override
190
-        public Object get(final ActionComponentArgument arg) { return ((Channel) arg.getObject()).getChannelInfo().getName(); }
189
+        public Object get(final Object arg) { return ((Channel) arg).getChannelInfo().getName(); }
191 190
         /** {@inheritDoc} */
192 191
         @Override
193 192
         public Class<?> appliesTo() { return Channel.class; }
@@ -203,7 +202,7 @@ public enum CoreActionComponent implements ActionComponent {
203 202
     CHANNEL_COLOUR {
204 203
         /** {@inheritDoc} */
205 204
         @Override
206
-        public Object get(final ActionComponentArgument arg) { return ((Channel) arg.getObject()).getNotification(); }
205
+        public Object get(final Object arg) { return ((Channel) arg).getNotification(); }
207 206
         /** {@inheritDoc} */
208 207
         @Override
209 208
         public Class<?> appliesTo() { return Channel.class; }
@@ -219,7 +218,7 @@ public enum CoreActionComponent implements ActionComponent {
219 218
     CLIENT_NAME {
220 219
         /** {@inheritDoc} */
221 220
         @Override
222
-        public Object get(final ActionComponentArgument arg) { return ((ClientInfo) arg.getObject()).getNickname(); }
221
+        public Object get(final Object arg) { return ((ClientInfo) arg).getNickname(); }
223 222
         /** {@inheritDoc} */
224 223
         @Override
225 224
         public Class<?> appliesTo() { return ClientInfo.class; }
@@ -235,7 +234,7 @@ public enum CoreActionComponent implements ActionComponent {
235 234
     CLIENT_HOST {
236 235
         /** {@inheritDoc} */
237 236
         @Override
238
-        public Object get(final ActionComponentArgument arg) { return ((ClientInfo) arg.getObject()).getHostname(); }
237
+        public Object get(final Object arg) { return ((ClientInfo) arg).getHostname(); }
239 238
         /** {@inheritDoc} */
240 239
         @Override
241 240
         public Class<?> appliesTo() { return ClientInfo.class; }
@@ -251,7 +250,7 @@ public enum CoreActionComponent implements ActionComponent {
251 250
     USER_NAME {
252 251
         /** {@inheritDoc} */
253 252
         @Override
254
-        public Object get(final ActionComponentArgument arg) { return ((ChannelClientInfo) arg.getObject()).getClient().getNickname(); }
253
+        public Object get(final Object arg) { return ((ChannelClientInfo) arg).getClient().getNickname(); }
255 254
         /** {@inheritDoc} */
256 255
         @Override
257 256
         public Class<?> appliesTo() { return ChannelClientInfo.class; }
@@ -267,7 +266,7 @@ public enum CoreActionComponent implements ActionComponent {
267 266
     USER_MODES {
268 267
         /** {@inheritDoc} */
269 268
         @Override
270
-        public Object get(final ActionComponentArgument arg) { return ((ChannelClientInfo) arg.getObject()).getAllModes(); }
269
+        public Object get(final Object arg) { return ((ChannelClientInfo) arg).getAllModes(); }
271 270
         /** {@inheritDoc} */
272 271
         @Override
273 272
         public Class<?> appliesTo() { return ChannelClientInfo.class; }
@@ -283,7 +282,7 @@ public enum CoreActionComponent implements ActionComponent {
283 282
     USER_HOST {
284 283
         /** {@inheritDoc} */
285 284
         @Override
286
-        public Object get(final ActionComponentArgument arg) { return ((ChannelClientInfo) arg.getObject()).getClient().getHostname(); }
285
+        public Object get(final Object arg) { return ((ChannelClientInfo) arg).getClient().getHostname(); }
287 286
         /** {@inheritDoc} */
288 287
         @Override
289 288
         public Class<?> appliesTo() { return ChannelClientInfo.class; }
@@ -299,7 +298,7 @@ public enum CoreActionComponent implements ActionComponent {
299 298
     USER_COMCHANS {
300 299
         /** {@inheritDoc} */
301 300
         @Override
302
-        public Object get(final ActionComponentArgument arg) { return Integer.valueOf(((ChannelClientInfo) arg.getObject()).getClient().getChannelCount()); }
301
+        public Object get(final Object arg) { return Integer.valueOf(((ChannelClientInfo) arg).getClient().getChannelCount()); }
303 302
         /** {@inheritDoc} */
304 303
         @Override
305 304
         public Class<?> appliesTo() { return ChannelClientInfo.class; }
@@ -315,7 +314,7 @@ public enum CoreActionComponent implements ActionComponent {
315 314
     STRING_STRING {
316 315
         /** {@inheritDoc} */
317 316
         @Override
318
-        public Object get(final ActionComponentArgument arg) { return arg.getObject(); }
317
+        public Object get(final Object arg) { return arg; }
319 318
         /** {@inheritDoc} */
320 319
         @Override
321 320
         public Class<?> appliesTo() { return String.class; }
@@ -331,7 +330,7 @@ public enum CoreActionComponent implements ActionComponent {
331 330
     STRING_STRIPPED {
332 331
         /** {@inheritDoc} */
333 332
         @Override
334
-        public Object get(final ActionComponentArgument arg) { return Styliser.stipControlCodes((String) arg.getObject()); }
333
+        public Object get(final Object arg) { return Styliser.stipControlCodes((String) arg); }
335 334
         /** {@inheritDoc} */
336 335
         @Override
337 336
         public Class<?> appliesTo() { return String.class; }
@@ -347,7 +346,7 @@ public enum CoreActionComponent implements ActionComponent {
347 346
     STRING_LENGTH {
348 347
         /** {@inheritDoc} */
349 348
         @Override
350
-        public Object get(final ActionComponentArgument arg) { return ((String) arg.getObject()).length(); }
349
+        public Object get(final Object arg) { return ((String) arg).length(); }
351 350
         /** {@inheritDoc} */
352 351
         @Override
353 352
         public Class<?> appliesTo() { return String.class; }
@@ -363,7 +362,7 @@ public enum CoreActionComponent implements ActionComponent {
363 362
     STRINGARRAY_LENGTH {
364 363
         /** {@inheritDoc} */
365 364
         @Override
366
-        public Object get(final ActionComponentArgument arg) { return Integer.valueOf(((String[]) arg.getObject()).length); }
365
+        public Object get(final Object arg) { return Integer.valueOf(((String[]) arg).length); }
367 366
         /** {@inheritDoc} */
368 367
         @Override
369 368
         public Class<?> appliesTo() { return String[].class; }
@@ -379,7 +378,7 @@ public enum CoreActionComponent implements ActionComponent {
379 378
     CALENDAR_FULLSTRING {
380 379
         /** {@inheritDoc} */
381 380
         @Override
382
-        public Object get(final ActionComponentArgument arg) { return ((GregorianCalendar) arg.getObject()).getTime().toString(); }
381
+        public Object get(final Object arg) { return ((GregorianCalendar) arg).getTime().toString(); }
383 382
         /** {@inheritDoc} */
384 383
         @Override
385 384
         public Class<?> appliesTo() { return Calendar.class; }
@@ -395,7 +394,7 @@ public enum CoreActionComponent implements ActionComponent {
395 394
     KEYEVENT_KEYNAME {
396 395
         /** {@inheritDoc} */
397 396
         @Override
398
-        public Object get(final ActionComponentArgument arg) { return KeyEvent.getKeyText(((KeyStroke) arg.getObject()).getKeyCode()); }
397
+        public Object get(final Object arg) { return KeyEvent.getKeyText(((KeyStroke) arg).getKeyCode()); }
399 398
         /** {@inheritDoc} */
400 399
         @Override
401 400
         public Class<?> appliesTo() { return KeyStroke.class; }
@@ -411,8 +410,8 @@ public enum CoreActionComponent implements ActionComponent {
411 410
     KEYEVENT_CTRLSTATE {
412 411
         /** {@inheritDoc} */
413 412
         @Override
414
-        public Object get(final ActionComponentArgument arg) {
415
-            return Boolean.valueOf((((KeyStroke) arg.getObject()).getModifiers() & KeyEvent.CTRL_DOWN_MASK) != 0);
413
+        public Object get(final Object arg) {
414
+            return Boolean.valueOf((((KeyStroke) arg).getModifiers() & KeyEvent.CTRL_DOWN_MASK) != 0);
416 415
         }
417 416
         /** {@inheritDoc} */
418 417
         @Override
@@ -429,8 +428,8 @@ public enum CoreActionComponent implements ActionComponent {
429 428
     KEYEVENT_SHIFTSTATE {
430 429
         /** {@inheritDoc} */
431 430
         @Override
432
-        public Object get(final ActionComponentArgument arg) {
433
-            return Boolean.valueOf((((KeyStroke) arg.getObject()).getModifiers() & KeyEvent.SHIFT_DOWN_MASK) != 0);
431
+        public Object get(final Object arg) {
432
+            return Boolean.valueOf((((KeyStroke) arg).getModifiers() & KeyEvent.SHIFT_DOWN_MASK) != 0);
434 433
         }
435 434
         /** {@inheritDoc} */
436 435
         @Override
@@ -447,8 +446,8 @@ public enum CoreActionComponent implements ActionComponent {
447 446
     KEYEVENT_ALTSTATE {
448 447
         /** {@inheritDoc} */
449 448
         @Override
450
-        public Object get(final ActionComponentArgument arg) {
451
-            return Boolean.valueOf((((KeyStroke) arg.getObject()).getModifiers() & KeyEvent.ALT_DOWN_MASK) != 0);
449
+        public Object get(final Object arg) {
450
+            return Boolean.valueOf((((KeyStroke) arg).getModifiers() & KeyEvent.ALT_DOWN_MASK) != 0);
452 451
         }
453 452
         /** {@inheritDoc} */
454 453
         @Override
@@ -465,7 +464,7 @@ public enum CoreActionComponent implements ActionComponent {
465 464
     QUERY_HOST {
466 465
         /** {@inheritDoc} */
467 466
         @Override
468
-        public Object get(final ActionComponentArgument arg) { return ((Query) arg.getObject()).getHost(); }
467
+        public Object get(final Object arg) { return ((Query) arg).getHost(); }
469 468
         /** {@inheritDoc} */
470 469
         @Override
471 470
         public Class<?> appliesTo() { return Query.class; }
@@ -481,7 +480,7 @@ public enum CoreActionComponent implements ActionComponent {
481 480
     QUERY_NICK {
482 481
         /** {@inheritDoc} */
483 482
         @Override
484
-        public Object get(final ActionComponentArgument arg) { return ((Query) arg.getObject()).getName(); }
483
+        public Object get(final Object arg) { return ((Query) arg).getName(); }
485 484
         /** {@inheritDoc} */
486 485
         @Override
487 486
         public Class<?> appliesTo() { return Query.class; }
@@ -497,7 +496,7 @@ public enum CoreActionComponent implements ActionComponent {
497 496
     QUERY_COLOUR {
498 497
         /** {@inheritDoc} */
499 498
         @Override
500
-        public Object get(final ActionComponentArgument arg) { return ((Query) arg.getObject()).getNotification(); }
499
+        public Object get(final Object arg) { return ((Query) arg).getNotification(); }
501 500
         /** {@inheritDoc} */
502 501
         @Override
503 502
         public Class<?> appliesTo() { return Query.class; }
@@ -513,7 +512,7 @@ public enum CoreActionComponent implements ActionComponent {
513 512
     WINDOW_NAME {
514 513
         /** {@inheritDoc} */
515 514
         @Override
516
-        public Object get(final ActionComponentArgument arg) { return ((FrameContainer) arg.getObject()).getName(); }
515
+        public Object get(final Object arg) { return ((FrameContainer) arg).getName(); }
517 516
         /** {@inheritDoc} */
518 517
         @Override
519 518
         public Class<?> appliesTo() { return FrameContainer.class; }
@@ -529,7 +528,7 @@ public enum CoreActionComponent implements ActionComponent {
529 528
     WINDOW_COLOUR {
530 529
         /** {@inheritDoc} */
531 530
         @Override
532
-        public Object get(final ActionComponentArgument arg) { return ((FrameContainer) arg.getObject()).getNotification(); }
531
+        public Object get(final Object arg) { return ((FrameContainer) arg).getNotification(); }
533 532
         /** {@inheritDoc} */
534 533
         @Override
535 534
         public Class<?> appliesTo() { return FrameContainer.class; }
@@ -549,7 +548,7 @@ public enum CoreActionComponent implements ActionComponent {
549 548
     WINDOW_SERVER {
550 549
         /** {@inheritDoc} */
551 550
         @Override
552
-        public Object get(final ActionComponentArgument arg) { return ((Window) arg.getObject())
551
+        public Object get(final Object arg) { return ((Window) arg)
553 552
                 .getContainer().getServer(); }
554 553
         /** {@inheritDoc} */
555 554
         @Override
@@ -566,7 +565,7 @@ public enum CoreActionComponent implements ActionComponent {
566 565
     IDENTITY_NAME {
567 566
         /** {@inheritDoc} */
568 567
         @Override
569
-        public Object get(final ActionComponentArgument arg) { return ((Identity) arg.getObject()).getName(); }
568
+        public Object get(final Object arg) { return ((Identity) arg).getName(); }
570 569
         /** {@inheritDoc} */
571 570
         @Override
572 571
         public Class<?> appliesTo() { return Identity.class; }
@@ -582,7 +581,7 @@ public enum CoreActionComponent implements ActionComponent {
582 581
     INTEGER_VALUE {
583 582
         /** {@inheritDoc} */
584 583
         @Override
585
-        public Object get(final ActionComponentArgument arg) { return (Integer) arg.getObject(); }
584
+        public Object get(final Object arg) { return (Integer) arg; }
586 585
         /** {@inheritDoc} */
587 586
         @Override
588 587
         public Class<?> appliesTo() { return Integer.class; }

+ 1
- 1
src/com/dmdirc/interfaces/actions/ActionComponent.java 查看文件

@@ -57,7 +57,7 @@ public interface ActionComponent {
57 57
      * @param arg The object to retrieve the component from
58 58
      * @return The relevant component of the object
59 59
      */
60
-    Object get(ActionComponentArgument arg);
60
+    Object get(Object arg);
61 61
 
62 62
     /**
63 63
      * Retrieves the type of class that this component applies to.

+ 0
- 41
src/com/dmdirc/interfaces/actions/ActionComponentArgument.java 查看文件

@@ -1,41 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2013 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
-package com.dmdirc.interfaces.actions;
23
-
24
-import com.dmdirc.Main;
25
-import lombok.Getter;
26
-import lombok.RequiredArgsConstructor;
27
-
28
-/**
29
- * Represents an argument for an ActionComponent
30
- */
31
-@RequiredArgsConstructor
32
-@SuppressWarnings("PMD.UnusedPrivateField")
33
-public class ActionComponentArgument {
34
-    /** Instance of main that ActionComponents may wish to use. */
35
-    @Getter
36
-    private final Main main;
37
-
38
-    /** The object this argument wraps. */
39
-    @Getter
40
-    private final Object object;
41
-}

+ 2
- 3
test/com/dmdirc/actions/ActionComponentChainTest.java 查看文件

@@ -25,7 +25,6 @@ package com.dmdirc.actions;
25 25
 import com.dmdirc.TestMain;
26 26
 import com.dmdirc.Server;
27 27
 
28
-import com.dmdirc.interfaces.actions.ActionComponentArgument;
29 28
 import org.junit.BeforeClass;
30 29
 import org.junit.Test;
31 30
 
@@ -41,7 +40,7 @@ public class ActionComponentChainTest {
41 40
     @Test
42 41
     public void testSingle() {
43 42
         final ActionComponentChain chain = new ActionComponentChain(String.class, "STRING_STRING");
44
-        assertEquals(chain.get(new ActionComponentArgument(TestMain.getTestMain(), "foo bar baz")), "foo bar baz");
43
+        assertEquals(chain.get("foo bar baz"), "foo bar baz");
45 44
         assertEquals("STRING_STRING", chain.toString());
46 45
     }
47 46
 
@@ -49,7 +48,7 @@ public class ActionComponentChainTest {
49 48
     public void testDouble() {
50 49
         final ActionComponentChain chain = new ActionComponentChain(String.class,
51 50
                 "STRING_STRING.STRING_STRING");
52
-        assertEquals(chain.get(new ActionComponentArgument(TestMain.getTestMain(), "foo bar baz")), "foo bar baz");
51
+        assertEquals(chain.get("foo bar baz"), "foo bar baz");
53 52
         assertEquals("STRING_STRING.STRING_STRING", chain.toString());
54 53
     }
55 54
 

+ 0
- 5
test/com/dmdirc/actions/ActionConditionTest.java 查看文件

@@ -31,11 +31,6 @@ import static org.junit.Assert.*;
31 31
 
32 32
 public class ActionConditionTest {
33 33
 
34
-    @BeforeClass
35
-    public static void setUp() throws Exception {
36
-        TestMain.getTestMain();
37
-    }
38
-
39 34
     @Test
40 35
     public void testConstructor1() {
41 36
         final ActionCondition ac = new ActionCondition(1, CoreActionComponent.STRING_STRING,

Loading…
取消
儲存