Browse Source

Remove some more usages of SwingController.

Change-Id: I8608be6d0352227d2eca226027f3f60c0f321ab7
Reviewed-on: http://gerrit.dmdirc.com/3054
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8
Chris Smith 10 years ago
parent
commit
272fb2bebd

+ 1
- 1
src/com/dmdirc/addons/ui_swing/SwingController.java View File

@@ -436,7 +436,7 @@ public class SwingController extends BaseCommandPlugin implements UIController {
436 436
         // Init the UI settings before we start any DI, as we might create frames etc.
437 437
         initUISettings();
438 438
 
439
-        setObjectGraph(graph.plus(new SwingModule(this)));
439
+        setObjectGraph(graph.plus(new SwingModule(this, pluginInfo.getDomain())));
440 440
         getObjectGraph().validate();
441 441
         swingManager = getObjectGraph().get(SwingManager.class);
442 442
 

+ 7
- 8
src/com/dmdirc/addons/ui_swing/commands/PopInCommand.java View File

@@ -23,7 +23,7 @@
23 23
 package com.dmdirc.addons.ui_swing.commands;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.addons.ui_swing.SwingController;
26
+import com.dmdirc.addons.ui_swing.SwingWindowFactory;
27 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29 29
 import com.dmdirc.commandparser.BaseCommandInfo;
@@ -46,21 +46,21 @@ public class PopInCommand extends Command {
46 46
             "popin - Reattaches the current window to the main client if it"
47 47
                 + " has been detached via the popin command.",
48 48
             CommandType.TYPE_GLOBAL);
49
-    /** SwingController associated with this popin Command. */
50
-    private final SwingController controller;
49
+    /** Factory to use to locate windows. */
50
+    private final SwingWindowFactory windowFactory;
51 51
 
52 52
     /**
53 53
      * Create a new instance of PopInCommand.
54 54
      *
55
-     * @param controller SwingWindowController associated with this command
55
+     * @param windowFactory Factory to use to locate windows.
56 56
      * @param commandController The command controller to use for command info.
57 57
      */
58 58
     @Inject
59 59
     public PopInCommand(
60
-            final SwingController controller,
60
+            final SwingWindowFactory windowFactory,
61 61
             final CommandController commandController) {
62 62
         super(commandController);
63
-        this.controller = controller;
63
+        this.windowFactory = windowFactory;
64 64
     }
65 65
 
66 66
     /** {@inheritDoc} */
@@ -71,8 +71,7 @@ public class PopInCommand extends Command {
71 71
             /** {@inheritDoc} */
72 72
             @Override
73 73
             public void run() {
74
-                final TextFrame swingWindow = controller.getWindowFactory()
75
-                        .getSwingWindow(origin);
74
+                final TextFrame swingWindow = windowFactory.getSwingWindow(origin);
76 75
                 if (swingWindow == null) {
77 76
                     sendLine(origin, args.isSilent(), FORMAT_ERROR, "There is"
78 77
                             + " currently no window to pop in.");

+ 7
- 8
src/com/dmdirc/addons/ui_swing/commands/PopOutCommand.java View File

@@ -23,7 +23,7 @@
23 23
 package com.dmdirc.addons.ui_swing.commands;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.addons.ui_swing.SwingController;
26
+import com.dmdirc.addons.ui_swing.SwingWindowFactory;
27 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29 29
 import com.dmdirc.commandparser.BaseCommandInfo;
@@ -46,21 +46,21 @@ public class PopOutCommand extends Command {
46 46
             "popout - Makes the current window pop out of the client as a "
47 47
                 + "free floating window on your desktop.",
48 48
             CommandType.TYPE_GLOBAL);
49
-    /** SwingController associated with this popout Command. */
50
-    private final SwingController controller;
49
+    /** Factory to use to locate windows. */
50
+    private final SwingWindowFactory windowFactory;
51 51
 
52 52
     /**
53 53
      * Create a new instance of PopOutCommand.
54 54
      *
55
-     * @param controller SwingWindowController associated with this command
55
+     * @param windowFactory Factory to use to locate windows.
56 56
      * @param commandController The command controller to use for command info.
57 57
      */
58 58
     @Inject
59 59
     public PopOutCommand(
60
-            final SwingController controller,
60
+            final SwingWindowFactory windowFactory,
61 61
             final CommandController commandController) {
62 62
         super(commandController);
63
-        this.controller = controller;
63
+        this.windowFactory = windowFactory;
64 64
     }
65 65
 
66 66
     /** {@inheritDoc} */
@@ -71,8 +71,7 @@ public class PopOutCommand extends Command {
71 71
             /** {@inheritDoc} */
72 72
             @Override
73 73
             public void run() {
74
-                final TextFrame swingWindow = controller.getWindowFactory()
75
-                        .getSwingWindow(origin);
74
+                final TextFrame swingWindow = windowFactory.getSwingWindow(origin);
76 75
                 if (swingWindow == null) {
77 76
                     sendLine(origin, args.isSilent(), FORMAT_ERROR, "There is"
78 77
                             + " currently no window to pop out.");

+ 12
- 7
src/com/dmdirc/addons/ui_swing/components/MDIBar.java View File

@@ -22,14 +22,16 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
+import com.dmdirc.ClientModule.GlobalConfig;
25 26
 import com.dmdirc.addons.ui_swing.MainFrame;
26 27
 import com.dmdirc.addons.ui_swing.SelectionListener;
27
-import com.dmdirc.addons.ui_swing.SwingController;
28 28
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
29 29
 import com.dmdirc.addons.ui_swing.SwingWindowListener;
30 30
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
31
+import com.dmdirc.addons.ui_swing.injection.SwingModule.SwingSettingsDomain;
31 32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32 33
 import com.dmdirc.interfaces.config.ConfigChangeListener;
34
+import com.dmdirc.ui.IconManager;
33 35
 
34 36
 import java.awt.event.ActionEvent;
35 37
 import java.awt.event.ActionListener;
@@ -70,24 +72,27 @@ public class MDIBar extends JPanel implements SwingWindowListener,
70 72
     /**
71 73
      * Instantiates a new MDI bar.
72 74
      *
73
-     * @param controller The controller that owns this MDI bar
75
+     * @param globalConfig The config to read settings from.
76
+     * @param iconManager The manager to use to retrieve icons.
77
+     * @param domain The domain to read settings from under.
74 78
      * @param windowFactory The window factory to use to create and listen for windows.
75 79
      * @param mainFrame Main frame instance
76 80
      */
77 81
     @Inject
78 82
     public MDIBar(
79
-            final SwingController controller,
83
+            @GlobalConfig final AggregateConfigProvider globalConfig,
84
+            @GlobalConfig final IconManager iconManager,
85
+            @SwingSettingsDomain final String domain,
80 86
             final SwingWindowFactory windowFactory,
81 87
             final MainFrame mainFrame) {
82 88
         super();
83 89
 
84 90
         this.mainFrame = mainFrame;
85
-        config = controller.getGlobalConfig();
86
-        configDomain = controller.getDomain();
91
+        this.config = globalConfig;
92
+        this.configDomain = domain;
87 93
         visibility = config.getOptionBool(configDomain, "mdiBarVisibility");
88 94
 
89
-        closeButton = new NoFocusButton(controller.getIconManager()
90
-                .getScaledIcon("close-12", ICON_SIZE,ICON_SIZE));
95
+        closeButton = new NoFocusButton(iconManager.getScaledIcon("close-12", ICON_SIZE,ICON_SIZE));
91 96
 
92 97
         setOpaque(false);
93 98
         setLayout(new MigLayout("hmax 17, ins 1 0 0 0, fill"));

+ 14
- 9
src/com/dmdirc/addons/ui_swing/components/addonbrowser/DataLoaderWorker.java View File

@@ -22,16 +22,17 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 27
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
28 28
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
29 29
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
30 30
 import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
31
+import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 32
 import com.dmdirc.logger.ErrorLevel;
32 33
 import com.dmdirc.logger.Logger;
33
-import com.dmdirc.updater.UpdateChecker;
34 34
 import com.dmdirc.updater.manager.UpdateManager;
35
+import com.dmdirc.util.URLBuilder;
35 36
 import com.dmdirc.util.annotations.factory.Factory;
36 37
 import com.dmdirc.util.annotations.factory.Unbound;
37 38
 import com.dmdirc.util.io.ConfigFile;
@@ -73,19 +74,22 @@ public class DataLoaderWorker
73 74
     private final JProgressBar jpb = new JProgressBar(0, 100);
74 75
     /** Refresh addons feed? */
75 76
     private final boolean download;
76
-    /** Swing controller. */
77
-    private final SwingController controller;
78 77
     /** Directory to store temporary files in. */
79 78
     private final String tempDirectory;
79
+    /** URL Builder to use when loading addon resources. */
80
+    private final URLBuilder urlBuilder;
80 81
     /** Factory to use to produce install workers. */
81 82
     private final InstallWorkerFactory workerFactory;
82 83
     /** The manager to use to retrieve update information. */
83 84
     private final UpdateManager updateManager;
85
+    /** Configuration to read settings from. */
86
+    private final AggregateConfigProvider globalConfig;
84 87
 
85 88
     /**
86 89
      * Creates a new data loader worker.
87 90
      *
88
-     * @param controller Swing controller
91
+     * @param globalConfig Configuration to read settings from.
92
+     * @param urlBuilder URL Builder to use when loading addon resources.
89 93
      * @param workerFactory Factory to use to produce install workers.
90 94
      * @param updateManager Manager to use to retrieve update information.
91 95
      * @param tempDirectory The directory to store temporary items in, such as the addons feed.
@@ -95,7 +99,8 @@ public class DataLoaderWorker
95 99
      * @param scrollPane Table's parent scrollpane
96 100
      */
97 101
     public DataLoaderWorker(
98
-            final SwingController controller,
102
+            @SuppressWarnings("qualifiers") @GlobalConfig final AggregateConfigProvider globalConfig,
103
+            final URLBuilder urlBuilder,
99 104
             final InstallWorkerFactory workerFactory,
100 105
             final UpdateManager updateManager,
101 106
             @SuppressWarnings("qualifiers") @Directory(DirectoryType.TEMPORARY) final String tempDirectory,
@@ -103,7 +108,8 @@ public class DataLoaderWorker
103 108
             @Unbound final boolean download,
104 109
             @Unbound final BrowserWindow browserWindow,
105 110
             @Unbound final JScrollPane scrollPane) {
106
-        this.controller = controller;
111
+        this.globalConfig = globalConfig;
112
+        this.urlBuilder = urlBuilder;
107 113
         this.workerFactory = workerFactory;
108 114
         this.download = download;
109 115
         this.table = table;
@@ -148,8 +154,7 @@ public class DataLoaderWorker
148 154
 
149 155
         final List<AddonInfo> list = new ArrayList<>();
150 156
         for (final Map<String, String> entry : data.getKeyDomains().values()) {
151
-            list.add(new AddonInfo(controller.getGlobalConfig(), updateManager,
152
-                    controller.getUrlBuilder(), entry));
157
+            list.add(new AddonInfo(globalConfig, updateManager, urlBuilder, entry));
153 158
         }
154 159
         return list;
155 160
     }

+ 0
- 22
src/com/dmdirc/addons/ui_swing/components/durationeditor/DurationEditor.java View File

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.durationeditor;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
26 25
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
27 26
 import com.dmdirc.util.collections.ListenerList;
28 27
 
@@ -73,15 +72,6 @@ public class DurationEditor extends StandardDialog implements ActionListener {
73 72
     /** Parent window. */
74 73
     private Window window;
75 74
 
76
-    /**
77
-     * Instantiates a new duration editor.
78
-     *
79
-     * @param controller Controller for dialog creation
80
-     */
81
-    public DurationEditor(final SwingController controller) {
82
-        this(controller, 0);
83
-    }
84
-
85 75
     /**
86 76
      * Instantiates a new duration editor.
87 77
      *
@@ -93,18 +83,6 @@ public class DurationEditor extends StandardDialog implements ActionListener {
93 83
         this(window, 0);
94 84
     }
95 85
 
96
-    /**
97
-     * Instantiates a new duration editor.
98
-     *
99
-     * @param controller Controller for dialog creation
100
-     *
101
-     * @param duration Starting duration
102
-     */
103
-    public DurationEditor(final SwingController controller,
104
-            final long duration) {
105
-        this(controller.getMainFrame(), duration);
106
-    }
107
-
108 86
     /**
109 87
      * Instantiates a new duration editor.
110 88
      *

+ 18
- 9
src/com/dmdirc/addons/ui_swing/dialogs/about/AboutDialog.java View File

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.ui_swing.dialogs.about;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.MainFrame;
26
-import com.dmdirc.addons.ui_swing.SwingController;
27 26
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
28 27
 
29 28
 import java.awt.event.ActionEvent;
@@ -55,20 +54,30 @@ public class AboutDialog extends StandardDialog implements ActionListener, Chang
55 54
     /**
56 55
      * Creates a new instance of AboutDialog.
57 56
      *
58
-     * @param controller Swing controller
59 57
      * @param parentWindow Parent window
58
+     * @param infoPanel The info panel to display.
59
+     * @param creditsPanel The credits panel to display.
60
+     * @param licensesPanel The licenses panel to display.
61
+     * @param aboutPanel The about panel to display.
60 62
      */
61 63
     @Inject
62 64
     public AboutDialog(
63 65
             final MainFrame parentWindow,
64
-            final SwingController controller) {
66
+            final InfoPanel infoPanel,
67
+            final CreditsPanel creditsPanel,
68
+            final LicencesPanel licensesPanel,
69
+            final AboutPanel aboutPanel) {
65 70
         super(parentWindow, ModalityType.MODELESS);
66 71
 
67
-        initComponents(controller);
72
+        initComponents(infoPanel, creditsPanel, licensesPanel, aboutPanel);
68 73
     }
69 74
 
70 75
     /** Initialises the main UI components. */
71
-    private void initComponents(final SwingController controller) {
76
+    private void initComponents(
77
+            final InfoPanel infoPanel,
78
+            final CreditsPanel creditsPanel,
79
+            final LicencesPanel licensesPanel,
80
+            final AboutPanel aboutPanel) {
72 81
         tabbedPane = new JTabbedPane();
73 82
 
74 83
         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
@@ -80,12 +89,12 @@ public class AboutDialog extends StandardDialog implements ActionListener, Chang
80 89
         getOkButton().addActionListener(this);
81 90
         getCancelButton().addActionListener(this);
82 91
 
83
-        cp = new CreditsPanel(controller.getUrlHandler());
92
+        cp = creditsPanel;
84 93
 
85
-        tabbedPane.add("About", new AboutPanel(controller.getUrlHandler()));
94
+        tabbedPane.add("About", aboutPanel);
86 95
         tabbedPane.add("Credits", cp);
87
-        tabbedPane.add("Licences", new LicencesPanel(controller));
88
-        tabbedPane.add("Information", new InfoPanel(controller));
96
+        tabbedPane.add("Licences", licensesPanel);
97
+        tabbedPane.add("Information", infoPanel);
89 98
         tabbedPane.addChangeListener(this);
90 99
 
91 100
         getContentPane().setLayout(new MigLayout("ins rel, wrap 1, fill, " +

+ 2
- 0
src/com/dmdirc/addons/ui_swing/dialogs/about/AboutPanel.java View File

@@ -26,6 +26,7 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
26 26
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
27 27
 import com.dmdirc.ui.core.util.URLHandler;
28 28
 
29
+import javax.inject.Inject;
29 30
 import javax.swing.JPanel;
30 31
 import javax.swing.event.HyperlinkEvent;
31 32
 import javax.swing.event.HyperlinkEvent.EventType;
@@ -53,6 +54,7 @@ public final class AboutPanel extends JPanel implements HyperlinkListener {
53 54
      *
54 55
      * @param urlHandler The URL Handler to use to handle clicked links
55 56
      */
57
+    @Inject
56 58
     public AboutPanel(final URLHandler urlHandler) {
57 59
         super();
58 60
 

+ 2
- 0
src/com/dmdirc/addons/ui_swing/dialogs/about/CreditsPanel.java View File

@@ -26,6 +26,7 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
26 26
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
27 27
 import com.dmdirc.ui.core.util.URLHandler;
28 28
 
29
+import javax.inject.Inject;
29 30
 import javax.swing.JPanel;
30 31
 import javax.swing.JScrollPane;
31 32
 import javax.swing.event.HyperlinkEvent;
@@ -57,6 +58,7 @@ public final class CreditsPanel extends JPanel implements HyperlinkListener {
57 58
      *
58 59
      * @param urlHandler The URL handler to use to open clicked links
59 60
      */
61
+    @Inject
60 62
     public CreditsPanel(final URLHandler urlHandler) {
61 63
         super();
62 64
 

+ 2
- 0
src/com/dmdirc/addons/ui_swing/dialogs/about/InfoPanel.java View File

@@ -30,6 +30,7 @@ import com.dmdirc.util.DateUtils;
30 30
 import java.awt.Font;
31 31
 import java.nio.charset.Charset;
32 32
 
33
+import javax.inject.Inject;
33 34
 import javax.swing.JEditorPane;
34 35
 import javax.swing.JPanel;
35 36
 import javax.swing.JScrollPane;
@@ -53,6 +54,7 @@ public final class InfoPanel extends JPanel {
53 54
      *
54 55
      * @param controller Parent swing controller
55 56
      */
57
+    @Inject
56 58
     public InfoPanel(final SwingController controller) {
57 59
         super();
58 60
 

+ 10
- 7
src/com/dmdirc/addons/ui_swing/dialogs/about/LicenceLoader.java View File

@@ -22,12 +22,12 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.about;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
28 27
 import com.dmdirc.logger.ErrorLevel;
29 28
 import com.dmdirc.logger.Logger;
30 29
 import com.dmdirc.plugins.PluginInfo;
30
+import com.dmdirc.plugins.PluginManager;
31 31
 import com.dmdirc.util.resourcemanager.ResourceManager;
32 32
 
33 33
 import java.io.BufferedReader;
@@ -53,20 +53,23 @@ public class LicenceLoader extends LoggingSwingWorker<Void, Void> {
53 53
     private final JTree tree;
54 54
     /** Model to load licences into. */
55 55
     private final DefaultTreeModel model;
56
-    /** Swing Controller */
57
-    final SwingController controller;
56
+    /** Manager to use to get plugin information from */
57
+    private final PluginManager pluginManager;
58 58
 
59 59
     /**
60 60
      * Instantiates a new licence loader.
61 61
      *
62
-     * @param controller to get plugin manager from to get plugin list from to read licenses
62
+     * @param pluginManager to get plugin manager from to get plugin list from to read licenses
63 63
      * @param tree Tree
64 64
      * @param model Model to load licences into
65 65
      */
66
-    public LicenceLoader(final SwingController controller, final JTree tree, final DefaultTreeModel model) {
66
+    public LicenceLoader(
67
+            final PluginManager pluginManager,
68
+            final JTree tree,
69
+            final DefaultTreeModel model) {
67 70
         super();
68 71
 
69
-        this.controller = controller;
72
+        this.pluginManager = pluginManager;
70 73
         this.tree = tree;
71 74
         this.model = model;
72 75
     }
@@ -84,7 +87,7 @@ public class LicenceLoader extends LoggingSwingWorker<Void, Void> {
84 87
                     + "no resource manager");
85 88
         } else {
86 89
             addCoreLicences(rm);
87
-            for (PluginInfo pi : controller.getPluginManager().getPluginInfos()) {
90
+            for (PluginInfo pi : pluginManager.getPluginInfos()) {
88 91
                 addPluginLicences(pi);
89 92
             }
90 93
         }

+ 13
- 10
src/com/dmdirc/addons/ui_swing/dialogs/about/LicencesPanel.java View File

@@ -22,15 +22,17 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.about;
24 24
 
25
-import com.dmdirc.addons.ui_swing.SwingController;
25
+import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 27
 import com.dmdirc.addons.ui_swing.components.TreeScroller;
28 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29 29
 import com.dmdirc.plugins.PluginInfo;
30
+import com.dmdirc.plugins.PluginManager;
30 31
 
31 32
 import java.awt.Font;
32 33
 import java.awt.Rectangle;
33 34
 
35
+import javax.inject.Inject;
34 36
 import javax.swing.BorderFactory;
35 37
 import javax.swing.JEditorPane;
36 38
 import javax.swing.JPanel;
@@ -65,20 +67,21 @@ public class LicencesPanel extends JPanel implements TreeSelectionListener {
65 67
     private JEditorPane licence;
66 68
     /** Licence list. */
67 69
     private JTree list;
68
-    /** Swing Controller. */
69
-    private final SwingController controller;
70 70
 
71 71
     /**
72 72
      * Creates a new instance of LicencesPanel.
73 73
      *
74
-     * @param controller Controller to pass to LicenseLoader (should be PluginManager)
74
+     * @param globalConfig The config to read settings from.
75
+     * @param pluginManager The manager to use to find plugins (to display their licenses).
75 76
      */
76
-    public LicencesPanel(final SwingController controller) {
77
+    @Inject
78
+    public LicencesPanel(
79
+            @GlobalConfig final AggregateConfigProvider globalConfig,
80
+            final PluginManager pluginManager) {
77 81
         super();
78 82
 
79
-        this.controller = controller;
80
-        this.config = controller.getGlobalConfig();
81
-        initComponents();
83
+        this.config = globalConfig;
84
+        initComponents(new LicenceLoader(pluginManager, list, listModel));
82 85
         addListeners();
83 86
         layoutComponents();
84 87
     }
@@ -100,7 +103,7 @@ public class LicencesPanel extends JPanel implements TreeSelectionListener {
100 103
     }
101 104
 
102 105
     /** Initialises the components. */
103
-    private void initComponents() {
106
+    private void initComponents(final LicenceLoader licenceLoader) {
104 107
         setOpaque(UIUtilities.getTabbedPaneOpaque());
105 108
         listModel = new DefaultTreeModel(new DefaultMutableTreeNode());
106 109
         list = new JTree(listModel) {
@@ -133,7 +136,7 @@ public class LicencesPanel extends JPanel implements TreeSelectionListener {
133 136
         list.getSelectionModel().setSelectionMode(TreeSelectionModel.
134 137
                 SINGLE_TREE_SELECTION);
135 138
         new TreeScroller(list);
136
-        new LicenceLoader(controller, list, listModel).executeInExecutor();
139
+        licenceLoader.executeInExecutor();
137 140
         licence = new JEditorPane();
138 141
         licence.setEditorKit(new HTMLEditorKit());
139 142
         final Font font = UIManager.getFont("Label.font");

+ 21
- 1
src/com/dmdirc/addons/ui_swing/injection/SwingModule.java View File

@@ -47,6 +47,7 @@ import com.dmdirc.util.URLBuilder;
47 47
 import java.util.concurrent.Callable;
48 48
 
49 49
 import javax.inject.Provider;
50
+import javax.inject.Qualifier;
50 51
 import javax.inject.Singleton;
51 52
 
52 53
 import dagger.Module;
@@ -69,17 +70,36 @@ import dagger.Provides;
69 70
 )
70 71
 public class SwingModule {
71 72
 
73
+    @Qualifier
74
+    public static @interface SwingSettingsDomain {}
75
+
72 76
     /** The controller to return to clients. */
73 77
     private final SwingController controller;
74 78
 
79
+    /** The domain for plugin settings. */
80
+    private final String domain;
81
+
75 82
     /**
76 83
      * Creates a new instance of {@link SwingModule}.
77 84
      *
78 85
      * @param controller The controller to return. This should be removed when SwingController
79 86
      * is separated from the plugin implementation.
87
+     * @param domain The domain for plugin settings.
80 88
      */
81
-    public SwingModule(final SwingController controller) {
89
+    public SwingModule(final SwingController controller, final String domain) {
82 90
         this.controller = controller;
91
+        this.domain = domain;
92
+    }
93
+
94
+    /**
95
+     * Provides the domain that the swing settings should be stored under.
96
+     *
97
+     * @return The settings domain for the swing plugin.
98
+     */
99
+    @Provides
100
+    @SwingSettingsDomain
101
+    public String getSettingsDomain() {
102
+        return domain;
83 103
     }
84 104
 
85 105
     /**

Loading…
Cancel
Save