Browse Source

Deprecation fixes

Sprinkle some annotations over the CommandManager
More fiddling with NB7.1 settings

Change-Id: I2a0b751798249d4cc3e527f6d2e5525d1936f0e1
Reviewed-on: http://gerrit.dmdirc.com/2278
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.6.7rc1
Chris Smith 12 years ago
parent
commit
d4507e0b3a
32 changed files with 188 additions and 129 deletions
  1. 3
    1
      nbproject/project.properties
  2. 2
    1
      src/com/dmdirc/CustomWindow.java
  3. 6
    3
      src/com/dmdirc/GlobalWindow.java
  4. 6
    6
      src/com/dmdirc/Main.java
  5. 7
    6
      src/com/dmdirc/actions/Action.java
  6. 2
    2
      src/com/dmdirc/actions/ActionSubstitutor.java
  7. 4
    4
      src/com/dmdirc/commandline/CommandLineParser.java
  8. 60
    34
      src/com/dmdirc/commandparser/CommandManager.java
  9. 4
    4
      src/com/dmdirc/commandparser/commands/global/Set.java
  10. 3
    3
      src/com/dmdirc/commandparser/parsers/CommandParser.java
  11. 9
    8
      src/com/dmdirc/config/CipherUtils.java
  12. 4
    0
      src/com/dmdirc/config/ConfigBinder.java
  13. 2
    2
      src/com/dmdirc/config/IdentityManager.java
  14. 2
    1
      src/com/dmdirc/config/validators/URLProtocolValidator.java
  15. 2
    2
      src/com/dmdirc/logger/ErrorManager.java
  16. 2
    1
      src/com/dmdirc/logger/ProgramError.java
  17. 11
    5
      src/com/dmdirc/plugins/PluginManager.java
  18. 6
    4
      src/com/dmdirc/ui/FatalErrorDialog.java
  19. 4
    4
      src/com/dmdirc/ui/core/util/Info.java
  20. 7
    9
      src/com/dmdirc/ui/core/util/URLHandler.java
  21. 2
    2
      src/com/dmdirc/ui/input/TabCompleter.java
  22. 2
    2
      src/com/dmdirc/ui/input/TabCompleterResult.java
  23. 6
    3
      src/com/dmdirc/ui/messages/ColourManager.java
  24. 3
    2
      src/com/dmdirc/ui/themes/ThemeManager.java
  25. 8
    6
      src/com/dmdirc/updater/UpdateChecker.java
  26. 2
    2
      src/com/dmdirc/updater/components/ClientComponent.java
  27. 2
    1
      src/com/dmdirc/updater/components/DefaultsComponent.java
  28. 2
    1
      src/com/dmdirc/updater/components/ModeAliasesComponent.java
  29. 1
    1
      src/com/dmdirc/updater/components/PluginComponent.java
  30. 6
    6
      test/com/dmdirc/config/IdentityManagerTest.java
  31. 7
    2
      test/com/dmdirc/config/prefs/PreferencesSettingTest.java
  32. 1
    1
      test/com/dmdirc/harness/TestWritableFrameContainer.java

+ 3
- 1
nbproject/project.properties View File

9
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
9
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
10
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
10
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
11
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
11
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
12
-auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=com.dmdirc;java;javax;org;*
12
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.allowConvertToStarImport=false
13
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=com.dmdirc;java;javax;org;*;static *
14
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateStaticImports=true
13
 endorsed.classpath=
15
 endorsed.classpath=
14
 javac.processorpath=\
16
 javac.processorpath=\
15
     ${javac.classpath}
17
     ${javac.classpath}

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

55
      * @param title The parent of this custom window
55
      * @param title The parent of this custom window
56
      */
56
      */
57
     public CustomWindow(final String name, final String title) {
57
     public CustomWindow(final String name, final String title) {
58
-        super("custom", name, title, IdentityManager.getGlobalConfig(),
58
+        super("custom", name, title,
59
+                IdentityManager.getIdentityManager().getGlobalConfiguration(),
59
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
60
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier()));
60
 
61
 
61
         WindowManager.getWindowManager().addWindow(this);
62
         WindowManager.getWindowManager().addWindow(this);

+ 6
- 3
src/com/dmdirc/GlobalWindow.java View File

48
 
48
 
49
     /** Creates a new instance of GlobalWindow. */
49
     /** Creates a new instance of GlobalWindow. */
50
     public GlobalWindow() {
50
     public GlobalWindow() {
51
-        super("icon", "Global", "(Global)",IdentityManager.getGlobalConfig(),
51
+        super("icon", "Global", "(Global)",
52
+                IdentityManager.getIdentityManager().getGlobalConfiguration(),
52
                 GlobalCommandParser.getGlobalCommandParser(),
53
                 GlobalCommandParser.getGlobalCommandParser(),
53
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
54
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
54
                 WindowComponent.INPUTFIELD.getIdentifier()));
55
                 WindowComponent.INPUTFIELD.getIdentifier()));
106
      * Initialises the global window if it's enabled in the config.
107
      * Initialises the global window if it's enabled in the config.
107
      */
108
      */
108
     public static void init() {
109
     public static void init() {
109
-        IdentityManager.getGlobalConfig().addChangeListener("general", "showglobalwindow",
110
+        IdentityManager.getIdentityManager().getGlobalConfiguration()
111
+                .addChangeListener("general", "showglobalwindow",
110
                 new ConfigChangeListener() {
112
                 new ConfigChangeListener() {
111
 
113
 
112
             @Override
114
             @Override
124
      */
126
      */
125
     protected static void updateWindowState() {
127
     protected static void updateWindowState() {
126
         synchronized (GlobalWindow.class) {
128
         synchronized (GlobalWindow.class) {
127
-            if (IdentityManager.getGlobalConfig().getOptionBool("general", "showglobalwindow")) {
129
+            if (IdentityManager.getIdentityManager().getGlobalConfiguration()
130
+                    .getOptionBool("general", "showglobalwindow")) {
128
                 if (globalWindow == null) {
131
                 if (globalWindow == null) {
129
                     globalWindow = new GlobalWindow();
132
                     globalWindow = new GlobalWindow();
130
                 }
133
                 }

+ 6
- 6
src/com/dmdirc/Main.java View File

121
         MessageSinkManager.getManager().loadDefaultSinks();
121
         MessageSinkManager.getManager().loadDefaultSinks();
122
 
122
 
123
         final PluginManager pm = PluginManager.getPluginManager();
123
         final PluginManager pm = PluginManager.getPluginManager();
124
-        checkBundledPlugins(pm, IdentityManager.getGlobalConfig());
124
+        checkBundledPlugins(pm, IdentityManager.getIdentityManager().getGlobalConfiguration());
125
 
125
 
126
         ThemeManager.loadThemes();
126
         ThemeManager.loadThemes();
127
 
127
 
178
      */
178
      */
179
     private static void handleMissingUI() {
179
     private static void handleMissingUI() {
180
         // Check to see if we have already tried this
180
         // Check to see if we have already tried this
181
-        if (IdentityManager.getGlobalConfig().hasOptionBool("debug", "uiFixAttempted")) {
181
+        if (IdentityManager.getIdentityManager().getGlobalConfiguration().hasOptionBool("debug", "uiFixAttempted")) {
182
             System.out.println("DMDirc is unable to load any compatible UI plugins.");
182
             System.out.println("DMDirc is unable to load any compatible UI plugins.");
183
             if (!GraphicsEnvironment.isHeadless()) {
183
             if (!GraphicsEnvironment.isHeadless()) {
184
                 new WarningDialog(WarningDialog.NO_COMPAT_UIS_TITLE,
184
                 new WarningDialog(WarningDialog.NO_COMPAT_UIS_TITLE,
185
                         WarningDialog.NO_RECOV_UIS).displayBlocking();
185
                         WarningDialog.NO_RECOV_UIS).displayBlocking();
186
             }
186
             }
187
-            IdentityManager.getConfigIdentity().unsetOption("debug", "uiFixAttempted");
187
+            IdentityManager.getIdentityManager().getGlobalConfigIdentity().unsetOption("debug", "uiFixAttempted");
188
             System.exit(1);
188
             System.exit(1);
189
         } else {
189
         } else {
190
             // Try to extract the UIs again incase they changed between versions
190
             // Try to extract the UIs again incase they changed between versions
312
             handleMissingUI();
312
             handleMissingUI();
313
         } else {
313
         } else {
314
             // The fix worked!
314
             // The fix worked!
315
-            if (IdentityManager.getGlobalConfig().hasOptionBool("debug", "uiFixAttempted")) {
315
+            if (IdentityManager.getIdentityManager().getGlobalConfiguration().hasOptionBool("debug", "uiFixAttempted")) {
316
                 IdentityManager.getConfigIdentity().unsetOption("debug", "uiFixAttempted");
316
                 IdentityManager.getConfigIdentity().unsetOption("debug", "uiFixAttempted");
317
             }
317
             }
318
         }
318
         }
322
      * Executes the first run or migration wizards as required.
322
      * Executes the first run or migration wizards as required.
323
      */
323
      */
324
     private static void doFirstRun() {
324
     private static void doFirstRun() {
325
-        if (IdentityManager.getGlobalConfig().getOptionBool("general", "firstRun")) {
325
+        if (IdentityManager.getIdentityManager().getGlobalConfiguration().getOptionBool("general", "firstRun")) {
326
             IdentityManager.getConfigIdentity().setOption("general", "firstRun", "false");
326
             IdentityManager.getConfigIdentity().setOption("general", "firstRun", "false");
327
             for (UIController controller : CONTROLLERS) {
327
             for (UIController controller : CONTROLLERS) {
328
                 controller.showFirstRunWizard();
328
                 controller.showFirstRunWizard();
355
      *                  operating system when the client exits
355
      *                  operating system when the client exits
356
      */
356
      */
357
     public static void quit(final int exitCode) {
357
     public static void quit(final int exitCode) {
358
-        quit(IdentityManager.getGlobalConfig().getOption("general",
358
+        quit(IdentityManager.getIdentityManager().getGlobalConfiguration().getOption("general",
359
                 "closemessage"), exitCode);
359
                 "closemessage"), exitCode);
360
     }
360
     }
361
 
361
 

+ 7
- 6
src/com/dmdirc/actions/Action.java View File

93
             error(ActionErrorType.FILE, "I/O error when loading action: " + ex.getMessage());
93
             error(ActionErrorType.FILE, "I/O error when loading action: " + ex.getMessage());
94
         }
94
         }
95
 
95
 
96
-        IdentityManager.getGlobalConfig().addChangeListener("disable_action",
96
+        IdentityManager.getIdentityManager().getGlobalConfiguration().addChangeListener("disable_action",
97
                 (group + "/" + name).replace(' ', '.'), this);
97
                 (group + "/" + name).replace(' ', '.'), this);
98
         checkDisabled();
98
         checkDisabled();
99
     }
99
     }
144
 
144
 
145
         save();
145
         save();
146
 
146
 
147
-        IdentityManager.getGlobalConfig().addChangeListener("disable_action",
147
+        IdentityManager.getIdentityManager().getGlobalConfiguration().addChangeListener("disable_action",
148
                 (group + "/" + name).replace(' ', '.'), this);
148
                 (group + "/" + name).replace(' ', '.'), this);
149
         checkDisabled();
149
         checkDisabled();
150
 
150
 
266
                 myGroup.getSettings().put(data.get("setting"), new PreferencesSetting(
266
                 myGroup.getSettings().put(data.get("setting"), new PreferencesSetting(
267
                         PreferencesType.valueOf(data.get("type")), "actions",
267
                         PreferencesType.valueOf(data.get("type")), "actions",
268
                         data.get("setting"), data.get("title"), data.get("tooltip"),
268
                         data.get("setting"), data.get("title"), data.get("tooltip"),
269
-                        IdentityManager.getGlobalConfig(), IdentityManager.getConfigIdentity()));
269
+                        IdentityManager.getIdentityManager().getGlobalConfiguration(),
270
+                        IdentityManager.getConfigIdentity()));
270
             }
271
             }
271
         }
272
         }
272
     }
273
     }
572
      */
573
      */
573
     protected void checkDisabled() {
574
     protected void checkDisabled() {
574
         final String key = (group + "/" + name).replace(' ', '.');
575
         final String key = (group + "/" + name).replace(' ', '.');
575
-        final boolean disabled = IdentityManager.getGlobalConfig()
576
-                .hasOptionBool("disable_action", key)
577
-                && IdentityManager.getGlobalConfig()
576
+        final boolean disabled = IdentityManager.getIdentityManager()
577
+                .getGlobalConfiguration().hasOptionBool("disable_action", key)
578
+                && IdentityManager.getIdentityManager().getGlobalConfiguration()
578
                 .getOptionBool("disable_action", key);
579
                 .getOptionBool("disable_action", key);
579
 
580
 
580
         if (disabled && status == ActionStatus.ACTIVE) {
581
         if (disabled && status == ActionStatus.ACTIVE) {

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

89
      * @return A list of global variable names that will be substituted
89
      * @return A list of global variable names that will be substituted
90
      */
90
      */
91
     public Set<String> getConfigSubstitutions() {
91
     public Set<String> getConfigSubstitutions() {
92
-        return IdentityManager.getGlobalConfig().getOptions("actions").keySet();
92
+        return IdentityManager.getIdentityManager().getGlobalConfiguration().getOptions("actions").keySet();
93
     }
93
     }
94
 
94
 
95
     /**
95
     /**
322
             }
322
             }
323
         }
323
         }
324
 
324
 
325
-        return IdentityManager.getGlobalConfig();
325
+        return IdentityManager.getIdentityManager().getGlobalConfiguration();
326
     }
326
     }
327
 
327
 
328
     /**
328
     /**

+ 4
- 4
src/com/dmdirc/commandline/CommandLineParser.java View File

302
     private static void doVersion() {
302
     private static void doVersion() {
303
         System.out.println("DMDirc - a cross-platform, open-source IRC client.");
303
         System.out.println("DMDirc - a cross-platform, open-source IRC client.");
304
         System.out.println();
304
         System.out.println();
305
-        System.out.println("        Version: "
306
-                + IdentityManager.getGlobalConfig().getOption("version", "version"));
307
-        System.out.println(" Update channel: "
308
-                + IdentityManager.getGlobalConfig().getOption("updater", "channel"));
305
+        System.out.println("        Version: " + IdentityManager.getIdentityManager()
306
+                .getGlobalConfiguration().getOption("version", "version"));
307
+        System.out.println(" Update channel: " + IdentityManager.getIdentityManager()
308
+                .getGlobalConfiguration().getOption("updater", "channel"));
309
         exit();
309
         exit();
310
     }
310
     }
311
 
311
 

+ 60
- 34
src/com/dmdirc/commandparser/CommandManager.java View File

22
 
22
 
23
 package com.dmdirc.commandparser;
23
 package com.dmdirc.commandparser;
24
 
24
 
25
-import com.dmdirc.interfaces.CommandController;
26
 import com.dmdirc.BasicServerFactory;
25
 import com.dmdirc.BasicServerFactory;
27
 import com.dmdirc.Query;
26
 import com.dmdirc.Query;
28
 import com.dmdirc.Server;
27
 import com.dmdirc.Server;
29
 import com.dmdirc.ServerManager;
28
 import com.dmdirc.ServerManager;
30
 import com.dmdirc.commandparser.commands.Command;
29
 import com.dmdirc.commandparser.commands.Command;
31
-import com.dmdirc.commandparser.commands.channel.*; //NOPMD
32
-import com.dmdirc.commandparser.commands.chat.*; //NOPMD
33
-import com.dmdirc.commandparser.commands.global.*; //NOPMD
34
-import com.dmdirc.commandparser.commands.server.*; //NOPMD
30
+import com.dmdirc.commandparser.commands.channel.Ban;
31
+import com.dmdirc.commandparser.commands.channel.Cycle;
32
+import com.dmdirc.commandparser.commands.channel.Invite;
33
+import com.dmdirc.commandparser.commands.channel.KickReason;
34
+import com.dmdirc.commandparser.commands.channel.Mode;
35
+import com.dmdirc.commandparser.commands.channel.Names;
36
+import com.dmdirc.commandparser.commands.channel.Part;
37
+import com.dmdirc.commandparser.commands.channel.SetNickColour;
38
+import com.dmdirc.commandparser.commands.channel.ShowTopic;
39
+import com.dmdirc.commandparser.commands.chat.Me;
40
+import com.dmdirc.commandparser.commands.global.AliasCommand;
41
+import com.dmdirc.commandparser.commands.global.AllServers;
42
+import com.dmdirc.commandparser.commands.global.Clear;
43
+import com.dmdirc.commandparser.commands.global.Echo;
44
+import com.dmdirc.commandparser.commands.global.Exit;
45
+import com.dmdirc.commandparser.commands.global.Help;
46
+import com.dmdirc.commandparser.commands.global.Ifplugin;
47
+import com.dmdirc.commandparser.commands.global.LoadPlugin;
48
+import com.dmdirc.commandparser.commands.global.NewServer;
49
+import com.dmdirc.commandparser.commands.global.Notify;
50
+import com.dmdirc.commandparser.commands.global.OpenWindow;
51
+import com.dmdirc.commandparser.commands.global.ReloadActions;
52
+import com.dmdirc.commandparser.commands.global.ReloadIdentities;
53
+import com.dmdirc.commandparser.commands.global.ReloadPlugin;
54
+import com.dmdirc.commandparser.commands.global.SaveConfig;
55
+import com.dmdirc.commandparser.commands.global.Set;
56
+import com.dmdirc.commandparser.commands.global.UnloadPlugin;
57
+import com.dmdirc.commandparser.commands.server.AllChannels;
58
+import com.dmdirc.commandparser.commands.server.Away;
59
+import com.dmdirc.commandparser.commands.server.Back;
60
+import com.dmdirc.commandparser.commands.server.ChangeServer;
61
+import com.dmdirc.commandparser.commands.server.Ctcp;
62
+import com.dmdirc.commandparser.commands.server.Disconnect;
63
+import com.dmdirc.commandparser.commands.server.Ignore;
64
+import com.dmdirc.commandparser.commands.server.JoinChannelCommand;
65
+import com.dmdirc.commandparser.commands.server.Message;
66
+import com.dmdirc.commandparser.commands.server.Nick;
67
+import com.dmdirc.commandparser.commands.server.Notice;
68
+import com.dmdirc.commandparser.commands.server.OpenQuery;
69
+import com.dmdirc.commandparser.commands.server.Raw;
70
+import com.dmdirc.commandparser.commands.server.RawServerCommand;
71
+import com.dmdirc.commandparser.commands.server.Reconnect;
72
+import com.dmdirc.commandparser.commands.server.Umode;
35
 import com.dmdirc.commandparser.parsers.CommandParser;
73
 import com.dmdirc.commandparser.parsers.CommandParser;
74
+import com.dmdirc.config.ConfigBinding;
36
 import com.dmdirc.config.IdentityManager;
75
 import com.dmdirc.config.IdentityManager;
37
-import com.dmdirc.interfaces.ConfigChangeListener;
76
+import com.dmdirc.interfaces.CommandController;
38
 import com.dmdirc.ui.input.TabCompleter;
77
 import com.dmdirc.ui.input.TabCompleter;
39
 import com.dmdirc.ui.input.TabCompletionType;
78
 import com.dmdirc.ui.input.TabCompletionType;
40
 import com.dmdirc.util.collections.MapList;
79
 import com.dmdirc.util.collections.MapList;
44
 import java.util.List;
83
 import java.util.List;
45
 import java.util.Map;
84
 import java.util.Map;
46
 
85
 
86
+import lombok.Getter;
87
+
47
 /**
88
 /**
48
  * The command manager creates and manages a single instance of all commands,
89
  * The command manager creates and manages a single instance of all commands,
49
  * and provides methods to load each group of commands into a parser instance.
90
  * and provides methods to load each group of commands into a parser instance.
50
  */
91
  */
92
+@SuppressWarnings("PMD.UnusedPrivateField")
51
 public class CommandManager implements CommandController {
93
 public class CommandManager implements CommandController {
52
 
94
 
53
     /** A singleton instance of the command manager. */
95
     /** A singleton instance of the command manager. */
62
             = new MapList<CommandType, CommandParser>();
104
             = new MapList<CommandType, CommandParser>();
63
 
105
 
64
     /** The command char we're using. */
106
     /** The command char we're using. */
65
-    private char commandChar = IdentityManager.getGlobalConfig()
66
-            .getOptionChar("general", "commandchar");
107
+    @ConfigBinding(domain="general", key="commandchar")
108
+    @Getter
109
+    private char commandChar;
67
 
110
 
68
     /** The silence char we're using. */
111
     /** The silence char we're using. */
69
-    private char silenceChar = IdentityManager.getGlobalConfig()
70
-            .getOptionChar("general", "silencechar");
71
-
72
-    /** {@inheritDoc} */
73
-    @Override
74
-    public char getCommandChar() {
75
-        return commandChar;
76
-    }
112
+    @ConfigBinding(domain="general", key="silencechar")
113
+    @Getter
114
+    private char silenceChar;
77
 
115
 
78
-    /** {@inheritDoc} */
79
-    @Override
80
-    public char getSilenceChar() {
81
-        return silenceChar;
116
+    /**
117
+     * Creates a new instance of the Command Manager.
118
+     */
119
+    public CommandManager() {
120
+        IdentityManager.getIdentityManager().getGlobalConfiguration()
121
+                .getBinder().bind(this, CommandManager.class);
82
     }
122
     }
83
 
123
 
84
     /** {@inheritDoc} */
124
     /** {@inheritDoc} */
261
         registerCommand(new ReloadPlugin(), ReloadPlugin.INFO);
301
         registerCommand(new ReloadPlugin(), ReloadPlugin.INFO);
262
         registerCommand(new SaveConfig(), SaveConfig.INFO);
302
         registerCommand(new SaveConfig(), SaveConfig.INFO);
263
         registerCommand(new Set(), Set.INFO);
303
         registerCommand(new Set(), Set.INFO);
264
-
265
-        // Set up a listener for config changes
266
-        final ConfigChangeListener listener = new ConfigChangeListener() {
267
-            @Override
268
-            public void configChanged(final String domain, final String key) {
269
-                commandChar = IdentityManager.getGlobalConfig()
270
-                        .getOptionChar("general", "commandchar");
271
-                silenceChar = IdentityManager.getGlobalConfig()
272
-                        .getOptionChar("general", "silencechar");
273
-            }
274
-        };
275
-
276
-        IdentityManager.getGlobalConfig().addChangeListener("general", "commandchar", listener);
277
-        IdentityManager.getGlobalConfig().addChangeListener("general", "silencechar", listener);
278
     }
304
     }
279
 
305
 
280
     /** {@inheritDoc} */
306
     /** {@inheritDoc} */

+ 4
- 4
src/com/dmdirc/commandparser/commands/global/Set.java View File

91
             return;
91
             return;
92
         }
92
         }
93
 
93
 
94
-        Identity identity = IdentityManager.getConfigIdentity();
95
-        ConfigManager manager = IdentityManager.getGlobalConfig();
94
+        Identity identity = IdentityManager.getIdentityManager().getGlobalConfigIdentity();
95
+        ConfigManager manager = IdentityManager.getIdentityManager().getGlobalConfiguration();
96
 
96
 
97
         if (res.hasFlag(serverFlag)) {
97
         if (res.hasFlag(serverFlag)) {
98
             if (origin.getServer() == null) {
98
             if (origin.getServer() == null) {
113
             }
113
             }
114
 
114
 
115
             final Channel channel = ((ChannelCommandContext) context).getChannel();
115
             final Channel channel = ((ChannelCommandContext) context).getChannel();
116
-            identity = IdentityManager.getChannelConfig(origin.getServer().getNetwork(),
117
-                    channel.getName());
116
+            identity = IdentityManager.getIdentityManager().createChannelConfig(
117
+                    origin.getServer().getNetwork(), channel.getName());
118
             manager = channel.getConfigManager();
118
             manager = channel.getConfigManager();
119
         }
119
         }
120
 
120
 

+ 3
- 3
src/com/dmdirc/commandparser/parsers/CommandParser.java View File

72
     /** Creates a new instance of CommandParser. */
72
     /** Creates a new instance of CommandParser. */
73
     protected CommandParser() {
73
     protected CommandParser() {
74
         commands = new HashMap<String, CommandInfoPair>();
74
         commands = new HashMap<String, CommandInfoPair>();
75
-        history = new RollingList<PreviousCommand>(
76
-                IdentityManager.getGlobalConfig().getOptionInt("general",
77
-                    "commandhistory"));
75
+        history = new RollingList<PreviousCommand>(IdentityManager
76
+                .getIdentityManager().getGlobalConfiguration()
77
+                .getOptionInt("general", "commandhistory"));
78
         loadCommands();
78
         loadCommands();
79
     }
79
     }
80
 
80
 

+ 9
- 8
src/com/dmdirc/config/CipherUtils.java View File

194
      * @return true if auth was successful, false otherwise.
194
      * @return true if auth was successful, false otherwise.
195
      */
195
      */
196
     public boolean auth() {
196
     public boolean auth() {
197
+        final ConfigManager configManager = IdentityManager.getIdentityManager()
198
+                .getGlobalConfiguration();
199
+
197
         String passwordHash = null;
200
         String passwordHash = null;
198
         String prompt = "Please enter your password";
201
         String prompt = "Please enter your password";
199
         int tries = 1;
202
         int tries = 1;
200
-        if (IdentityManager.getGlobalConfig().hasOptionString("encryption", "password")) {
201
-            password = IdentityManager.getGlobalConfig().getOption("encryption", "password");
203
+        if (configManager.hasOptionString("encryption", "password")) {
204
+            password = configManager.getOption("encryption", "password");
202
         } else {
205
         } else {
203
-            if (IdentityManager.getGlobalConfig().hasOptionString("encryption",
204
-                    "passwordHash")) {
205
-                passwordHash = IdentityManager.getGlobalConfig().getOption("encryption",
206
-                        "passwordHash");
206
+            if (configManager.hasOptionString("encryption", "passwordHash")) {
207
+                passwordHash = configManager.getOption("encryption", "passwordHash");
207
             }
208
             }
208
 
209
 
209
             while ((password == null || password.isEmpty()) && tries < AUTH_TRIES) {
210
             while ((password == null || password.isEmpty()) && tries < AUTH_TRIES) {
210
                 password = getPassword(prompt);
211
                 password = getPassword(prompt);
211
                 if (passwordHash == null) {
212
                 if (passwordHash == null) {
212
                     passwordHash = hash(password);
213
                     passwordHash = hash(password);
213
-                    IdentityManager.getConfigIdentity().setOption("encryption",
214
-                            "passwordHash", passwordHash);
214
+                    IdentityManager.getIdentityManager().getGlobalConfigIdentity()
215
+                            .setOption("encryption", "passwordHash", passwordHash);
215
                 }
216
                 }
216
                 if (!hash(password).equals(passwordHash)) {
217
                 if (!hash(password).equals(passwordHash)) {
217
                     prompt = "<html>Password mis-match<br>Please re-enter "
218
                     prompt = "<html>Password mis-match<br>Please re-enter "

+ 4
- 0
src/com/dmdirc/config/ConfigBinder.java View File

175
             return manager.getOptionBool(binding.domain(), binding.key());
175
             return manager.getOptionBool(binding.domain(), binding.key());
176
         }
176
         }
177
 
177
 
178
+        if (targetClass.equals(Character.class) || targetClass.equals(Character.TYPE)) {
179
+            return manager.getOptionChar(binding.domain(), binding.key());
180
+        }
181
+
178
         return null;
182
         return null;
179
     }
183
     }
180
 
184
 

+ 2
- 2
src/com/dmdirc/config/IdentityManager.java View File

180
         // currently using, extract them.
180
         // currently using, extract them.
181
         if (getGlobalConfiguration().hasOptionString("identity", "defaultsversion")
181
         if (getGlobalConfiguration().hasOptionString("identity", "defaultsversion")
182
                 && getGlobalConfiguration().hasOptionString("updater", "bundleddefaultsversion")) {
182
                 && getGlobalConfiguration().hasOptionString("updater", "bundleddefaultsversion")) {
183
-            final Version installedVersion = new Version(getGlobalConfig()
183
+            final Version installedVersion = new Version(getGlobalConfiguration()
184
                     .getOption("identity", "defaultsversion"));
184
                     .getOption("identity", "defaultsversion"));
185
-            final Version bundledVersion = new Version(getGlobalConfig()
185
+            final Version bundledVersion = new Version(getGlobalConfiguration()
186
                     .getOption("updater", "bundleddefaultsversion"));
186
                     .getOption("updater", "bundleddefaultsversion"));
187
 
187
 
188
             if (bundledVersion.compareTo(installedVersion) > 0) {
188
             if (bundledVersion.compareTo(installedVersion) > 0) {

+ 2
- 1
src/com/dmdirc/config/validators/URLProtocolValidator.java View File

36
     public ValidationResponse validate(final String object) {
36
     public ValidationResponse validate(final String object) {
37
         if (object == null || object.isEmpty()) {
37
         if (object == null || object.isEmpty()) {
38
             return new ValidationResponse("Cannot be empty");
38
             return new ValidationResponse("Cannot be empty");
39
-        } else if (IdentityManager.getGlobalConfig().hasOptionString("protocol", object)) {
39
+        } else if (IdentityManager.getIdentityManager().getGlobalConfiguration()
40
+                .hasOptionString("protocol", object)) {
40
             return new ValidationResponse("Cannot already exist");
41
             return new ValidationResponse("Cannot already exist");
41
         } else {
42
         } else {
42
             return new ValidationResponse();
43
             return new ValidationResponse();

+ 2
- 2
src/com/dmdirc/logger/ErrorManager.java View File

78
         errors = new LinkedList<ProgramError>();
78
         errors = new LinkedList<ProgramError>();
79
         nextErrorID = new AtomicLong();
79
         nextErrorID = new AtomicLong();
80
 
80
 
81
-        final ConfigManager config = IdentityManager.getGlobalConfig();
81
+        final ConfigManager config = IdentityManager.getIdentityManager().getGlobalConfiguration();
82
 
82
 
83
         config.addChangeListener("general", "logerrors", this);
83
         config.addChangeListener("general", "logerrors", this);
84
         config.addChangeListener("general", "submitErrors", this);
84
         config.addChangeListener("general", "submitErrors", this);
465
 
465
 
466
     /** Updates the settings used by this error manager. */
466
     /** Updates the settings used by this error manager. */
467
     protected void updateSettings() {
467
     protected void updateSettings() {
468
-        final ConfigManager config = IdentityManager.getGlobalConfig();
468
+        final ConfigManager config = IdentityManager.getIdentityManager().getGlobalConfiguration();
469
 
469
 
470
         try {
470
         try {
471
             sendReports = config.getOptionBool("general", "submitErrors")
471
             sendReports = config.getOptionBool("general", "submitErrors")

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

315
         }
315
         }
316
         postData.put("message", getMessage());
316
         postData.put("message", getMessage());
317
         postData.put("trace", traceString);
317
         postData.put("trace", traceString);
318
-        postData.put("version", IdentityManager.getGlobalConfig().getOption("version", "version"));
318
+        postData.put("version", IdentityManager.getIdentityManager()
319
+                .getGlobalConfiguration().getOption("version", "version"));
319
 
320
 
320
         setReportStatus(ErrorReportStatus.SENDING);
321
         setReportStatus(ErrorReportStatus.SENDING);
321
 
322
 

+ 11
- 5
src/com/dmdirc/plugins/PluginManager.java View File

185
      * Autoloads plugins.
185
      * Autoloads plugins.
186
      */
186
      */
187
     public void doAutoLoad() {
187
     public void doAutoLoad() {
188
-        for (String plugin : IdentityManager.getGlobalConfig().getOptionList("plugins", "autoload")) {
188
+        for (String plugin : IdentityManager.getIdentityManager()
189
+                .getGlobalConfiguration().getOptionList("plugins", "autoload")) {
189
             plugin = plugin.trim();
190
             plugin = plugin.trim();
190
             if (!plugin.isEmpty() && plugin.charAt(0) != '#' && getPluginInfo(plugin) != null) {
191
             if (!plugin.isEmpty() && plugin.charAt(0) != '#' && getPluginInfo(plugin) != null) {
191
                 getPluginInfo(plugin).loadPlugin();
192
                 getPluginInfo(plugin).loadPlugin();
363
     public String getFilesDirectory() {
364
     public String getFilesDirectory() {
364
         final String fs = System.getProperty("file.separator");
365
         final String fs = System.getProperty("file.separator");
365
         String filesDir = myDir + "files" + fs;
366
         String filesDir = myDir + "files" + fs;
366
-        if (IdentityManager.getGlobalConfig().hasOptionString("plugins", "filesdir")) {
367
-            final String fdopt = IdentityManager.getGlobalConfig().getOptionString("plugins", "filesdir");
367
+        if (IdentityManager.getIdentityManager().getGlobalConfiguration()
368
+                .hasOptionString("plugins", "filesdir")) {
369
+            final String fdopt = IdentityManager.getIdentityManager()
370
+                    .getGlobalConfiguration().getOptionString("plugins", "filesdir");
371
+
368
             if (fdopt != null && !fdopt.isEmpty() && new File(fdopt).exists()) {
372
             if (fdopt != null && !fdopt.isEmpty() && new File(fdopt).exists()) {
369
                 filesDir = fdopt;
373
                 filesDir = fdopt;
370
             }
374
             }
512
      * @param plugin to add/remove (Decided automatically based on isLoaded())
516
      * @param plugin to add/remove (Decided automatically based on isLoaded())
513
      */
517
      */
514
     public void updateAutoLoad(final PluginInfo plugin) {
518
     public void updateAutoLoad(final PluginInfo plugin) {
515
-        final List<String> list = IdentityManager.getGlobalConfig().getOptionList("plugins", "autoload");
519
+        final List<String> list = IdentityManager.getIdentityManager()
520
+                .getGlobalConfiguration().getOptionList("plugins", "autoload");
516
         final String path = plugin.getMetaData().getRelativeFilename();
521
         final String path = plugin.getMetaData().getRelativeFilename();
517
 
522
 
518
         if (plugin.isLoaded() && !list.contains(path)) {
523
         if (plugin.isLoaded() && !list.contains(path)) {
521
             list.remove(path);
526
             list.remove(path);
522
         }
527
         }
523
 
528
 
524
-        IdentityManager.getConfigIdentity().setOption("plugins", "autoload", list);
529
+        IdentityManager.getIdentityManager().getGlobalConfigIdentity()
530
+                .setOption("plugins", "autoload", list);
525
     }
531
     }
526
 
532
 
527
     /**
533
     /**

+ 6
- 4
src/com/dmdirc/ui/FatalErrorDialog.java View File

135
 
135
 
136
         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
136
         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
137
         setTitle("DMDirc: Fatal Error");
137
         setTitle("DMDirc: Fatal Error");
138
-        setIconImage(new IconManager(IdentityManager.getGlobalConfig())
139
-                .getImage("icon"));
138
+
139
+        final IconManager iconManager = new IconManager(IdentityManager
140
+                .getIdentityManager().getGlobalConfiguration());
141
+
142
+        setIconImage(iconManager.getImage("icon"));
140
 
143
 
141
         infoLabel.setText("DMDirc has encountered a fatal error, and is "
144
         infoLabel.setText("DMDirc has encountered a fatal error, and is "
142
                 + "not able to recover. \nThe application will now terminate.");
145
                 + "not able to recover. \nThe application will now terminate.");
146
         ((StyledDocument) messageLabel.getDocument()).setParagraphAttributes(0,
149
         ((StyledDocument) messageLabel.getDocument()).setParagraphAttributes(0,
147
                 messageLabel.getText().length(), sas, false);
150
                 messageLabel.getText().length(), sas, false);
148
 
151
 
149
-        icon = new ImageIcon(new IconManager(IdentityManager.getGlobalConfig())
150
-                .getImage("error"));
152
+        icon = new ImageIcon(iconManager.getImage("error"));
151
 
153
 
152
         stacktraceField.setEditable(false);
154
         stacktraceField.setEditable(false);
153
 
155
 

+ 4
- 4
src/com/dmdirc/ui/core/util/Info.java View File

43
      * @return DMDirc version string
43
      * @return DMDirc version string
44
      */
44
      */
45
     public static String getDMDircVersion() {
45
     public static String getDMDircVersion() {
46
-        return IdentityManager.getGlobalConfig().getOption("version", "version")
47
-                + " ("
48
-                + IdentityManager.getGlobalConfig().getOption("updater", "channel")
49
-                + ")";
46
+        return IdentityManager.getIdentityManager().getGlobalConfiguration()
47
+                .getOption("version", "version") + " ("
48
+                + IdentityManager.getIdentityManager().getGlobalConfiguration()
49
+                .getOption("updater", "channel") + ")";
50
     }
50
     }
51
 
51
 
52
     /**
52
     /**

+ 7
- 9
src/com/dmdirc/ui/core/util/URLHandler.java View File

25
 import com.dmdirc.ServerManager;
25
 import com.dmdirc.ServerManager;
26
 import com.dmdirc.config.ConfigManager;
26
 import com.dmdirc.config.ConfigManager;
27
 import com.dmdirc.config.IdentityManager;
27
 import com.dmdirc.config.IdentityManager;
28
+import com.dmdirc.interfaces.ui.UIController;
28
 import com.dmdirc.logger.ErrorLevel;
29
 import com.dmdirc.logger.ErrorLevel;
29
 import com.dmdirc.logger.Logger;
30
 import com.dmdirc.logger.Logger;
30
 import com.dmdirc.ui.StatusMessage;
31
 import com.dmdirc.ui.StatusMessage;
31
 import com.dmdirc.ui.core.components.StatusBarManager;
32
 import com.dmdirc.ui.core.components.StatusBarManager;
32
-import com.dmdirc.interfaces.ui.UIController;
33
 import com.dmdirc.util.CommandUtils;
33
 import com.dmdirc.util.CommandUtils;
34
 
34
 
35
 import java.awt.Desktop;
35
 import java.awt.Desktop;
58
      */
58
      */
59
     public URLHandler(final UIController controller) {
59
     public URLHandler(final UIController controller) {
60
         this.controller = controller;
60
         this.controller = controller;
61
-        this.config = IdentityManager.getGlobalConfig();
61
+        this.config = IdentityManager.getIdentityManager().getGlobalConfiguration();
62
         this.desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
62
         this.desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
63
     }
63
     }
64
 
64
 
137
         final Date oldLaunch = lastLaunch;
137
         final Date oldLaunch = lastLaunch;
138
         lastLaunch = new Date();
138
         lastLaunch = new Date();
139
 
139
 
140
-        if (IdentityManager.getGlobalConfig().getOptionBool("browser",
141
-                "uselaunchdelay") && oldLaunch != null) {
140
+        if (config.getOptionBool("browser", "uselaunchdelay") && oldLaunch != null) {
142
             final Long diff = lastLaunch.getTime() - oldLaunch.getTime();
141
             final Long diff = lastLaunch.getTime() - oldLaunch.getTime();
143
 
142
 
144
-            if (diff < IdentityManager.getGlobalConfig().getOptionInt("browser",
145
-                    "launchdelay")) {
143
+            if (diff < config.getOptionInt("browser", "launchdelay")) {
146
                 return;
144
                 return;
147
             }
145
             }
148
         }
146
         }
157
         if ("DMDIRC".equals(command)) {
155
         if ("DMDIRC".equals(command)) {
158
             StatusBarManager.getStatusBarManager().setMessage(
156
             StatusBarManager.getStatusBarManager().setMessage(
159
                     new StatusMessage("Connecting to: " + uri.toString(),
157
                     new StatusMessage("Connecting to: " + uri.toString(),
160
-                    IdentityManager.getGlobalConfig()));
158
+                    config));
161
             ServerManager.getServerManager().connectToAddress(uri);
159
             ServerManager.getServerManager().connectToAddress(uri);
162
         } else if ("BROWSER".equals(command)) {
160
         } else if ("BROWSER".equals(command)) {
163
             StatusBarManager.getStatusBarManager().setMessage(
161
             StatusBarManager.getStatusBarManager().setMessage(
164
                     new StatusMessage("Opening: " + uri.toString(),
162
                     new StatusMessage("Opening: " + uri.toString(),
165
-                    IdentityManager.getGlobalConfig()));
163
+                    config));
166
             execBrowser(uri);
164
             execBrowser(uri);
167
         } else if ("MAIL".equals(command)) {
165
         } else if ("MAIL".equals(command)) {
168
             execMail(uri);
166
             execMail(uri);
169
         } else {
167
         } else {
170
             StatusBarManager.getStatusBarManager().setMessage(
168
             StatusBarManager.getStatusBarManager().setMessage(
171
                     new StatusMessage("Opening: " + uri.toString(),
169
                     new StatusMessage("Opening: " + uri.toString(),
172
-                    IdentityManager.getGlobalConfig()));
170
+                    config));
173
             execApp(substituteParams(uri, command));
171
             execApp(substituteParams(uri, command));
174
         }
172
         }
175
     }
173
     }

+ 2
- 2
src/com/dmdirc/ui/input/TabCompleter.java View File

83
         final MapList<TabCompletionType, String> targets
83
         final MapList<TabCompletionType, String> targets
84
                 = new MapList<TabCompletionType, String>(entries);
84
                 = new MapList<TabCompletionType, String>(entries);
85
 
85
 
86
-        final boolean caseSensitive = IdentityManager.getGlobalConfig()
86
+        final boolean caseSensitive = IdentityManager.getIdentityManager().getGlobalConfiguration()
87
                 .getOptionBool("tabcompletion", "casesensitive");
87
                 .getOptionBool("tabcompletion", "casesensitive");
88
-        final boolean allowEmpty = IdentityManager.getGlobalConfig()
88
+        final boolean allowEmpty = IdentityManager.getIdentityManager().getGlobalConfiguration()
89
                 .getOptionBool("tabcompletion", "allowempty");
89
                 .getOptionBool("tabcompletion", "allowempty");
90
 
90
 
91
         if (partial.isEmpty() && !allowEmpty) {
91
         if (partial.isEmpty() && !allowEmpty) {

+ 2
- 2
src/com/dmdirc/ui/input/TabCompleterResult.java View File

99
             return "";
99
             return "";
100
         }
100
         }
101
 
101
 
102
-        final boolean caseSensitive = IdentityManager.getGlobalConfig()
103
-                .getOptionBool("tabcompletion", "casesensitive");
102
+        final boolean caseSensitive = IdentityManager.getIdentityManager()
103
+                .getGlobalConfiguration().getOptionBool("tabcompletion", "casesensitive");
104
 
104
 
105
         String res = results.get(0);
105
         String res = results.get(0);
106
         for (String entry : results) {
106
         for (String entry : results) {

+ 6
- 3
src/com/dmdirc/ui/messages/ColourManager.java View File

22
 
22
 
23
 package com.dmdirc.ui.messages;
23
 package com.dmdirc.ui.messages;
24
 
24
 
25
+import com.dmdirc.config.ConfigManager;
25
 import com.dmdirc.config.IdentityManager;
26
 import com.dmdirc.config.IdentityManager;
26
 import com.dmdirc.interfaces.ConfigChangeListener;
27
 import com.dmdirc.interfaces.ConfigChangeListener;
27
 import com.dmdirc.logger.ErrorLevel;
28
 import com.dmdirc.logger.ErrorLevel;
59
      * Initialises the IRC_COLOURS array.
60
      * Initialises the IRC_COLOURS array.
60
      */
61
      */
61
     private static void initColours() {
62
     private static void initColours() {
63
+        final ConfigManager configManager = IdentityManager.getIdentityManager()
64
+                .getGlobalConfiguration();
65
+
62
         for (int i = 0; i < 16; i++) {
66
         for (int i = 0; i < 16; i++) {
63
-            if (IdentityManager.getGlobalConfig().hasOptionColour("colour", String.valueOf(i))) {
64
-                ircColours[i] = IdentityManager.getGlobalConfig()
65
-                        .getOptionColour("colour", String.valueOf(i));
67
+            if (configManager.hasOptionColour("colour", String.valueOf(i))) {
68
+                ircColours[i] = configManager.getOptionColour("colour", String.valueOf(i));
66
                 COLOUR_CACHE.remove(String.valueOf(i));
69
                 COLOUR_CACHE.remove(String.valueOf(i));
67
             } else if (!ircColours[i].equals(DEFAULT_COLOURS[i])) {
70
             } else if (!ircColours[i].equals(DEFAULT_COLOURS[i])) {
68
                 ircColours[i] = DEFAULT_COLOURS[i];
71
                 ircColours[i] = DEFAULT_COLOURS[i];

+ 3
- 2
src/com/dmdirc/ui/themes/ThemeManager.java View File

44
     private static final Map<String, Theme> THEMES = new HashMap<String, Theme>();
44
     private static final Map<String, Theme> THEMES = new HashMap<String, Theme>();
45
 
45
 
46
     static {
46
     static {
47
-        IdentityManager.getGlobalConfig().addChangeListener("themes", "enabled",
47
+        IdentityManager.getIdentityManager().getGlobalConfiguration()
48
+                .addChangeListener("themes", "enabled",
48
                 new ConfigChangeListener() {
49
                 new ConfigChangeListener() {
49
             /** {@inheritDoc} */
50
             /** {@inheritDoc} */
50
             @Override
51
             @Override
76
             return;
77
             return;
77
         }
78
         }
78
 
79
 
79
-        final List<String> enabled = IdentityManager.getGlobalConfig()
80
+        final List<String> enabled = IdentityManager.getIdentityManager().getGlobalConfiguration()
80
                 .getOptionList("themes", "enabled");
81
                 .getOptionList("themes", "enabled");
81
 
82
 
82
         synchronized (THEMES) {
83
         synchronized (THEMES) {

+ 8
- 6
src/com/dmdirc/updater/UpdateChecker.java View File

118
             return;
118
             return;
119
         }
119
         }
120
 
120
 
121
-        final ConfigManager config = IdentityManager.getGlobalConfig();
121
+        final ConfigManager config = IdentityManager.getIdentityManager().getGlobalConfiguration();
122
 
122
 
123
         if (!config.getOptionBool(DOMAIN, "enable")
123
         if (!config.getOptionBool(DOMAIN, "enable")
124
                 || status == STATE.UPDATING) {
124
                 || status == STATE.UPDATING) {
265
      * frequency specified in the config.
265
      * frequency specified in the config.
266
      */
266
      */
267
     public static void init() {
267
     public static void init() {
268
-        for (String update : IdentityManager.getGlobalConfig().getOptionList(DOMAIN, "updates")) {
268
+        for (String update : IdentityManager.getIdentityManager()
269
+                .getGlobalConfiguration().getOptionList(DOMAIN, "updates")) {
269
             checkLine(update);
270
             checkLine(update);
270
         }
271
         }
271
 
272
 
282
      * @since 0.6.5
283
      * @since 0.6.5
283
      */
284
      */
284
     protected static void initTimer() {
285
     protected static void initTimer() {
285
-        final int last = IdentityManager.getGlobalConfig()
286
+        final int last = IdentityManager.getIdentityManager().getGlobalConfiguration()
286
                 .getOptionInt(DOMAIN, "lastcheck");
287
                 .getOptionInt(DOMAIN, "lastcheck");
287
-        final int freq = IdentityManager.getGlobalConfig()
288
+        final int freq = IdentityManager.getIdentityManager().getGlobalConfiguration()
288
                 .getOptionInt(DOMAIN, "frequency");
289
                 .getOptionInt(DOMAIN, "frequency");
289
         final int timestamp = (int) (new Date().getTime() / 1000);
290
         final int timestamp = (int) (new Date().getTime() / 1000);
290
         int time = 0;
291
         int time = 0;
480
      * @return true iif the update component is enabled
481
      * @return true iif the update component is enabled
481
      */
482
      */
482
     public static boolean isEnabled(final UpdateComponent component) {
483
     public static boolean isEnabled(final UpdateComponent component) {
483
-        return !IdentityManager.getGlobalConfig().hasOptionBool(DOMAIN,
484
-                "enable-" + component.getName()) || IdentityManager.getGlobalConfig()
484
+        return !IdentityManager.getIdentityManager().getGlobalConfiguration()
485
+                .hasOptionBool(DOMAIN, "enable-" + component.getName())
486
+                || IdentityManager.getIdentityManager().getGlobalConfiguration()
485
                 .getOptionBool(DOMAIN, "enable-" + component.getName());
487
                 .getOptionBool(DOMAIN, "enable-" + component.getName());
486
     }
488
     }
487
 
489
 

+ 2
- 2
src/com/dmdirc/updater/components/ClientComponent.java View File

98
     /** {@inheritDoc} */
98
     /** {@inheritDoc} */
99
     @Override
99
     @Override
100
     public String getFriendlyVersion() {
100
     public String getFriendlyVersion() {
101
-        return IdentityManager.getGlobalConfig().getOption("version",
102
-                "version");
101
+        return IdentityManager.getIdentityManager().getGlobalConfiguration()
102
+                .getOption("version", "version");
103
     }
103
     }
104
 
104
 
105
     /** {@inheritDoc} */
105
     /** {@inheritDoc} */

+ 2
- 1
src/com/dmdirc/updater/components/DefaultsComponent.java View File

57
     /** {@inheritDoc} */
57
     /** {@inheritDoc} */
58
     @Override
58
     @Override
59
     public Version getVersion() {
59
     public Version getVersion() {
60
-        final ConfigManager globalConfig = IdentityManager.getGlobalConfig();
60
+        final ConfigManager globalConfig = IdentityManager.getIdentityManager()
61
+                .getGlobalConfiguration();
61
 
62
 
62
         if (globalConfig.hasOptionString("identity", "defaultsversion")) {
63
         if (globalConfig.hasOptionString("identity", "defaultsversion")) {
63
             return new Version(globalConfig.getOption("identity",
64
             return new Version(globalConfig.getOption("identity",

+ 2
- 1
src/com/dmdirc/updater/components/ModeAliasesComponent.java View File

57
     /** {@inheritDoc} */
57
     /** {@inheritDoc} */
58
     @Override
58
     @Override
59
     public Version getVersion() {
59
     public Version getVersion() {
60
-        final ConfigManager globalConfig = IdentityManager.getGlobalConfig();
60
+        final ConfigManager globalConfig = IdentityManager.getIdentityManager()
61
+                .getGlobalConfiguration();
61
 
62
 
62
         if (globalConfig.hasOptionString("identity", "modealiasversion")) {
63
         if (globalConfig.hasOptionString("identity", "modealiasversion")) {
63
             return new Version(globalConfig.getOption("identity",
64
             return new Version(globalConfig.getOption("identity",

+ 1
- 1
src/com/dmdirc/updater/components/PluginComponent.java View File

38
 public class PluginComponent implements UpdateComponent, FileComponent {
38
 public class PluginComponent implements UpdateComponent, FileComponent {
39
 
39
 
40
     /** The config to use. */
40
     /** The config to use. */
41
-    private static final ConfigManager CONFIG = IdentityManager.getGlobalConfig();
41
+    private static final ConfigManager CONFIG = IdentityManager.getIdentityManager().getGlobalConfiguration();
42
 
42
 
43
     /** The plugin this component is for. */
43
     /** The plugin this component is for. */
44
     private final PluginInfo plugin;
44
     private final PluginInfo plugin;

+ 6
- 6
test/com/dmdirc/config/IdentityManagerTest.java View File

22
 
22
 
23
 package com.dmdirc.config;
23
 package com.dmdirc.config;
24
 
24
 
25
+import static org.junit.Assert.assertTrue;
25
 import org.junit.Before;
26
 import org.junit.Before;
26
 import org.junit.Test;
27
 import org.junit.Test;
27
-import static org.junit.Assert.*;
28
 
28
 
29
 public class IdentityManagerTest {
29
 public class IdentityManagerTest {
30
 
30
 
31
     @Before
31
     @Before
32
-    public void setUp() throws Exception {        
33
-        IdentityManager.load();
32
+    public void setUp() throws Exception {
33
+        IdentityManager.getIdentityManager().initialise();
34
     }
34
     }
35
 
35
 
36
     @Test
36
     @Test
37
     public void testGetGlobalConfig() {
37
     public void testGetGlobalConfig() {
38
-        final ConfigManager gcm = IdentityManager.getGlobalConfig();
39
-        
38
+        final ConfigManager gcm = IdentityManager.getIdentityManager().getGlobalConfiguration();
39
+
40
         for (Identity identity : gcm.getSources()) {
40
         for (Identity identity : gcm.getSources()) {
41
             assertTrue(identity.getTarget().getType() == ConfigTarget.TYPE.GLOBAL
41
             assertTrue(identity.getTarget().getType() == ConfigTarget.TYPE.GLOBAL
42
                     || identity.getTarget().getType() == ConfigTarget.TYPE.GLOBALDEFAULT
42
                     || identity.getTarget().getType() == ConfigTarget.TYPE.GLOBALDEFAULT
43
                     || identity.getTarget().getType() == ConfigTarget.TYPE.THEME);
43
                     || identity.getTarget().getType() == ConfigTarget.TYPE.THEME);
44
         }
44
         }
45
     }
45
     }
46
-    
46
+
47
 }
47
 }

+ 7
- 2
test/com/dmdirc/config/prefs/PreferencesSettingTest.java View File

26
 import com.dmdirc.util.validators.NotEmptyValidator;
26
 import com.dmdirc.util.validators.NotEmptyValidator;
27
 import com.dmdirc.util.validators.PermissiveValidator;
27
 import com.dmdirc.util.validators.PermissiveValidator;
28
 import com.dmdirc.util.validators.StringLengthValidator;
28
 import com.dmdirc.util.validators.StringLengthValidator;
29
+
29
 import java.util.HashMap;
30
 import java.util.HashMap;
30
 import java.util.Map;
31
 import java.util.Map;
32
+
31
 import org.junit.BeforeClass;
33
 import org.junit.BeforeClass;
32
 import org.junit.Test;
34
 import org.junit.Test;
35
+
33
 import static org.junit.Assert.*;
36
 import static org.junit.Assert.*;
34
 import static org.mockito.Mockito.*;
37
 import static org.mockito.Mockito.*;
35
 
38
 
180
 
183
 
181
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
184
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
182
                 "unit-test", "ps", "title", "helptext",
185
                 "unit-test", "ps", "title", "helptext",
183
-                IdentityManager.getGlobalConfig(), IdentityManager.getConfigIdentity());
186
+                IdentityManager.getIdentityManager().getGlobalConfiguration(),
187
+                IdentityManager.getConfigIdentity());
184
 
188
 
185
         assertFalse(ps.save());
189
         assertFalse(ps.save());
186
         ps.setValue(null);
190
         ps.setValue(null);
195
 
199
 
196
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
200
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
197
                 "unit-test", "ps", "title", "helptext",
201
                 "unit-test", "ps", "title", "helptext",
198
-                IdentityManager.getGlobalConfig(), IdentityManager.getConfigIdentity());
202
+                IdentityManager.getIdentityManager().getGlobalConfiguration(),
203
+                IdentityManager.getConfigIdentity());
199
 
204
 
200
         assertFalse(ps.save());
205
         assertFalse(ps.save());
201
         ps.setValue("def");
206
         ps.setValue("def");

+ 1
- 1
test/com/dmdirc/harness/TestWritableFrameContainer.java View File

45
     }
45
     }
46
 
46
 
47
     public TestWritableFrameContainer(final int lineLength) {
47
     public TestWritableFrameContainer(final int lineLength) {
48
-        this(lineLength, IdentityManager.getGlobalConfig());
48
+        this(lineLength, IdentityManager.getIdentityManager().getGlobalConfiguration());
49
     }
49
     }
50
 
50
 
51
     @Override
51
     @Override

Loading…
Cancel
Save