Procházet zdrojové kódy

SLF4J Logging in the Swing UI.

pull/419/head
Greg Holmes před 9 roky
rodič
revize
3c789532e7
21 změnil soubory, kde provedl 84 přidání a 169 odebrání
  1. 6
    11
      ui_swing/src/com/dmdirc/addons/ui_swing/UIUtilities.java
  2. 1
    1
      ui_swing/src/com/dmdirc/addons/ui_swing/components/FontPicker.java
  3. 5
    15
      ui_swing/src/com/dmdirc/addons/ui_swing/components/LoggingSwingWorker.java
  4. 7
    16
      ui_swing/src/com/dmdirc/addons/ui_swing/components/RunnableLoggingSwingWorker.java
  5. 10
    16
      ui_swing/src/com/dmdirc/addons/ui_swing/components/SupplierLoggingSwingWorker.java
  6. 7
    10
      ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/DataLoaderWorker.java
  7. 1
    5
      ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/DataLoaderWorkerFactory.java
  8. 0
    1
      ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/InstallWorker.java
  9. 1
    2
      ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonPanel.java
  10. 3
    7
      ui_swing/src/com/dmdirc/addons/ui_swing/components/inputfields/SwingInputHandler.java
  11. 2
    5
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryLabel.java
  12. 4
    11
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryPanel.java
  13. 9
    12
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/IconLoader.java
  14. 3
    10
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/PreferencesListCellRenderer.java
  15. 6
    11
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/PrefsCategoryLoader.java
  16. 11
    14
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/SwingPreferencesDialog.java
  17. 1
    1
      ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/updater/SwingUpdaterDialog.java
  18. 1
    7
      ui_swing/src/com/dmdirc/addons/ui_swing/textpane/BackgroundPainter.java
  19. 3
    5
      ui_swing/src/com/dmdirc/addons/ui_swing/textpane/ImageLoader.java
  20. 1
    4
      ui_swing/src/com/dmdirc/addons/ui_swing/textpane/TextPane.java
  21. 2
    5
      ui_swing/src/com/dmdirc/addons/ui_swing/textpane/TextPaneFactory.java

+ 6
- 11
ui_swing/src/com/dmdirc/addons/ui_swing/UIUtilities.java Zobrazit soubor

@@ -262,41 +262,36 @@ public final class UIUtilities {
262 262
     /**
263 263
      * Invokes something off the EDT, logging any exceptions that occur.
264 264
      *
265
-     * @param eventBus Eventbus to post errors to
266 265
      * @param runnable Runnable to execute off the EDT
267 266
      */
268
-    public static void invokeOffEDT(final DMDircMBassador eventBus, final Runnable runnable) {
269
-        new RunnableLoggingSwingWorker<Void, Void>(eventBus, runnable).execute();
267
+    public static void invokeOffEDT(final Runnable runnable) {
268
+        new RunnableLoggingSwingWorker<Void, Void>(runnable).execute();
270 269
     }
271 270
 
272 271
     /**
273 272
      * Invokes something off the EDT, handling the result when its finished on the EDT, logging
274 273
      * any exceptions that occur.
275 274
      *
276
-     * @param eventBus Eventbus to post errors to
277 275
      * @param runnable Runnable to execute off the EDT
278 276
      * @param consumer Consumer to finalise the runnable on the EDT
279 277
      *
280 278
      * @param <T>      Type the consumer takes
281 279
      */
282
-    public static <T> void invokeOffEDT(final DMDircMBassador eventBus, final Runnable runnable,
283
-            final Consumer<T> consumer) {
284
-        new RunnableLoggingSwingWorker<>(eventBus, runnable, consumer).execute();
280
+    public static <T> void invokeOffEDT(final Runnable runnable, final Consumer<T> consumer) {
281
+        new RunnableLoggingSwingWorker<>(runnable, consumer).execute();
285 282
     }
286 283
 
287 284
     /**
288 285
      * Invokes something off the EDT, handling the result when its finished on the EDT, logging
289 286
      * any exceptions that occur.
290 287
      *
291
-     * @param eventBus Eventbus to post errors to
292 288
      * @param runnable Runnable to execute off the EDT
293 289
      * @param consumer Consumer to finalise the runnable on the EDT
294 290
      *
295 291
      * @param <T>      Type the consumer takes
296 292
      */
297
-    public static <T> void invokeOffEDT(final DMDircMBassador eventBus, final Supplier<T> runnable,
298
-            final Consumer<T> consumer) {
299
-        new SupplierLoggingSwingWorker<>(eventBus, runnable, consumer).execute();
293
+    public static <T> void invokeOffEDT(final Supplier<T> runnable, final Consumer<T> consumer) {
294
+        new SupplierLoggingSwingWorker<>(runnable, consumer).execute();
300 295
     }
301 296
 
302 297
     /**

+ 1
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/components/FontPicker.java Zobrazit soubor

@@ -60,7 +60,7 @@ public class FontPicker extends JComboBox<Object> {
60 60
         this.fontFamily = fontFamily;
61 61
 
62 62
         setRenderer(new FontListCellRenderer(getRenderer()));
63
-        UIUtilities.invokeOffEDT(eventBus, this::getFonts, this::loadFonts);
63
+        UIUtilities.invokeOffEDT(this::getFonts, this::loadFonts);
64 64
     }
65 65
 
66 66
     /**

+ 5
- 15
ui_swing/src/com/dmdirc/addons/ui_swing/components/LoggingSwingWorker.java Zobrazit soubor

@@ -22,14 +22,13 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.AppErrorEvent;
27
-import com.dmdirc.logger.ErrorLevel;
28
-
29 25
 import java.util.concurrent.ExecutionException;
30 26
 
31 27
 import javax.swing.SwingWorker;
32 28
 
29
+import org.slf4j.Logger;
30
+import org.slf4j.LoggerFactory;
31
+
33 32
 /**
34 33
  * Logging swing worker.
35 34
  *
@@ -38,16 +37,7 @@ import javax.swing.SwingWorker;
38 37
  */
39 38
 public abstract class LoggingSwingWorker<T, V> extends SwingWorker<T, V> {
40 39
 
41
-    private final DMDircMBassador eventBus;
42
-
43
-    /**
44
-     * Creates a new logging swing worker.
45
-     *
46
-     * @param eventBus Event bus to post errors to.
47
-     */
48
-    public LoggingSwingWorker(final DMDircMBassador eventBus) {
49
-        this.eventBus = eventBus;
50
-    }
40
+    private static final Logger LOG = LoggerFactory.getLogger(LoggingSwingWorker.class);
51 41
 
52 42
     @Override
53 43
     protected void done() {
@@ -59,7 +49,7 @@ public abstract class LoggingSwingWorker<T, V> extends SwingWorker<T, V> {
59 49
         } catch (InterruptedException ex) {
60 50
             //Ignore
61 51
         } catch (ExecutionException ex) {
62
-            eventBus.publishAsync(new AppErrorEvent(ErrorLevel.MEDIUM, ex, ex.getMessage(), ""));
52
+            LOG.warn(ex.getMessage(), ex);
63 53
         }
64 54
     }
65 55
 

+ 7
- 16
ui_swing/src/com/dmdirc/addons/ui_swing/components/RunnableLoggingSwingWorker.java Zobrazit soubor

@@ -22,8 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-
27 25
 import java.util.List;
28 26
 import java.util.function.Consumer;
29 27
 
@@ -35,40 +33,33 @@ public class RunnableLoggingSwingWorker<T, V> extends SupplierLoggingSwingWorker
35 33
     /**
36 34
      * Creates a new logging swing worker.
37 35
      *
38
-     * @param eventBus           Event bus to post errors to.
39 36
      * @param backgroundRunnable The runnable to call as the background task, off the EDT.
40 37
      */
41
-    public RunnableLoggingSwingWorker(final DMDircMBassador eventBus,
42
-            final Runnable backgroundRunnable) {
43
-        this(eventBus, backgroundRunnable, result -> {});
38
+    public RunnableLoggingSwingWorker(final Runnable backgroundRunnable) {
39
+        this(backgroundRunnable, result -> {});
44 40
     }
45 41
 
46 42
     /**
47 43
      * Creates a new logging swing worker.
48 44
      *
49
-     * @param eventBus           Event bus to post errors to.
50 45
      * @param backgroundRunnable The runnable to call as the background task, off the EDT.
51 46
      * @param doneConsumer       The consumer called when the background task is complete
52 47
      */
53
-    public RunnableLoggingSwingWorker(final DMDircMBassador eventBus,
54
-            final Runnable backgroundRunnable,
48
+    public RunnableLoggingSwingWorker(final Runnable backgroundRunnable,
55 49
             final Consumer<T> doneConsumer) {
56
-        this(eventBus, backgroundRunnable, doneConsumer, chunks -> {});
50
+        this(backgroundRunnable, doneConsumer, chunks -> {});
57 51
     }
58 52
 
59 53
     /**
60 54
      * Creates a new logging swing worker.
61 55
      *
62
-     * @param eventBus           Event bus to post errors to.
63 56
      * @param backgroundRunnable The runnable to call as the background task, off the EDT.
64 57
      * @param doneConsumer       The consumer called when the background task is complete
65 58
      * @param processConsumer    The consumer called to process results of the background task
66 59
      *                           as it progresses
67 60
      */
68
-    public RunnableLoggingSwingWorker(final DMDircMBassador eventBus,
69
-            final Runnable backgroundRunnable,
70
-            final Consumer<T> doneConsumer,
71
-            final Consumer<List<V>> processConsumer) {
72
-        super(eventBus, () -> { backgroundRunnable.run(); return null; } , doneConsumer, processConsumer);
61
+    public RunnableLoggingSwingWorker(final Runnable backgroundRunnable,
62
+            final Consumer<T> doneConsumer, final Consumer<List<V>> processConsumer) {
63
+        super(() -> { backgroundRunnable.run(); return null; } , doneConsumer, processConsumer);
73 64
     }
74 65
 }

+ 10
- 16
ui_swing/src/com/dmdirc/addons/ui_swing/components/SupplierLoggingSwingWorker.java Zobrazit soubor

@@ -22,21 +22,20 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.UserErrorEvent;
27
-import com.dmdirc.logger.ErrorLevel;
28
-
29 25
 import java.util.List;
30 26
 import java.util.concurrent.ExecutionException;
31 27
 import java.util.function.Consumer;
32 28
 import java.util.function.Supplier;
33 29
 
30
+import org.slf4j.Logger;
31
+import org.slf4j.LoggerFactory;
32
+
34 33
 /**
35 34
  * {@link LoggingSwingWorker} that runs a {@link Supplier}.
36 35
  */
37 36
 public class SupplierLoggingSwingWorker<T, V> extends LoggingSwingWorker<T, V> {
38 37
 
39
-    private final DMDircMBassador eventBus;
38
+    private static final Logger LOG = LoggerFactory.getLogger(SupplierLoggingSwingWorker.class);
40 39
     private final Consumer<T> doneConsumer;
41 40
     private final Consumer<List<V>> processConsumer;
42 41
     private final Supplier<T> backgroundSupplier;
@@ -44,42 +43,37 @@ public class SupplierLoggingSwingWorker<T, V> extends LoggingSwingWorker<T, V> {
44 43
     /**
45 44
      * Creates a new logging swing worker.
46 45
      *
47
-     * @param eventBus           Event bus to post errors to.
48 46
      * @param backgroundSupplier The supplier to call as the background task, off the EDT.
49 47
      */
50
-    public SupplierLoggingSwingWorker(final DMDircMBassador eventBus,
48
+    public SupplierLoggingSwingWorker(
51 49
             final Supplier<T> backgroundSupplier) {
52
-        this(eventBus, backgroundSupplier, result -> {});
50
+        this(backgroundSupplier, result -> {});
53 51
     }
54 52
 
55 53
     /**
56 54
      * Creates a new logging swing worker.
57 55
      *
58
-     * @param eventBus           Event bus to post errors to.
59 56
      * @param backgroundSupplier The supplier to call as the background task, off the EDT.
60 57
      * @param doneConsumer       The consumer called when the background task is complete
61 58
      */
62
-    public SupplierLoggingSwingWorker(final DMDircMBassador eventBus,
59
+    public SupplierLoggingSwingWorker(
63 60
             final Supplier<T> backgroundSupplier,
64 61
             final Consumer<T> doneConsumer) {
65
-        this(eventBus, backgroundSupplier, doneConsumer, chunks -> {});
62
+        this(backgroundSupplier, doneConsumer, chunks -> {});
66 63
     }
67 64
 
68 65
     /**
69 66
      * Creates a new logging swing worker.
70 67
      *
71
-     * @param eventBus           Event bus to post errors to.
72 68
      * @param backgroundSupplier The supplier to call as the background task, off the EDT.
73 69
      * @param doneConsumer       The consumer called when the background task is complete
74 70
      * @param processConsumer    The consumer called to process results of the background task
75 71
      *                           as it progresses
76 72
      */
77
-    public SupplierLoggingSwingWorker(final DMDircMBassador eventBus,
73
+    public SupplierLoggingSwingWorker(
78 74
             final Supplier<T> backgroundSupplier,
79 75
             final Consumer<T> doneConsumer,
80 76
             final Consumer<List<V>> processConsumer) {
81
-        super(eventBus);
82
-        this.eventBus = eventBus;
83 77
         this.backgroundSupplier = backgroundSupplier;
84 78
         this.doneConsumer = doneConsumer;
85 79
         this.processConsumer = processConsumer;
@@ -102,7 +96,7 @@ public class SupplierLoggingSwingWorker<T, V> extends LoggingSwingWorker<T, V> {
102 96
         } catch (InterruptedException ex) {
103 97
             //Ignore
104 98
         } catch (ExecutionException ex) {
105
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, ex, ex.getMessage(), ""));
99
+            LOG.warn(ex.getMessage(), ex);
106 100
         }
107 101
     }
108 102
 

+ 7
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/DataLoaderWorker.java Zobrazit soubor

@@ -22,13 +22,10 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
28 27
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
29
-import com.dmdirc.events.UserErrorEvent;
30 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31
-import com.dmdirc.logger.ErrorLevel;
32 29
 import com.dmdirc.updater.manager.UpdateManager;
33 30
 import com.dmdirc.util.URLBuilder;
34 31
 import com.dmdirc.util.io.ConfigFile;
@@ -51,6 +48,11 @@ import javax.swing.text.StyleConstants;
51 48
 
52 49
 import net.miginfocom.swing.MigLayout;
53 50
 
51
+import org.slf4j.Logger;
52
+import org.slf4j.LoggerFactory;
53
+
54
+import static com.dmdirc.util.LogUtils.USER_ERROR;
55
+
54 56
 /**
55 57
  * Loads the addon data feed into the addon browser.
56 58
  */
@@ -58,6 +60,7 @@ public class DataLoaderWorker
58 60
         extends LoggingSwingWorker<Collection<AddonInfo>, Object>
59 61
         implements DownloadListener {
60 62
 
63
+    private static final Logger LOG = LoggerFactory.getLogger(DataLoaderWorker.class);
61 64
     /** List to load data into. */
62 65
     private final AddonTable table;
63 66
     /** Browser window to pass to addon info objects. */
@@ -80,8 +83,6 @@ public class DataLoaderWorker
80 83
     private final AggregateConfigProvider globalConfig;
81 84
     /** Downloader to download files. */
82 85
     private final Downloader downloader;
83
-    /** The event bus to post errors to. */
84
-    private final DMDircMBassador eventBus;
85 86
 
86 87
     /**
87 88
      * Creates a new data loader worker.
@@ -92,7 +93,6 @@ public class DataLoaderWorker
92 93
      * @param workerFactory Factory to use to produce install workers.
93 94
      * @param updateManager Manager to use to retrieve update information.
94 95
      * @param tempDirectory The directory to store temporary items in, such as the addons feed.
95
-     * @param eventBus      The event bus to post errors to
96 96
      * @param table         Table to load data into
97 97
      * @param download      Download new addons feed?
98 98
      * @param browserWindow Browser window to pass to table objects
@@ -105,12 +105,10 @@ public class DataLoaderWorker
105 105
             final InstallWorkerFactory workerFactory,
106 106
             final UpdateManager updateManager,
107 107
             final Path tempDirectory,
108
-            final DMDircMBassador eventBus,
109 108
             final AddonTable table,
110 109
             final boolean download,
111 110
             final BrowserWindow browserWindow,
112 111
             final JScrollPane scrollPane) {
113
-        super(eventBus);
114 112
         this.downloader = downloader;
115 113
         this.globalConfig = globalConfig;
116 114
         this.urlBuilder = urlBuilder;
@@ -121,7 +119,6 @@ public class DataLoaderWorker
121 119
         this.tempDirectory = tempDirectory;
122 120
         this.browserWindow = browserWindow;
123 121
         this.scrollPane = scrollPane;
124
-        this.eventBus = eventBus;
125 122
     }
126 123
 
127 124
     @Override
@@ -173,7 +170,7 @@ public class DataLoaderWorker
173 170
         } catch (final InterruptedException ex) {
174 171
             data = Collections.emptyList();
175 172
         } catch (final ExecutionException ex) {
176
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, ex, ex.getMessage(), ""));
173
+            LOG.warn(USER_ERROR, ex.getMessage(), ex);
177 174
             data = Collections.emptyList();
178 175
         }
179 176
         final int selectedRow;

+ 1
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/DataLoaderWorkerFactory.java Zobrazit soubor

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.ui_swing.components.addonbrowser;
24 24
 
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26
-import com.dmdirc.DMDircMBassador;
27 26
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
28 27
 import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
29 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
@@ -47,7 +46,6 @@ public class DataLoaderWorkerFactory {
47 46
     private final InstallWorkerFactory workerFactory;
48 47
     private final UpdateManager updateManager;
49 48
     private final Path tempDirectory;
50
-    private final DMDircMBassador eventBus;
51 49
 
52 50
     @Inject
53 51
     public DataLoaderWorkerFactory(final Downloader downloader,
@@ -55,7 +53,6 @@ public class DataLoaderWorkerFactory {
55 53
             final URLBuilder urlBuilder,
56 54
             final InstallWorkerFactory workerFactory,
57 55
             final UpdateManager updateManager,
58
-            final DMDircMBassador eventBus,
59 56
             @Directory(DirectoryType.TEMPORARY)
60 57
             final Path tempDirectory) {
61 58
         this.downloader = downloader;
@@ -64,11 +61,10 @@ public class DataLoaderWorkerFactory {
64 61
         this.workerFactory = workerFactory;
65 62
         this.updateManager = updateManager;
66 63
         this.tempDirectory = tempDirectory;
67
-        this.eventBus = eventBus;
68 64
     }
69 65
     public DataLoaderWorker getDataLoaderWorker(final AddonTable list, final boolean download,
70 66
             final BrowserWindow browserWindow, final JScrollPane scrollPane) {
71 67
         return new DataLoaderWorker(downloader, globalConfig, urlBuilder, workerFactory,
72
-                updateManager, tempDirectory, eventBus, list, download, browserWindow, scrollPane);
68
+                updateManager, tempDirectory, list, download, browserWindow, scrollPane);
73 69
     }
74 70
 }

+ 0
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonbrowser/InstallWorker.java Zobrazit soubor

@@ -62,7 +62,6 @@ public class InstallWorker extends LoggingSwingWorker<String, Void> {
62 62
             final DMDircMBassador eventBus,
63 63
             final AddonInfo info,
64 64
             final InstallerWindow window) {
65
-        super(eventBus);
66 65
         this.downloader = downloader;
67 66
         this.info = info;
68 67
         this.installer = window;

+ 1
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonPanel.java Zobrazit soubor

@@ -128,8 +128,7 @@ public abstract class AddonPanel extends JPanel implements AddonToggleListener,
128 128
      * Populates the list in a background thread.
129 129
      */
130 130
     protected void load() {
131
-        UIUtilities.invokeOffEDT(eventBus,
132
-                () -> populateList(addonList),
131
+        UIUtilities.invokeOffEDT(() -> populateList(addonList),
133 132
                 value -> {
134 133
                     scrollPane.setViewportView(addonList);
135 134
                     addonList.getSelectionModel().addListSelectionListener(this);

+ 3
- 7
ui_swing/src/com/dmdirc/addons/ui_swing/components/inputfields/SwingInputHandler.java Zobrazit soubor

@@ -49,8 +49,6 @@ import javax.swing.text.JTextComponent;
49 49
  */
50 50
 public class SwingInputHandler extends InputHandler implements KeyListener {
51 51
 
52
-    private final DMDircMBassador eventBus;
53
-
54 52
     /**
55 53
      * Creates a new instance of InputHandler. Adds listeners to the target that we need to operate.
56 54
      *
@@ -71,7 +69,6 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
71 69
             final DMDircMBassador eventBus) {
72 70
         super(serviceManager, target, commandController, commandParser, parentWindow,
73 71
                 tabCompleterUtils, eventBus);
74
-        this.eventBus = eventBus;
75 72
     }
76 73
 
77 74
     @Override
@@ -154,7 +151,7 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
154 151
             @Override
155 152
             public void actionPerformed(final ActionEvent e) {
156 153
                 localTarget.setEditable(false);
157
-                UIUtilities.invokeOffEDT(eventBus, () -> doTabCompletion(false),
154
+                UIUtilities.invokeOffEDT(() -> doTabCompletion(false),
158 155
                         value -> localTarget.setEditable(true));
159 156
             }
160 157
         });
@@ -166,8 +163,7 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
166 163
                     @Override
167 164
                     public void actionPerformed(final ActionEvent e) {
168 165
                         localTarget.setEditable(false);
169
-                        UIUtilities.invokeOffEDT(eventBus,
170
-                                () -> doTabCompletion(true),
166
+                        UIUtilities.invokeOffEDT(() -> doTabCompletion(true),
171 167
                                 value -> localTarget.setEditable(true));
172 168
                     }
173 169
                 });
@@ -209,7 +205,7 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
209 205
                                         "Event is not from known source.");
210 206
                     }
211 207
                     if (source.isEditable()) {
212
-                        UIUtilities.invokeOffEDT(eventBus, () -> enterPressed(line));
208
+                        UIUtilities.invokeOffEDT(() -> enterPressed(line));
213 209
                     }
214 210
                 });
215 211
             }

+ 2
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryLabel.java Zobrazit soubor

@@ -22,9 +22,8 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27 25
 import com.dmdirc.addons.ui_swing.components.IconManager;
26
+import com.dmdirc.config.prefs.PreferencesCategory;
28 27
 
29 28
 import java.awt.Dimension;
30 29
 
@@ -52,14 +51,12 @@ public class CategoryLabel extends JLabel {
52 51
      * Creates a new category label.
53 52
      *
54 53
      * @param iconManager Icon manager
55
-     * @param eventBus    The event bus to post errors to
56 54
      * @param parentList  Parent list
57 55
      * @param category    Parent category
58 56
      * @param numCats     Number of categories shown
59 57
      * @param index       Index of this label
60 58
      */
61 59
     public CategoryLabel(final IconManager iconManager,
62
-            final DMDircMBassador eventBus,
63 60
             @Nullable final JList<? extends PreferencesCategory> parentList,
64 61
             final PreferencesCategory category, final int numCats,
65 62
             final int index) {
@@ -67,7 +64,7 @@ public class CategoryLabel extends JLabel {
67 64
         final int padding = (int) (1.5 * PlatformDefaults.getUnitValueX("related").getValue());
68 65
 
69 66
         setText(category.getTitle());
70
-        new IconLoader(iconManager, eventBus, this, category.getIcon()).execute();
67
+        new IconLoader(iconManager, this, category.getIcon()).execute();
71 68
 
72 69
         int level = 0;
73 70
         PreferencesCategory temp = category;

+ 4
- 11
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/CategoryPanel.java Zobrazit soubor

@@ -22,15 +22,14 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
27 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
27
+import com.dmdirc.addons.ui_swing.components.IconManager;
28 28
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
29 29
 import com.dmdirc.addons.ui_swing.components.TitlePanel;
30 30
 import com.dmdirc.addons.ui_swing.components.ToolTipPanel;
31 31
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
32 32
 import com.dmdirc.config.prefs.PreferencesCategory;
33
-import com.dmdirc.addons.ui_swing.components.IconManager;
34 33
 
35 34
 import java.util.Arrays;
36 35
 import java.util.Collections;
@@ -73,39 +72,33 @@ public class CategoryPanel extends JPanel {
73 72
     private LoggingSwingWorker<JPanel, Object> worker;
74 73
     /** Prefs component factory. */
75 74
     private final PrefsComponentFactory factory;
76
-    /** The event bus to post errors to. */
77
-    private final DMDircMBassador eventBus;
78 75
 
79 76
     /**
80 77
      * Instantiates a new category panel.
81 78
      *
82
-     * @param eventBus    The event bus to post errors to
83 79
      * @param factory     Prefs component factory instance
84 80
      * @param iconManager Icon manager
85 81
      */
86 82
     @Inject
87 83
     public CategoryPanel(
88
-            final DMDircMBassador eventBus,
89 84
             final PrefsComponentFactory factory,
90 85
             final IconManager iconManager) {
91
-        this(eventBus, factory, iconManager, null);
86
+        this(factory, iconManager, null);
92 87
     }
93 88
 
94 89
     /**
95 90
      * Instantiates a new category panel.
96 91
      *
97
-     * @param eventBus    The event bus to post errors to
98 92
      * @param factory     Prefs component factory instance
99 93
      * @param iconManager Icon manager
100 94
      * @param category    Initial category
101 95
      */
102 96
     public CategoryPanel(
103
-            final DMDircMBassador eventBus, final PrefsComponentFactory factory,
97
+            final PrefsComponentFactory factory,
104 98
             final IconManager iconManager,
105 99
             final PreferencesCategory category) {
106 100
         super(new MigLayout("fillx, wrap, ins 0"));
107 101
         this.factory = factory;
108
-        this.eventBus = eventBus;
109 102
 
110 103
         panels = Collections.synchronizedMap(new HashMap<>());
111 104
 
@@ -208,7 +201,7 @@ public class CategoryPanel extends JPanel {
208 201
         } else {
209 202
             UIUtilities.invokeAndWait(() -> scrollPane.setViewportView(loading));
210 203
 
211
-            worker = new PrefsCategoryLoader(factory, eventBus, this, category);
204
+            worker = new PrefsCategoryLoader(factory, this, category);
212 205
             worker.execute();
213 206
         }
214 207
     }

+ 9
- 12
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/IconLoader.java Zobrazit soubor

@@ -22,25 +22,26 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
27
-import com.dmdirc.events.UserErrorEvent;
28
-import com.dmdirc.logger.ErrorLevel;
29 25
 import com.dmdirc.addons.ui_swing.components.IconManager;
26
+import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
30 27
 
31 28
 import java.util.concurrent.ExecutionException;
32 29
 
33 30
 import javax.swing.Icon;
34 31
 
32
+import org.slf4j.Logger;
33
+import org.slf4j.LoggerFactory;
34
+
35
+import static com.dmdirc.util.LogUtils.USER_ERROR;
36
+
35 37
 /**
36 38
  * Loads an icon in the background and uses it for a category label once it has been loaded.
37 39
  */
38 40
 public class IconLoader extends LoggingSwingWorker<Icon, Void> {
39 41
 
42
+    private static final Logger LOG = LoggerFactory.getLogger(IconLoader.class);
40 43
     /** Category this icon will be used for. */
41 44
     private final CategoryLabel label;
42
-    /** The event bus to post errors to. */
43
-    private final DMDircMBassador eventBus;
44 45
     /** Icon to load. */
45 46
     private final String icon;
46 47
     /** Icon manager. */
@@ -51,15 +52,11 @@ public class IconLoader extends LoggingSwingWorker<Icon, Void> {
51 52
      * loaded in the background.
52 53
      *
53 54
      * @param iconManager Icon manager
54
-     * @param eventBus    The event bus to post errors to
55 55
      * @param label       Label to load category for
56 56
      * @param icon        Icon to load
57 57
      */
58
-    public IconLoader(final IconManager iconManager, final DMDircMBassador eventBus,
59
-            final CategoryLabel label, final String icon) {
60
-        super(eventBus);
58
+    public IconLoader(final IconManager iconManager, final CategoryLabel label, final String icon) {
61 59
         this.iconManager = iconManager;
62
-        this.eventBus = eventBus;
63 60
         this.label = label;
64 61
         this.icon = icon;
65 62
     }
@@ -76,7 +73,7 @@ public class IconLoader extends LoggingSwingWorker<Icon, Void> {
76 73
         } catch (InterruptedException ex) {
77 74
             //Ignore
78 75
         } catch (ExecutionException ex) {
79
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex, ex.getMessage(), ""));
76
+            LOG.info(USER_ERROR, ex.getMessage(), ex);
80 77
         }
81 78
 
82 79
     }

+ 3
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/PreferencesListCellRenderer.java Zobrazit soubor

@@ -22,9 +22,8 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27 25
 import com.dmdirc.addons.ui_swing.components.IconManager;
26
+import com.dmdirc.config.prefs.PreferencesCategory;
28 27
 
29 28
 import java.awt.Component;
30 29
 import java.awt.Font;
@@ -49,22 +48,17 @@ public class PreferencesListCellRenderer extends JLabel implements
49 48
     private final IconManager iconManager;
50 49
     /** Label map. */
51 50
     private final Map<PreferencesCategory, JLabel> labelMap;
52
-    /** The event bus to post errors to. */
53
-    private final DMDircMBassador eventBus;
54 51
 
55 52
     /**
56 53
      * Instantiates a new prefs list cell renderer.
57 54
      *
58 55
      * @param iconManager Icon manager to load icons
59
-     * @param eventBus    The event bus to post errors to
60 56
      * @param numCats     Number of categories in the list
61 57
      */
62
-    public PreferencesListCellRenderer(final IconManager iconManager, final DMDircMBassador eventBus,
63
-            final int numCats) {
58
+    public PreferencesListCellRenderer(final IconManager iconManager, final int numCats) {
64 59
         labelMap = new HashMap<>();
65 60
         this.numCats = numCats;
66 61
         this.iconManager = iconManager;
67
-        this.eventBus = eventBus;
68 62
     }
69 63
 
70 64
     @Override
@@ -72,8 +66,7 @@ public class PreferencesListCellRenderer extends JLabel implements
72 66
             final PreferencesCategory value, final int index, final boolean isSelected,
73 67
             final boolean cellHasFocus) {
74 68
         if (!labelMap.containsKey(value)) {
75
-            labelMap.put(value, new CategoryLabel(iconManager, eventBus,
76
-                    list, value, numCats, index));
69
+            labelMap.put(value, new CategoryLabel(iconManager, list, value, numCats, index));
77 70
         }
78 71
         final JLabel label = labelMap.get(value);
79 72
 

+ 6
- 11
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/PrefsCategoryLoader.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.Apple;
27 26
 import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
28 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
@@ -31,8 +30,7 @@ import com.dmdirc.addons.ui_swing.components.text.TextLabel;
31 30
 import com.dmdirc.config.prefs.PreferencesCategory;
32 31
 import com.dmdirc.config.prefs.PreferencesSetting;
33 32
 import com.dmdirc.config.prefs.PreferencesType;
34
-import com.dmdirc.events.UserErrorEvent;
35
-import com.dmdirc.logger.ErrorLevel;
33
+import com.dmdirc.util.LogUtils;
36 34
 
37 35
 import java.awt.Component;
38 36
 import java.awt.MenuContainer;
@@ -47,11 +45,15 @@ import javax.swing.UIManager;
47 45
 import net.miginfocom.layout.PlatformDefaults;
48 46
 import net.miginfocom.swing.MigLayout;
49 47
 
48
+import org.slf4j.Logger;
49
+import org.slf4j.LoggerFactory;
50
+
50 51
 /**
51 52
  * Loads a preferences panel for a specified preferences category in the background.
52 53
  */
53 54
 public class PrefsCategoryLoader extends LoggingSwingWorker<JPanel, Object> {
54 55
 
56
+    private static final Logger LOG = LoggerFactory.getLogger(PrefsCategoryLoader.class);
55 57
     /** Panel gap. */
56 58
     private final int padding = (int) PlatformDefaults.getUnitValueX("related").getValue();
57 59
     /** Panel left padding. */
@@ -66,24 +68,18 @@ public class PrefsCategoryLoader extends LoggingSwingWorker<JPanel, Object> {
66 68
     private final PreferencesCategory category;
67 69
     /** Prefs component factory instance. */
68 70
     private final PrefsComponentFactory factory;
69
-    /** The event bus to post the errors to. */
70
-    private final DMDircMBassador eventBus;
71 71
 
72 72
     /**
73 73
      * Instantiates a new preferences category loader.
74 74
      *
75 75
      * @param factory       Prefs component factory instance
76
-     * @param eventBus      The event bus to post errors ro
77 76
      * @param categoryPanel Parent Category panel
78 77
      * @param category      Preferences Category to load
79 78
      */
80 79
     public PrefsCategoryLoader(final PrefsComponentFactory factory,
81
-            final DMDircMBassador eventBus,
82 80
             final CategoryPanel categoryPanel,
83 81
             final PreferencesCategory category) {
84
-        super(eventBus);
85 82
         this.factory = factory;
86
-        this.eventBus = eventBus;
87 83
         this.categoryPanel = categoryPanel;
88 84
         this.category = category;
89 85
 
@@ -116,8 +112,7 @@ public class PrefsCategoryLoader extends LoggingSwingWorker<JPanel, Object> {
116 112
         } catch (InterruptedException ex) {
117 113
             panel = errorCategory;
118 114
         } catch (ExecutionException ex) {
119
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, ex,
120
-                    "Error loading prefs panel", ""));
115
+            LOG.warn(LogUtils.USER_ERROR, "Error loading prefs panel", ex);
121 116
             panel = errorCategory;
122 117
         }
123 118
         return panel;

+ 11
- 14
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/SwingPreferencesDialog.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.addons.ui_swing.components.IconManager;
28 27
 import com.dmdirc.addons.ui_swing.components.ListScroller;
@@ -34,8 +33,6 @@ import com.dmdirc.addons.ui_swing.injection.DialogProvider;
34 33
 import com.dmdirc.addons.ui_swing.injection.MainWindow;
35 34
 import com.dmdirc.config.prefs.PreferencesCategory;
36 35
 import com.dmdirc.config.prefs.PreferencesDialogModel;
37
-import com.dmdirc.events.UserErrorEvent;
38
-import com.dmdirc.logger.ErrorLevel;
39 36
 
40 37
 import java.awt.Window;
41 38
 import java.awt.event.ActionEvent;
@@ -57,12 +54,18 @@ import javax.swing.event.ListSelectionListener;
57 54
 
58 55
 import net.miginfocom.swing.MigLayout;
59 56
 
57
+import org.slf4j.Logger;
58
+import org.slf4j.LoggerFactory;
59
+
60
+import static com.dmdirc.util.LogUtils.USER_ERROR;
61
+
60 62
 /**
61 63
  * Allows the user to modify global client preferences.
62 64
  */
63 65
 public final class SwingPreferencesDialog extends StandardDialog implements
64 66
         ActionListener, ListSelectionListener {
65 67
 
68
+    private static final Logger LOG = LoggerFactory.getLogger(SwingPreferencesDialog.class);
66 69
     /** Serial version UID. */
67 70
     private static final long serialVersionUID = 9;
68 71
     /** Preferences tab list, used to switch option types. */
@@ -81,8 +84,6 @@ public final class SwingPreferencesDialog extends StandardDialog implements
81 84
     private final Provider<CategoryPanel> categoryPanelProvider;
82 85
     /** Icon manager to retrieve icons from. */
83 86
     private final IconManager iconManager;
84
-    /** The event bus to post errors to. */
85
-    private final DMDircMBassador eventBus;
86 87
 
87 88
     /**
88 89
      * Creates a new instance of SwingPreferencesDialog.
@@ -92,7 +93,6 @@ public final class SwingPreferencesDialog extends StandardDialog implements
92 93
      * @param restartDialogProvider The provider to use for restart dialogs.
93 94
      * @param dialogModelProvider   The provider to use to get a dialog model.
94 95
      * @param categoryPanelProvider The provider to use to produce a category panel.
95
-     * @param eventBus              The event bus to post errors to.
96 96
      */
97 97
     @Inject
98 98
     public SwingPreferencesDialog(
@@ -100,18 +100,16 @@ public final class SwingPreferencesDialog extends StandardDialog implements
100 100
             final IconManager iconManager,
101 101
             @ForSettings final DialogProvider<SwingRestartDialog> restartDialogProvider,
102 102
             final Provider<PreferencesDialogModel> dialogModelProvider,
103
-            final Provider<CategoryPanel> categoryPanelProvider,
104
-            final DMDircMBassador eventBus) {
103
+            final Provider<CategoryPanel> categoryPanelProvider) {
105 104
         super(parentWindow, ModalityType.MODELESS);
106 105
 
107 106
         this.iconManager = iconManager;
108 107
         this.restartDialogProvider = restartDialogProvider;
109 108
         this.categoryPanelProvider = categoryPanelProvider;
110
-        this.eventBus = eventBus;
111 109
 
112 110
         initComponents();
113 111
 
114
-        worker = new SupplierLoggingSwingWorker<>(eventBus,
112
+        worker = new SupplierLoggingSwingWorker<>(
115 113
                 () -> getPrefsModel(dialogModelProvider),
116 114
                 value -> {
117 115
                     if (value != null) {
@@ -129,8 +127,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
129 127
             prefsManager = dialogModelProvider.get();
130 128
         } catch (IllegalArgumentException ex) {
131 129
             mainPanel.setError(ex.getMessage());
132
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.HIGH, ex,
133
-                    "Unable to load the preferences dialog", ""));
130
+            LOG.error(USER_ERROR, "Unable to load the preferences dialog", ex);
134 131
         }
135 132
         return prefsManager;
136 133
     }
@@ -142,7 +139,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
142 139
         mainPanel.setCategory(null);
143 140
 
144 141
         final int count = countCategories(manager.getCategories());
145
-        tabList.setCellRenderer(new PreferencesListCellRenderer(iconManager, eventBus, count));
142
+        tabList.setCellRenderer(new PreferencesListCellRenderer(iconManager, count));
146 143
 
147 144
         addCategories(manager.getCategories());
148 145
     }
@@ -231,7 +228,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
231 228
             saveOptions();
232 229
         }
233 230
 
234
-        UIUtilities.invokeOffEDT(eventBus, () -> {
231
+        UIUtilities.invokeOffEDT(() -> {
235 232
             if (manager != null) {
236 233
                 manager.dismiss();
237 234
             }

+ 1
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/updater/SwingUpdaterDialog.java Zobrazit soubor

@@ -181,7 +181,7 @@ public class SwingUpdaterDialog extends StandardDialog implements
181 181
 
182 182
             header.setText("DMDirc is updating the following components:");
183 183
 
184
-            UIUtilities.invokeOffEDT(eventBus,
184
+            UIUtilities.invokeOffEDT(
185 185
                     () -> ((UpdateTableModel) table.getModel()).getUpdates().stream()
186 186
                     .filter(((UpdateTableModel) table.getModel())::isEnabled)
187 187
                     .forEach(updateManager::install));

+ 1
- 7
ui_swing/src/com/dmdirc/addons/ui_swing/textpane/BackgroundPainter.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.textpane;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.BackgroundOption;
27 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 27
 import com.dmdirc.config.ConfigBinding;
@@ -67,8 +66,6 @@ public class BackgroundPainter extends LayerUI<JComponent> {
67 66
      * Config manager to bind to and retrieve settings from.
68 67
      */
69 68
     private final AggregateConfigProvider configManager;
70
-    /** The event bus to post errors to. */
71
-    private final DMDircMBassador eventBus;
72 69
     /**
73 70
      * Background image.
74 71
      */
@@ -83,7 +80,6 @@ public class BackgroundPainter extends LayerUI<JComponent> {
83 80
      *
84 81
      * @param configManager Config manager to retrieve settings from
85 82
      * @param urlBuilder    URL Builder
86
-     * @param eventBus      The event bus to post errors to
87 83
      * @param domain        Domain to retrieve settings from
88 84
      * @param imageKey      Key for background image
89 85
      * @param optionKey     Key for background type
@@ -91,7 +87,6 @@ public class BackgroundPainter extends LayerUI<JComponent> {
91 87
     public BackgroundPainter(
92 88
             final AggregateConfigProvider configManager,
93 89
             final URLBuilder urlBuilder,
94
-            final DMDircMBassador eventBus,
95 90
             @Nonnull final String domain, @Nonnull final String imageKey,
96 91
             @Nonnull final String optionKey) {
97 92
         this.configManager = configManager;
@@ -99,7 +94,6 @@ public class BackgroundPainter extends LayerUI<JComponent> {
99 94
         this.domain = domain;
100 95
         this.imageKey = imageKey;
101 96
         this.optionKey = optionKey;
102
-        this.eventBus = eventBus;
103 97
         configManager.getBinder().bind(this, BackgroundPainter.class);
104 98
     }
105 99
 
@@ -132,7 +126,7 @@ public class BackgroundPainter extends LayerUI<JComponent> {
132 126
         if (value == null || value.isEmpty()) {
133 127
             backgroundImage = null;
134 128
         } else {
135
-            new ImageLoader(urlBuilder.getUrl(value), this, eventBus).execute();
129
+            new ImageLoader(urlBuilder.getUrl(value), this).execute();
136 130
         }
137 131
     }
138 132
 

+ 3
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/textpane/ImageLoader.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.textpane;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
27 26
 
28 27
 import java.awt.Image;
@@ -32,6 +31,7 @@ import java.util.concurrent.ExecutionException;
32 31
 
33 32
 import javax.imageio.ImageIO;
34 33
 
34
+import org.slf4j.Logger;
35 35
 import org.slf4j.LoggerFactory;
36 36
 
37 37
 /**
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
39 39
  */
40 40
 public class ImageLoader extends LoggingSwingWorker<Image, Void> {
41 41
 
42
-    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ImageLoader.class);
42
+    private static final Logger LOG = LoggerFactory.getLogger(ImageLoader.class);
43 43
     /**
44 44
      * URL of image file to load.
45 45
      */
@@ -49,9 +49,7 @@ public class ImageLoader extends LoggingSwingWorker<Image, Void> {
49 49
      */
50 50
     private final BackgroundPainter painter;
51 51
 
52
-    public ImageLoader(final URL imageURL, final BackgroundPainter painter,
53
-            final DMDircMBassador eventBus) {
54
-        super(eventBus);
52
+    public ImageLoader(final URL imageURL, final BackgroundPainter painter) {
55 53
         this.imageURL = imageURL;
56 54
         this.painter = painter;
57 55
     }

+ 1
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/textpane/TextPane.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.textpane;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.interfaces.config.ConfigChangeListener;
28 27
 import com.dmdirc.interfaces.ui.Window;
@@ -92,14 +91,12 @@ public final class TextPane extends JComponent implements MouseWheelListener,
92 91
     /**
93 92
      * Creates a new instance of TextPane.
94 93
      *
95
-     * @param eventBus     The event bus to post errors to.
96 94
      * @param configDomain The domain to read configuration from.
97 95
      * @param urlBuilder   The builder to use to construct URLs for resources.
98 96
      * @param clipboard    The clipboard to handle copy and paste actions
99 97
      * @param frame        Parent Frame
100 98
      */
101 99
     public TextPane(
102
-            final DMDircMBassador eventBus,
103 100
             final String configDomain,
104 101
             final URLBuilder urlBuilder, final Clipboard clipboard,
105 102
             final Window frame) {
@@ -117,7 +114,7 @@ public final class TextPane extends JComponent implements MouseWheelListener,
117 114
 
118 115
         setLayout(new MigLayout("fill, hidemode 3"));
119 116
         backgroundPainter = new BackgroundPainter(frame.getContainer().getConfigManager(),
120
-                urlBuilder, eventBus, configDomain, "textpanebackground",
117
+                urlBuilder, configDomain, "textpanebackground",
121 118
                 "textpanebackgroundoption");
122 119
         canvas = new TextPaneCanvas(this,
123 120
                 new CachingDocument<>(document, new AttributedStringMessageMaker()));

+ 2
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/textpane/TextPaneFactory.java Zobrazit soubor

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.textpane;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.SwingController;
27 26
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
28 27
 import com.dmdirc.plugins.PluginDomain;
@@ -42,19 +41,17 @@ public class TextPaneFactory {
42 41
     private final String configDomain;
43 42
     private final URLBuilder urlBuilder;
44 43
     private final Clipboard clipboard;
45
-    private final DMDircMBassador eventBus;
46 44
 
47 45
     @Inject
48 46
     public TextPaneFactory(@PluginDomain(SwingController.class) final String configDomain,
49
-            final URLBuilder urlBuilder, final Clipboard clipboard, final DMDircMBassador eventBus) {
47
+            final URLBuilder urlBuilder, final Clipboard clipboard) {
50 48
         this.configDomain = configDomain;
51 49
         this.urlBuilder = urlBuilder;
52 50
         this.clipboard = clipboard;
53
-        this.eventBus = eventBus;
54 51
     }
55 52
 
56 53
     public TextPane getTextPane(final TextFrame frame) {
57
-        return new TextPane(eventBus, configDomain, urlBuilder, clipboard, frame);
54
+        return new TextPane(configDomain, urlBuilder, clipboard, frame);
58 55
     }
59 56
 
60 57
 }

Načítá se…
Zrušit
Uložit