Bladeren bron

SLF4J some more Logging statements in the Swing UI.

pull/423/head
Greg Holmes 9 jaren geleden
bovenliggende
commit
2d8979719d

+ 8
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/Apple.java Bestand weergeven

@@ -26,10 +26,8 @@ import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.DMDircMBassador;
27 27
 import com.dmdirc.addons.ui_swing.components.menubar.MenuBar;
28 28
 import com.dmdirc.events.ClientOpenedEvent;
29
-import com.dmdirc.events.UserErrorEvent;
30 29
 import com.dmdirc.interfaces.ConnectionManager;
31 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32
-import com.dmdirc.logger.ErrorLevel;
33 31
 import com.dmdirc.util.InvalidURIException;
34 32
 import com.dmdirc.util.URIParser;
35 33
 
@@ -53,14 +51,20 @@ import javax.swing.JMenuBar;
53 51
 import javax.swing.JMenuItem;
54 52
 import javax.swing.UIManager;
55 53
 
54
+import org.slf4j.Logger;
55
+import org.slf4j.LoggerFactory;
56
+
56 57
 import net.engio.mbassy.listener.Handler;
57 58
 
59
+import static com.dmdirc.util.LogUtils.USER_ERROR;
60
+
58 61
 /**
59 62
  * Integrate DMDirc with OS X better.
60 63
  */
61 64
 @Singleton
62 65
 public class Apple implements InvocationHandler {
63 66
 
67
+    private static final Logger LOG = LoggerFactory.getLogger(Apple.class);
64 68
     /** Store any addresses that are opened before CLIENT_OPENED. */
65 69
     private final Collection<URI> addresses = new ArrayList<>();
66 70
     /** Config manager used to read settings. */
@@ -105,8 +109,7 @@ public class Apple implements InvocationHandler {
105 109
                 registerOpenURLCallback();
106 110
                 eventBus.subscribe(this);
107 111
             } catch (UnsatisfiedLinkError ule) {
108
-                eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM,
109
-                        ule, "Unable to load JNI library", ""));
112
+                LOG.warn(USER_ERROR, "Unable to load JNI library", ule);
110 113
             }
111 114
         }
112 115
     }
@@ -137,7 +140,7 @@ public class Apple implements InvocationHandler {
137 140
                     : classes);
138 141
             return method.invoke(obj, objects == null ? new Object[0] : objects);
139 142
         } catch (ReflectiveOperationException ex) {
140
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex, "Unable to find OS X classes.", ""));
143
+            LOG.info(USER_ERROR, "Unable to find OS X classes.", ex);
141 144
         }
142 145
 
143 146
         return null;

+ 8
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/RedoAction.java Bestand weergeven

@@ -22,39 +22,37 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.UserErrorEvent;
27
-import com.dmdirc.logger.ErrorLevel;
28
-
29 25
 import java.awt.event.ActionEvent;
30 26
 
31 27
 import javax.swing.AbstractAction;
32 28
 import javax.swing.undo.CannotUndoException;
33 29
 import javax.swing.undo.UndoManager;
34 30
 
31
+import org.slf4j.Logger;
32
+import org.slf4j.LoggerFactory;
33
+
34
+import static com.dmdirc.util.LogUtils.USER_ERROR;
35
+
35 36
 /**
36 37
  * Handles redo's on text components.
37 38
  */
38 39
 public final class RedoAction extends AbstractAction {
39 40
 
41
+    private static final Logger LOG = LoggerFactory.getLogger(RedoAction.class);
40 42
     /** A version number for this class. */
41 43
     private static final long serialVersionUID = 1;
42 44
     /** Undo manager. */
43 45
     private final UndoManager undoManager;
44
-    /** The event bus to post errors to. */
45
-    private final DMDircMBassador eventBus;
46 46
 
47 47
     /**
48 48
      * Creates a new instance of RedoAction.
49 49
      *
50
-     * @param eventBus    The event bus to post errors to
51 50
      * @param undoManager UndoManager to use for this redo action
52 51
      */
53
-    public RedoAction(final DMDircMBassador eventBus, final UndoManager undoManager) {
52
+    public RedoAction(final UndoManager undoManager) {
54 53
         super("Undo");
55 54
 
56 55
         this.undoManager = undoManager;
57
-        this.eventBus = eventBus;
58 56
     }
59 57
 
60 58
     @Override
@@ -64,7 +62,7 @@ public final class RedoAction extends AbstractAction {
64 62
                 undoManager.redo();
65 63
             }
66 64
         } catch (CannotUndoException ex) {
67
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex, "Unable to redo", ""));
65
+            LOG.info(USER_ERROR, "Unable to redo", ex);
68 66
         }
69 67
     }
70 68
 

+ 7
- 8
ui_swing/src/com/dmdirc/addons/ui_swing/SwingUIInitialiser.java Bestand weergeven

@@ -24,12 +24,10 @@ package com.dmdirc.addons.ui_swing;
24 24
 
25 25
 import com.dmdirc.ClientModule.AddonConfig;
26 26
 import com.dmdirc.ClientModule.GlobalConfig;
27
-import com.dmdirc.DMDircMBassador;
28 27
 import com.dmdirc.addons.ui_swing.dialogs.DialogKeyListener;
29
-import com.dmdirc.events.UserErrorEvent;
30 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 29
 import com.dmdirc.interfaces.config.ConfigProvider;
32
-import com.dmdirc.logger.ErrorLevel;
30
+import com.dmdirc.util.LogUtils;
33 31
 
34 32
 import java.awt.Font;
35 33
 import java.awt.KeyboardFocusManager;
@@ -41,25 +39,27 @@ import javax.swing.UnsupportedLookAndFeelException;
41 39
 
42 40
 import net.miginfocom.layout.PlatformDefaults;
43 41
 
42
+import org.slf4j.Logger;
43
+import org.slf4j.LoggerFactory;
44
+
44 45
 /**
45 46
  * Initialises swing and system UI settings.
46 47
  */
47 48
 public class SwingUIInitialiser {
48 49
 
50
+    private static final Logger LOG = LoggerFactory.getLogger(SwingUIInitialiser.class);
49 51
     private final Apple apple;
50 52
     private final AggregateConfigProvider globalConfig;
51 53
     private final ConfigProvider addonConfig;
52 54
     private final DialogKeyListener dialogKeyListener;
53 55
     private final DMDircEventQueue eventQueue;
54
-    private final DMDircMBassador eventBus;
55 56
 
56 57
     @Inject
57
-    public SwingUIInitialiser(final DMDircMBassador eventBus, final Apple apple,
58
+    public SwingUIInitialiser(final Apple apple,
58 59
             @GlobalConfig final AggregateConfigProvider globalConfig,
59 60
             @AddonConfig final ConfigProvider addonConfig,
60 61
             final DialogKeyListener dialogKeyListener,
61 62
             final DMDircEventQueue eventQueue) {
62
-        this.eventBus = eventBus;
63 63
         this.apple = apple;
64 64
         this.globalConfig = globalConfig;
65 65
         this.addonConfig = addonConfig;
@@ -122,8 +122,7 @@ public class SwingUIInitialiser {
122 122
                         Font.PLAIN, 12));
123 123
             } catch (UnsupportedOperationException | UnsupportedLookAndFeelException |
124 124
                     IllegalAccessException | InstantiationException | ClassNotFoundException ex) {
125
-                eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
126
-                        "Unable to set UI Settings", ""));
125
+                LOG.info(LogUtils.USER_ERROR, "Unable to set UI settings", ex);
127 126
             }
128 127
 
129 128
             if ("Metal".equals(UIManager.getLookAndFeel().getName())

+ 7
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java Bestand weergeven

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.components.frames.ChannelFrameFactory;
27 26
 import com.dmdirc.addons.ui_swing.components.frames.CustomFrameFactory;
28 27
 import com.dmdirc.addons.ui_swing.components.frames.CustomInputFrameFactory;
@@ -32,10 +31,8 @@ import com.dmdirc.addons.ui_swing.events.SwingActiveWindowChangeRequestEvent;
32 31
 import com.dmdirc.addons.ui_swing.events.SwingEventBus;
33 32
 import com.dmdirc.addons.ui_swing.events.SwingWindowAddedEvent;
34 33
 import com.dmdirc.addons.ui_swing.events.SwingWindowDeletedEvent;
35
-import com.dmdirc.events.UserErrorEvent;
36 34
 import com.dmdirc.interfaces.WindowModel;
37 35
 import com.dmdirc.interfaces.ui.FrameListener;
38
-import com.dmdirc.logger.ErrorLevel;
39 36
 
40 37
 import java.util.Collection;
41 38
 import java.util.HashMap;
@@ -47,6 +44,11 @@ import javax.annotation.Nullable;
47 44
 import javax.inject.Inject;
48 45
 import javax.inject.Singleton;
49 46
 
47
+import org.slf4j.Logger;
48
+import org.slf4j.LoggerFactory;
49
+
50
+import static com.dmdirc.util.LogUtils.USER_ERROR;
51
+
50 52
 /**
51 53
  * Handles creation of windows in the Swing UI.
52 54
  *
@@ -55,12 +57,11 @@ import javax.inject.Singleton;
55 57
 @Singleton
56 58
 public class SwingWindowFactory implements FrameListener {
57 59
 
60
+    private static final Logger LOG = LoggerFactory.getLogger(SwingWindowFactory.class);
58 61
     /** A map of known implementations of window interfaces. */
59 62
     private final Map<Collection<String>, WindowProvider> implementations = new HashMap<>();
60 63
     /** A map of frame containers to their Swing windows. */
61 64
     private final Map<WindowModel, TextFrame> windows = new HashMap<>();
62
-    /** The event bus to post errors to. */
63
-    private final DMDircMBassador eventBus;
64 65
     /** The swing event bus. */
65 66
     private final SwingEventBus swingEventBus;
66 67
 
@@ -71,7 +72,6 @@ public class SwingWindowFactory implements FrameListener {
71 72
      * @param customInputFrameFactory The factory to use to produce custom input frames.
72 73
      * @param serverFrameFactory      The factory to use to produce server frames.
73 74
      * @param channelFrameFactory     The factory to use to produce channel frames.
74
-     * @param eventBus                The event bus to post errors to
75 75
      * @param swingEventBus           The swing event bus;
76 76
      */
77 77
     @Inject
@@ -80,9 +80,7 @@ public class SwingWindowFactory implements FrameListener {
80 80
             final CustomInputFrameFactory customInputFrameFactory,
81 81
             final ServerFrameFactory serverFrameFactory,
82 82
             final ChannelFrameFactory channelFrameFactory,
83
-            final DMDircMBassador eventBus,
84 83
             final SwingEventBus swingEventBus) {
85
-        this.eventBus = eventBus;
86 84
         this.swingEventBus = swingEventBus;
87 85
 
88 86
         registerImplementation(customFrameFactory);
@@ -137,8 +135,7 @@ public class SwingWindowFactory implements FrameListener {
137 135
      */
138 136
     protected TextFrame doAddWindow(final WindowModel window) {
139 137
         if (!implementations.containsKey(window.getComponents())) {
140
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.HIGH, null,
141
-                    "Unable to create window: Unknown type.", ""));
138
+            LOG.error(USER_ERROR, "Unable to create window: Unknown type.");
142 139
             return null;
143 140
         }
144 141
 

+ 8
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/UndoAction.java Bestand weergeven

@@ -22,39 +22,37 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.UserErrorEvent;
27
-import com.dmdirc.logger.ErrorLevel;
28
-
29 25
 import java.awt.event.ActionEvent;
30 26
 
31 27
 import javax.swing.AbstractAction;
32 28
 import javax.swing.undo.CannotUndoException;
33 29
 import javax.swing.undo.UndoManager;
34 30
 
31
+import org.slf4j.Logger;
32
+import org.slf4j.LoggerFactory;
33
+
34
+import static com.dmdirc.util.LogUtils.USER_ERROR;
35
+
35 36
 /**
36 37
  * Handles undo's on text components.
37 38
  */
38 39
 public final class UndoAction extends AbstractAction {
39 40
 
41
+    private static final Logger LOG = LoggerFactory.getLogger(UndoAction.class);
40 42
     /** A version number for this class. */
41 43
     private static final long serialVersionUID = 1;
42 44
     /** Undo manager. */
43 45
     private final UndoManager undoManager;
44
-    /** The event bus to post errors to. */
45
-    private final DMDircMBassador eventBus;
46 46
 
47 47
     /**
48 48
      * Creates a new instance of UndoAction.
49 49
      *
50
-     * @param eventBus    The event bus to post errors to
51 50
      * @param undoManager UndoManager to use for this redo action
52 51
      */
53
-    public UndoAction(final DMDircMBassador eventBus, final UndoManager undoManager) {
52
+    public UndoAction(final UndoManager undoManager) {
54 53
         super("Undo");
55 54
 
56 55
         this.undoManager = undoManager;
57
-        this.eventBus = eventBus;
58 56
     }
59 57
 
60 58
     @Override
@@ -64,7 +62,7 @@ public final class UndoAction extends AbstractAction {
64 62
                 undoManager.undo();
65 63
             }
66 64
         } catch (CannotUndoException ex) {
67
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex, "Unable to undo", ""));
65
+            LOG.info(USER_ERROR, "Unable to undo", ex);
68 66
         }
69 67
     }
70 68
 

+ 9
- 14
ui_swing/src/com/dmdirc/addons/ui_swing/actions/ReplacePasteAction.java Bestand weergeven

@@ -22,9 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.actions;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26
-import com.dmdirc.events.UserErrorEvent;
27
-import com.dmdirc.logger.ErrorLevel;
25
+import com.dmdirc.util.LogUtils;
28 26
 
29 27
 import java.awt.datatransfer.Clipboard;
30 28
 import java.awt.datatransfer.DataFlavor;
@@ -35,11 +33,15 @@ import java.io.IOException;
35 33
 import javax.swing.AbstractAction;
36 34
 import javax.swing.text.JTextComponent;
37 35
 
36
+import org.slf4j.Logger;
37
+import org.slf4j.LoggerFactory;
38
+
38 39
 /**
39 40
  * Paste action that replaces matching regexes.
40 41
  */
41 42
 public final class ReplacePasteAction extends AbstractAction {
42 43
 
44
+    private static final Logger LOG = LoggerFactory.getLogger(ReplacePasteAction.class);
43 45
     /** A version number for this class. */
44 46
     private static final long serialVersionUID = 1;
45 47
     /** Clipboard to handle pasting. */
@@ -48,22 +50,18 @@ public final class ReplacePasteAction extends AbstractAction {
48 50
     private final String replacementRegex;
49 51
     /** Replacement string. */
50 52
     private final String replacementString;
51
-    /** The event bus to post errors to. */
52
-    private final DMDircMBassador eventBus;
53 53
 
54 54
     /**
55 55
      * Creates a new instance of regex replacement paste action.
56 56
      *
57
-     * @param eventBus          The event bus to post errors to
58 57
      * @param clipboard         Clipboard to handle pasting
59 58
      * @param replacementRegex  Regex to match for replacement
60 59
      * @param replacementString Replacement string
61 60
      */
62
-    public ReplacePasteAction(final DMDircMBassador eventBus, final Clipboard clipboard,
61
+    public ReplacePasteAction(final Clipboard clipboard,
63 62
             final String replacementRegex, final String replacementString) {
64 63
         super("NoSpacesPasteAction");
65 64
 
66
-        this.eventBus = eventBus;
67 65
         this.clipboard = clipboard;
68 66
         this.replacementRegex = replacementRegex;
69 67
         this.replacementString = replacementString;
@@ -83,12 +81,9 @@ public final class ReplacePasteAction extends AbstractAction {
83 81
             ((JTextComponent) e.getSource()).replaceSelection(
84 82
                     ((String) clipboard.getData(DataFlavor.stringFlavor))
85 83
                             .replaceAll(replacementRegex, replacementString));
86
-        } catch (IOException ex) {
87
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
88
-                    "Unable to get clipboard contents: " + ex.getMessage(), ""));
89
-        } catch (UnsupportedFlavorException ex) {
90
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
91
-                    "Unable to get clipboard contents", ""));
84
+        } catch (IOException | UnsupportedFlavorException ex) {
85
+            LOG.info(LogUtils.USER_ERROR, "Unable to get clipboard contents: {}",
86
+                    ex.getMessage(), ex);
92 87
         }
93 88
     }
94 89
 

+ 11
- 8
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/InputTextFramePasteAction.java Bestand weergeven

@@ -25,9 +25,7 @@ package com.dmdirc.addons.ui_swing.components.frames;
25 25
 import com.dmdirc.DMDircMBassador;
26 26
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputField;
27 27
 import com.dmdirc.addons.ui_swing.dialogs.paste.PasteDialogFactory;
28
-import com.dmdirc.events.UserErrorEvent;
29 28
 import com.dmdirc.interfaces.WindowModel;
30
-import com.dmdirc.logger.ErrorLevel;
31 29
 
32 30
 import java.awt.Toolkit;
33 31
 import java.awt.Window;
@@ -39,11 +37,17 @@ import java.io.IOException;
39 37
 
40 38
 import javax.swing.AbstractAction;
41 39
 
40
+import org.slf4j.Logger;
41
+import org.slf4j.LoggerFactory;
42
+
43
+import static com.dmdirc.util.LogUtils.USER_ERROR;
44
+
42 45
 /**
43 46
  * Paste action for input frames.
44 47
  */
45 48
 public final class InputTextFramePasteAction extends AbstractAction {
46 49
 
50
+    private static final Logger LOG = LoggerFactory.getLogger(InputTextFramePasteAction.class);
47 51
     /** A version number for this class. */
48 52
     private static final long serialVersionUID = 1;
49 53
     /** Clipboard to paste from. */
@@ -94,8 +98,7 @@ public final class InputTextFramePasteAction extends AbstractAction {
94 98
                 return;
95 99
             }
96 100
         } catch (final IllegalStateException ex) {
97
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
98
-                    "Unable to paste from clipboard.", ""));
101
+            LOG.info(USER_ERROR, "Unable to paste from clipboard.", ex);
99 102
             return;
100 103
         }
101 104
 
@@ -105,11 +108,11 @@ public final class InputTextFramePasteAction extends AbstractAction {
105 108
             doPaste((String) Toolkit.getDefaultToolkit()
106 109
                     .getSystemClipboard().getData(DataFlavor.stringFlavor));
107 110
         } catch (final IOException ex) {
108
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
109
-                    "Unable to get clipboard contents: " + ex.getMessage(), ""));
111
+            LOG.info(USER_ERROR, "Unable to get clipboard contents: {}",
112
+                    ex.getMessage(), ex);
110 113
         } catch (final UnsupportedFlavorException ex) {
111
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
112
-                    "Unsupported clipboard type", ""));
114
+            LOG.info(USER_ERROR, "Unsupported clipboard type: {}",
115
+                    ex.getMessage(), ex);
113 116
         }
114 117
     }
115 118
 

+ 8
- 11
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateConfigPanel.java Bestand weergeven

@@ -24,16 +24,13 @@ package com.dmdirc.addons.ui_swing.dialogs.prefs;
24 24
 
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.ClientModule.UserConfig;
27
-import com.dmdirc.DMDircMBassador;
28 27
 import com.dmdirc.addons.ui_swing.components.GenericTableModel;
29 28
 import com.dmdirc.addons.ui_swing.components.PackingTable;
30 29
 import com.dmdirc.config.prefs.PreferencesInterface;
31
-import com.dmdirc.events.UserErrorEvent;
32 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33 31
 import com.dmdirc.interfaces.config.ConfigChangeListener;
34 32
 import com.dmdirc.interfaces.config.ConfigProvider;
35 33
 import com.dmdirc.interfaces.config.IdentityController;
36
-import com.dmdirc.logger.ErrorLevel;
37 34
 import com.dmdirc.updater.UpdateChannel;
38 35
 import com.dmdirc.updater.UpdateChecker;
39 36
 import com.dmdirc.updater.UpdateComponent;
@@ -54,12 +51,18 @@ import javax.swing.JScrollPane;
54 51
 
55 52
 import net.miginfocom.swing.MigLayout;
56 53
 
54
+import org.slf4j.Logger;
55
+import org.slf4j.LoggerFactory;
56
+
57
+import static com.dmdirc.util.LogUtils.USER_ERROR;
58
+
57 59
 /**
58 60
  * Updates configuration UI.
59 61
  */
60 62
 public class UpdateConfigPanel extends JPanel implements ActionListener,
61 63
         PreferencesInterface, ConfigChangeListener {
62 64
 
65
+    private static final Logger LOG = LoggerFactory.getLogger(UpdateConfigPanel.class);
63 66
     /** A version number for this class. */
64 67
     private static final long serialVersionUID = 1;
65 68
     /** Global checkbox. */
@@ -80,8 +83,6 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
80 83
     private final CachingUpdateManager updateManager;
81 84
     /** Controller to pass to the update checker. */
82 85
     private final IdentityController identityController;
83
-    /** The event bus to post errors to. */
84
-    private final DMDircMBassador eventBus;
85 86
 
86 87
     /**
87 88
      * Instantiates a new update config panel.
@@ -90,20 +91,17 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
90 91
      * @param globalConfig       The configuration to read global settings from.
91 92
      * @param updateManager      The manager to read update information from.
92 93
      * @param identityController Controller to pass to the update checker.
93
-     * @param eventBus           The event bus to post the errors to
94 94
      */
95 95
     @Inject
96 96
     public UpdateConfigPanel(
97 97
             @UserConfig final ConfigProvider userConfig,
98 98
             @GlobalConfig final AggregateConfigProvider globalConfig,
99 99
             final CachingUpdateManager updateManager,
100
-            final IdentityController identityController,
101
-            final DMDircMBassador eventBus) {
100
+            final IdentityController identityController) {
102 101
         this.userConfig = userConfig;
103 102
         this.globalConfig = globalConfig;
104 103
         this.updateManager = updateManager;
105 104
         this.identityController = identityController;
106
-        this.eventBus = eventBus;
107 105
 
108 106
         initComponents();
109 107
         loadModel();
@@ -164,8 +162,7 @@ public class UpdateConfigPanel extends JPanel implements ActionListener,
164 162
         try {
165 163
             channel = UpdateChannel.valueOf(globalConfig.getOption("updater", "channel"));
166 164
         } catch (IllegalArgumentException e) {
167
-            eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, e,
168
-                    "Invalid setting for update channel, defaulting to none.", ""));
165
+            LOG.info(USER_ERROR, "Invalid setting for update channel, defaulting to none.", e);
169 166
         }
170 167
         updateChannel.setSelectedItem(channel);
171 168
         scrollPane.setViewportView(table);

+ 7
- 10
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/ctrltab/CtrlTabWindowManager.java Bestand weergeven

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.addons.ui_swing.framemanager.ctrltab;
24 24
 
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26
-import com.dmdirc.DMDircMBassador;
27 26
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
28 27
 import com.dmdirc.addons.ui_swing.MainFrame;
29 28
 import com.dmdirc.addons.ui_swing.UIUtilities;
@@ -38,9 +37,8 @@ import com.dmdirc.addons.ui_swing.events.SwingWindowDeletedEvent;
38 37
 import com.dmdirc.addons.ui_swing.events.SwingWindowSelectedEvent;
39 38
 import com.dmdirc.addons.ui_swing.framemanager.tree.TreeViewModel;
40 39
 import com.dmdirc.addons.ui_swing.framemanager.tree.TreeViewNode;
41
-import com.dmdirc.events.UserErrorEvent;
42 40
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
43
-import com.dmdirc.logger.ErrorLevel;
41
+import com.dmdirc.util.LogUtils;
44 42
 
45 43
 import java.awt.event.InputEvent;
46 44
 import java.awt.event.KeyEvent;
@@ -58,6 +56,9 @@ import javax.swing.tree.TreeNode;
58 56
 import javax.swing.tree.TreePath;
59 57
 import javax.swing.tree.TreeSelectionModel;
60 58
 
59
+import org.slf4j.Logger;
60
+import org.slf4j.LoggerFactory;
61
+
61 62
 import net.engio.mbassy.listener.Handler;
62 63
 
63 64
 /**
@@ -66,6 +67,7 @@ import net.engio.mbassy.listener.Handler;
66 67
 @Singleton
67 68
 public class CtrlTabWindowManager {
68 69
 
70
+    private static final Logger LOG = LoggerFactory.getLogger(CtrlTabWindowManager.class);
69 71
     /** Node storage, used for adding and deleting nodes correctly. */
70 72
     private final Map<TextFrame, TreeViewNode> nodes;
71 73
     /** Data model. */
@@ -74,16 +76,12 @@ public class CtrlTabWindowManager {
74 76
     private final TreeScroller treeScroller;
75 77
     /** Selection model for the tree scroller. */
76 78
     private final TreeSelectionModel selectionModel;
77
-    /** The event bus to post errors to. */
78
-    private final DMDircMBassador eventBus;
79 79
 
80 80
     @Inject
81 81
     public CtrlTabWindowManager(
82 82
             @GlobalConfig final AggregateConfigProvider globalConfig,
83 83
             final MainFrame mainFrame,
84
-            final DMDircMBassador eventBus,
85 84
             final SwingEventBus swingEventBus) {
86
-        this.eventBus = eventBus;
87 85
         nodes = new HashMap<>();
88 86
         model = new TreeViewModel(globalConfig, new TreeViewNode(null, null));
89 87
         selectionModel = new DefaultTreeSelectionModel();
@@ -146,9 +144,8 @@ public class CtrlTabWindowManager {
146 144
             }
147 145
             final TreeViewNode node = nodes.get(window);
148 146
             if (node.getLevel() == 0) {
149
-                eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM,
150
-                        new IllegalArgumentException(),
151
-                        "delServer triggered for root node" + node, ""));
147
+                LOG.warn(LogUtils.USER_ERROR, "delServer triggered for root node {}",
148
+                        node, new IllegalArgumentException());
152 149
             } else {
153 150
                 model.removeNodeFromParent(nodes.get(window));
154 151
             }

+ 7
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java Bestand weergeven

@@ -39,15 +39,14 @@ import com.dmdirc.addons.ui_swing.framemanager.FrameManager;
39 39
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
40 40
 import com.dmdirc.events.FrameIconChangedEvent;
41 41
 import com.dmdirc.events.UnreadStatusChangedEvent;
42
-import com.dmdirc.events.UserErrorEvent;
43 42
 import com.dmdirc.interfaces.WindowModel;
44 43
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
45 44
 import com.dmdirc.interfaces.config.ConfigChangeListener;
46 45
 import com.dmdirc.interfaces.ui.Window;
47
-import com.dmdirc.logger.ErrorLevel;
48 46
 import com.dmdirc.plugins.PluginDomain;
49 47
 import com.dmdirc.ui.WindowManager;
50 48
 import com.dmdirc.ui.messages.ColourManager;
49
+import com.dmdirc.util.LogUtils;
51 50
 
52 51
 import java.awt.Rectangle;
53 52
 import java.awt.event.MouseEvent;
@@ -70,6 +69,9 @@ import javax.swing.tree.TreePath;
70 69
 
71 70
 import net.miginfocom.swing.MigLayout;
72 71
 
72
+import org.slf4j.Logger;
73
+import org.slf4j.LoggerFactory;
74
+
73 75
 import net.engio.mbassy.listener.Handler;
74 76
 import net.engio.mbassy.listener.Invoke;
75 77
 
@@ -78,6 +80,7 @@ import net.engio.mbassy.listener.Invoke;
78 80
  */
79 81
 public class TreeFrameManager implements FrameManager, Serializable, ConfigChangeListener {
80 82
 
83
+    private static final Logger LOG = LoggerFactory.getLogger(TreeFrameManager.class);
81 84
     /** Serial version UID. */
82 85
     private static final long serialVersionUID = 5;
83 86
     /** node storage, used for adding and deleting nodes correctly. */
@@ -195,9 +198,8 @@ public class TreeFrameManager implements FrameManager, Serializable, ConfigChang
195 198
             }
196 199
             final DefaultMutableTreeNode node = nodes.get(window);
197 200
             if (node.getLevel() == 0) {
198
-                eventBus.publishAsync(
199
-                        new UserErrorEvent(ErrorLevel.MEDIUM, new IllegalArgumentException(),
200
-                                "delServer triggered for root node" + node, ""));
201
+                LOG.warn(LogUtils.USER_ERROR, "delServer triggered for root node {}",
202
+                        node, new IllegalArgumentException());
201 203
             } else {
202 204
                 model.removeNodeFromParent(nodes.get(window));
203 205
             }

Laden…
Annuleren
Opslaan