|
@@ -37,13 +37,17 @@ import com.dmdirc.ui.input.TabCompletionType;
|
37
|
37
|
import java.util.ArrayList;
|
38
|
38
|
import java.util.List;
|
39
|
39
|
|
|
40
|
+import javax.inject.Inject;
|
|
41
|
+import javax.inject.Singleton;
|
|
42
|
+
|
40
|
43
|
/**
|
41
|
44
|
* Encapsulates alias actions.
|
42
|
45
|
*/
|
|
46
|
+@Singleton
|
43
|
47
|
public class AliasWrapper extends ActionGroup {
|
44
|
48
|
|
45
|
|
- /** Singleton instance of the alias wrapper. */
|
46
|
|
- private static AliasWrapper me;
|
|
49
|
+ /** The name of the actions group we wrap. */
|
|
50
|
+ protected static final String GROUP_NAME = "aliases";
|
47
|
51
|
|
48
|
52
|
/** A list of registered alias names. */
|
49
|
53
|
private final List<String> aliases = new ArrayList<>();
|
|
@@ -60,37 +64,16 @@ public class AliasWrapper extends ActionGroup {
|
60
|
64
|
* @param commandController Command controller to get command info from.
|
61
|
65
|
* @param windowManager The window manager to use to find root windows.
|
62
|
66
|
*/
|
|
67
|
+ @Inject
|
63
|
68
|
public AliasWrapper(
|
64
|
69
|
final CommandController commandController,
|
65
|
70
|
final WindowManager windowManager) {
|
66
|
|
- super("aliases");
|
|
71
|
+ super(GROUP_NAME);
|
67
|
72
|
|
68
|
73
|
this.commandController = commandController;
|
69
|
74
|
this.windowManager = windowManager;
|
70
|
75
|
}
|
71
|
76
|
|
72
|
|
- /**
|
73
|
|
- * Retrieves a singleton instance of this alias wrapper.
|
74
|
|
- *
|
75
|
|
- * @return A singleton instance of AliasWrapper
|
76
|
|
- * @deprecated Global state is bad.
|
77
|
|
- */
|
78
|
|
- @Deprecated
|
79
|
|
- public static AliasWrapper getAliasWrapper() {
|
80
|
|
- return me;
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
- /**
|
84
|
|
- * Sets the alias wrapper that will be used as a singleton instance.
|
85
|
|
- *
|
86
|
|
- * @param wrapper The wrapper to use as a singleton.
|
87
|
|
- * @deprecated Global state is bad.
|
88
|
|
- */
|
89
|
|
- @Deprecated
|
90
|
|
- public static void setAliasWrapper(final AliasWrapper wrapper) {
|
91
|
|
- me = wrapper;
|
92
|
|
- }
|
93
|
|
-
|
94
|
77
|
/**
|
95
|
78
|
* Retrieves a list of alias names registered with this wrapper.
|
96
|
79
|
*
|