Browse Source

Java 7 conversions

Change-Id: Ic204dbad72378455b5cd9dbd66d29dacf31ddd9c
Reviewed-on: http://gerrit.dmdirc.com/2895
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes 10 years ago
parent
commit
a9354e7b54
93 changed files with 506 additions and 554 deletions
  1. 1
    3
      src/com/dmdirc/addons/audio/AudioPlayer.java
  2. 1
    1
      src/com/dmdirc/addons/calc/Lexer.java
  3. 3
    3
      src/com/dmdirc/addons/calc/Parser.java
  4. 2
    2
      src/com/dmdirc/addons/calc/TokenType.java
  5. 1
    1
      src/com/dmdirc/addons/calc/TreeToken.java
  6. 1
    3
      src/com/dmdirc/addons/dcc/io/DCC.java
  7. 4
    7
      src/com/dmdirc/addons/dcc/io/DCCTransfer.java
  8. 3
    2
      src/com/dmdirc/addons/dcc/kde/KFileChooser.java
  9. 1
    1
      src/com/dmdirc/addons/dcop/DcopPlugin.java
  10. 6
    12
      src/com/dmdirc/addons/debug/commands/ConfigStats.java
  11. 20
    25
      src/com/dmdirc/addons/debug/commands/Error.java
  12. 1
    2
      src/com/dmdirc/addons/debug/commands/FakeUpdates.java
  13. 2
    2
      src/com/dmdirc/addons/dns/DNSPlugin.java
  14. 1
    1
      src/com/dmdirc/addons/identd/IdentdServer.java
  15. 1
    1
      src/com/dmdirc/addons/lagdisplay/PingHistoryPanel.java
  16. 4
    4
      src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java
  17. 1
    1
      src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSourcePlugin.java
  18. 1
    1
      src/com/dmdirc/addons/mediasource_mplayer/MplayerMediaSourcePlugin.java
  19. 2
    3
      src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java
  20. 27
    33
      src/com/dmdirc/addons/nickcolours/NickColourPanel.java
  21. 1
    1
      src/com/dmdirc/addons/nma/NotifyMyAndroidClient.java
  22. 3
    3
      src/com/dmdirc/addons/notifications/NotificationConfig.java
  23. 1
    1
      src/com/dmdirc/addons/nowplaying/NowPlayingSubsitutionPanel.java
  24. 4
    7
      src/com/dmdirc/addons/parser_msn/MSNListener.java
  25. 12
    24
      src/com/dmdirc/addons/parser_msn/MSNParser.java
  26. 3
    4
      src/com/dmdirc/addons/parser_xmpp/FixedXmppConnection.java
  27. 5
    7
      src/com/dmdirc/addons/parser_xmpp/XmppClientInfo.java
  28. 2
    2
      src/com/dmdirc/addons/parser_xmpp/XmppParser.java
  29. 2
    3
      src/com/dmdirc/addons/parserdebug/DebugPlugin.java
  30. 17
    19
      src/com/dmdirc/addons/relaybot/RelayChannelPanel.java
  31. 1
    2
      src/com/dmdirc/addons/scriptplugin/JavaScriptHelper.java
  32. 21
    21
      src/com/dmdirc/addons/scriptplugin/ScriptCommand.java
  33. 2
    2
      src/com/dmdirc/addons/scriptplugin/ScriptEngineWrapper.java
  34. 3
    1
      src/com/dmdirc/addons/scriptplugin/ScriptPlugin.java
  35. 1
    1
      src/com/dmdirc/addons/serverlists/io/ServerGroupWriter.java
  36. 3
    1
      src/com/dmdirc/addons/swingdebug/TracingEventQueue.java
  37. 7
    4
      src/com/dmdirc/addons/systray/SystrayPlugin.java
  38. 51
    53
      src/com/dmdirc/addons/time/TimerCommand.java
  39. 1
    1
      src/com/dmdirc/addons/ui_swing/PrefsComponentFactory.java
  40. 10
    14
      src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java
  41. 2
    2
      src/com/dmdirc/addons/ui_swing/cinch/ConfirmAction.java
  42. 4
    3
      src/com/dmdirc/addons/ui_swing/cinch/InputAction.java
  43. 2
    2
      src/com/dmdirc/addons/ui_swing/cinch/ValidatesIf.java
  44. 1
    1
      src/com/dmdirc/addons/ui_swing/components/GenericListModel.java
  45. 7
    4
      src/com/dmdirc/addons/ui_swing/components/NicklistListModel.java
  46. 2
    4
      src/com/dmdirc/addons/ui_swing/components/SendWorker.java
  47. 1
    1
      src/com/dmdirc/addons/ui_swing/components/SwingSearchBar.java
  48. 1
    1
      src/com/dmdirc/addons/ui_swing/components/ToolTipPanel.java
  49. 15
    11
      src/com/dmdirc/addons/ui_swing/components/URLProtocolPanel.java
  50. 2
    2
      src/com/dmdirc/addons/ui_swing/components/expandingsettings/CurrentOptionsPanel.java
  51. 1
    1
      src/com/dmdirc/addons/ui_swing/components/expandingsettings/SettingsPanel.java
  52. 5
    12
      src/com/dmdirc/addons/ui_swing/components/frames/ComponentCreator.java
  53. 19
    16
      src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java
  54. 15
    12
      src/com/dmdirc/addons/ui_swing/components/menubar/ChannelMenu.java
  55. 15
    10
      src/com/dmdirc/addons/ui_swing/components/menubar/ServerMenu.java
  56. 13
    8
      src/com/dmdirc/addons/ui_swing/components/menubar/SettingsMenu.java
  57. 3
    3
      src/com/dmdirc/addons/ui_swing/components/modes/ModesPane.java
  58. 16
    10
      src/com/dmdirc/addons/ui_swing/components/renderers/URIHandlerCellRenderer.java
  59. 1
    1
      src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferHandler.java
  60. 2
    4
      src/com/dmdirc/addons/ui_swing/components/reorderablelist/ReorderableJList.java
  61. 3
    6
      src/com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup.java
  62. 1
    1
      src/com/dmdirc/addons/ui_swing/components/statusbar/MessageLabel.java
  63. 1
    1
      src/com/dmdirc/addons/ui_swing/components/statusbar/MessagePopup.java
  64. 11
    10
      src/com/dmdirc/addons/ui_swing/components/text/WrapColumnFactory.java
  65. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionConditionDisplayPanel.java
  66. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionNamePanel.java
  67. 8
    7
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionResponsePanel.java
  68. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersListPanel.java
  69. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersPanel.java
  70. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupSettingsPanel.java
  71. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionTableModel.java
  72. 6
    10
      src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionsGroupPanel.java
  73. 3
    3
      src/com/dmdirc/addons/ui_swing/dialogs/aliases/AliasTableModel.java
  74. 21
    37
      src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelListModesPane.java
  75. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLConfigPanel.java
  76. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLHandlerTableModel.java
  77. 2
    2
      src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateTableModel.java
  78. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListPanel.java
  79. 4
    7
      src/com/dmdirc/addons/ui_swing/dialogs/sslcertificate/CertificateInfoPanel.java
  80. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/sslcertificate/SummaryPanel.java
  81. 3
    3
      src/com/dmdirc/addons/ui_swing/dialogs/updater/UpdateTableModel.java
  82. 1
    1
      src/com/dmdirc/addons/ui_swing/dialogs/url/URLSubsitutionsPanel.java
  83. 12
    9
      src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java
  84. 1
    1
      src/com/dmdirc/addons/ui_swing/framemanager/ctrltab/CtrlTabWindowManager.java
  85. 35
    33
      src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java
  86. 1
    2
      src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java
  87. 1
    2
      src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowMenuFrameManager.java
  88. 2
    2
      src/com/dmdirc/addons/ui_swing/textpane/TextPaneCanvas.java
  89. 3
    3
      src/com/dmdirc/addons/ui_web/Client.java
  90. 1
    1
      src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java
  91. 8
    8
      test/com/dmdirc/addons/calc/ParserTest.java
  92. 1
    1
      test/com/dmdirc/addons/osd/OsdPolicyTest.java
  93. 3
    3
      test/com/dmdirc/addons/ui_swing/dialogs/profiles/ProfileNameValidatorTest.java

+ 1
- 3
src/com/dmdirc/addons/audio/AudioPlayer.java View File

@@ -101,9 +101,7 @@ public final class AudioPlayer implements Runnable {
101 101
         try {
102 102
             AudioSystem.getAudioInputStream(file);
103 103
             type = AudioType.WAV;
104
-        } catch (UnsupportedAudioFileException e) {
105
-            type = AudioType.INVALID;
106
-        } catch (IOException e) {
104
+        } catch (UnsupportedAudioFileException | IOException e) {
107 105
             type = AudioType.INVALID;
108 106
         }
109 107
         return type;

+ 1
- 1
src/com/dmdirc/addons/calc/Lexer.java View File

@@ -52,7 +52,7 @@ public class Lexer {
52 52
      * @throws ParseException If an expected token is not found
53 53
      */
54 54
     public List<Token> tokenise() throws ParseException {
55
-        final List<Token> res = new ArrayList<Token>();
55
+        final List<Token> res = new ArrayList<>();
56 56
         List<TokenType> possibles = Arrays.asList(TokenType.values());
57 57
 
58 58
         boolean cont = true;

+ 3
- 3
src/com/dmdirc/addons/calc/Parser.java View File

@@ -45,7 +45,7 @@ public class Parser {
45 45
     protected final Lexer lexer;
46 46
 
47 47
     static {
48
-        TOKENS_BY_PRECEDENCE = new ArrayList<TokenType>(Arrays.asList(
48
+        TOKENS_BY_PRECEDENCE = new ArrayList<>(Arrays.asList(
49 49
                 TokenType.values()));
50 50
         Collections.sort(TOKENS_BY_PRECEDENCE,
51 51
                 new TokenTypePrecedenceComparator());
@@ -61,7 +61,7 @@ public class Parser {
61 61
      * formula such as one involving a mis-matched bracket).
62 62
      */
63 63
     public TreeToken parse() throws ParseException {
64
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
64
+        final List<TreeToken> tokens = new ArrayList<>();
65 65
 
66 66
         for (Token token : lexer.tokenise()) {
67 67
             tokens.add(new TreeToken(token));
@@ -138,7 +138,7 @@ public class Parser {
138 138
      */
139 139
     protected void parseBracket(final List<TreeToken> tokens, final int offset)
140 140
             throws ParseException {
141
-        final List<TreeToken> stack = new ArrayList<TreeToken>();
141
+        final List<TreeToken> stack = new ArrayList<>();
142 142
 
143 143
         for (int i = offset - 1; i > 0; i--) {
144 144
             if (tokens.get(i).getToken().getType() == TokenType.BRACKET_OPEN

+ 2
- 2
src/com/dmdirc/addons/calc/TokenType.java View File

@@ -184,7 +184,7 @@ public enum TokenType {
184 184
      */
185 185
     public synchronized List<TokenType> getFollowers() {
186 186
         if (follows == null) {
187
-            follows = new ArrayList<TokenType>();
187
+            follows = new ArrayList<>();
188 188
 
189 189
             for (int i = 0; i < strfollows.length; i++) {
190 190
                 follows.addAll(searchValueOf(strfollows[i]));
@@ -230,7 +230,7 @@ public enum TokenType {
230 230
      * @return A list of matching tokens
231 231
      */
232 232
     protected static List<TokenType> searchValueOf(final String name) {
233
-        final List<TokenType> res = new ArrayList<TokenType>();
233
+        final List<TokenType> res = new ArrayList<>();
234 234
 
235 235
         for (TokenType token : values()) {
236 236
             if ((name.endsWith("*") && token.name().startsWith(name.substring(0,

+ 1
- 1
src/com/dmdirc/addons/calc/TreeToken.java View File

@@ -39,7 +39,7 @@ public class TreeToken {
39 39
 
40 40
     /** The children of this node. */
41 41
     @Getter
42
-    private final List<TreeToken> children = new ArrayList<TreeToken>();
42
+    private final List<TreeToken> children = new ArrayList<>();
43 43
 
44 44
     /** The token at the root of the tree. */
45 45
     @Getter

+ 1
- 3
src/com/dmdirc/addons/dcc/io/DCC.java View File

@@ -124,9 +124,7 @@ public abstract class DCC implements Runnable {
124 124
                 serverSocket = new ServerSocket(i, 1);
125 125
                 // Found a socket we can use!
126 126
                 break;
127
-            } catch (IOException ioe) {
128
-                // Try next socket.
129
-            } catch (SecurityException se) {
127
+            } catch (IOException | SecurityException ioe) {
130 128
                 // Try next socket.
131 129
             } finally {
132 130
                 serverSocketSem.release();

+ 4
- 7
src/com/dmdirc/addons/dcc/io/DCCTransfer.java View File

@@ -43,7 +43,7 @@ import java.util.List;
43 43
 public class DCCTransfer extends DCC {
44 44
 
45 45
     /** List of active sends. */
46
-    private static final List<DCCTransfer> TRANSFERS = new ArrayList<DCCTransfer>();
46
+    private static final List<DCCTransfer> TRANSFERS = new ArrayList<>();
47 47
 
48 48
     /** File Transfer Types. */
49 49
     public enum TransferType {
@@ -133,7 +133,7 @@ public class DCCTransfer extends DCC {
133 133
      */
134 134
     public static List<DCCTransfer> getTransfers() {
135 135
         synchronized (TRANSFERS) {
136
-            return new ArrayList<DCCTransfer>(TRANSFERS);
136
+            return new ArrayList<>(TRANSFERS);
137 137
         }
138 138
     }
139 139
 
@@ -156,11 +156,8 @@ public class DCCTransfer extends DCC {
156 156
         if (transferType == TransferType.SEND) {
157 157
             transferFile = new File(filename);
158 158
             try {
159
-                fileIn = new DataInputStream(new FileInputStream(
160
-                        transferFile.getAbsolutePath()));
161
-            } catch (FileNotFoundException e) {
162
-                fileIn = null;
163
-            } catch (SecurityException e) {
159
+                fileIn = new DataInputStream(new FileInputStream(transferFile.getAbsolutePath()));
160
+            } catch (FileNotFoundException | SecurityException e) {
164 161
                 fileIn = null;
165 162
             }
166 163
         }

+ 3
- 2
src/com/dmdirc/addons/dcc/kde/KFileChooser.java View File

@@ -28,6 +28,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
28 28
 import java.awt.Component;
29 29
 import java.awt.HeadlessException;
30 30
 import java.io.File;
31
+import java.io.IOException;
31 32
 import java.util.ArrayList;
32 33
 import java.util.List;
33 34
 
@@ -295,7 +296,7 @@ public class KFileChooser extends JFileChooser {
295 296
         try {
296 297
             kdp = new KDialogProcess(params.toArray(new String[params.size()]));
297 298
             kdp.waitFor();
298
-        } catch (Exception e) {
299
+        } catch (IOException | InterruptedException e) {
299 300
             return JFileChooser.ERROR_OPTION;
300 301
         }
301 302
 
@@ -344,7 +345,7 @@ public class KFileChooser extends JFileChooser {
344 345
         try {
345 346
             kdp = new KDialogProcess(params.toArray(new String[params.size()]));
346 347
             kdp.waitFor();
347
-        } catch (Exception e) {
348
+        } catch (IOException | InterruptedException e) {
348 349
             return JFileChooser.ERROR_OPTION;
349 350
         }
350 351
 

+ 1
- 1
src/com/dmdirc/addons/dcop/DcopPlugin.java View File

@@ -53,7 +53,7 @@ public final class DcopPlugin extends BaseCommandPlugin {
53 53
      * @return The output of the specified command
54 54
      */
55 55
     public static List<String> getDcopResult(final String command) {
56
-        final ArrayList<String> result = new ArrayList<String>();
56
+        final ArrayList<String> result = new ArrayList<>();
57 57
 
58 58
         InputStreamReader reader;
59 59
         BufferedReader input;

+ 6
- 12
src/com/dmdirc/addons/debug/commands/ConfigStats.java View File

@@ -118,8 +118,7 @@ public class ConfigStats extends DebugCommand {
118 118
             }
119 119
         }
120 120
         if (!found) {
121
-            sendLine(origin, isSilent, FORMAT_ERROR,
122
-                    "Unable to locate option.");
121
+            sendLine(origin, isSilent, FORMAT_ERROR, "Unable to locate option.");
123 122
         }
124 123
     }
125 124
 
@@ -140,8 +139,7 @@ public class ConfigStats extends DebugCommand {
140 139
                 break;
141 140
             }
142 141
             i++;
143
-            sendLine(origin, isSilent, FORMAT_OUTPUT,
144
-                    entry.getKey() + " - " + entry.getValue());
142
+            sendLine(origin, isSilent, FORMAT_OUTPUT, entry.getKey() + " - " + entry.getValue());
145 143
         }
146 144
     }
147 145
 
@@ -160,8 +158,7 @@ public class ConfigStats extends DebugCommand {
160 158
             if (entry.getValue() <= cutoff) {
161 159
                 break;
162 160
             }
163
-            sendLine(origin, isSilent, FORMAT_OUTPUT,
164
-                    entry.getKey() + " - " + entry.getValue());
161
+            sendLine(origin, isSilent, FORMAT_OUTPUT, entry.getKey() + " - " + entry.getValue());
165 162
         }
166 163
     }
167 164
 
@@ -172,15 +169,13 @@ public class ConfigStats extends DebugCommand {
172 169
      * @return Sorted set of config options and usages
173 170
      */
174 171
     private static SortedSet<Entry<String, Integer>> getSortedStats() {
175
-        final SortedSet<Entry<String, Integer>> sortedStats =
176
-                new TreeSet<Entry<String, Integer>>(new ValueComparator());
172
+        final SortedSet<Entry<String, Integer>> sortedStats = new TreeSet<>(new ValueComparator());
177 173
         sortedStats.addAll(ConfigManager.getStats().entrySet());
178 174
         return sortedStats;
179 175
     }
180 176
 
181 177
     /** Reverse value comparator for a map entry. */
182
-    private static class ValueComparator implements
183
-            Comparator<Entry<String, Integer>>, Serializable {
178
+    private static class ValueComparator implements Comparator<Entry<String, Integer>>, Serializable {
184 179
 
185 180
         /**
186 181
          * A version number for this class. It should be changed whenever the
@@ -191,8 +186,7 @@ public class ConfigStats extends DebugCommand {
191 186
 
192 187
         /** {@inheritDoc} */
193 188
         @Override
194
-        public int compare(final Entry<String, Integer> o1,
195
-                final Entry<String, Integer> o2) {
189
+        public int compare(final Entry<String, Integer> o1, final Entry<String, Integer> o2) {
196 190
             int returnValue = o1.getValue().compareTo(o2.getValue()) * -1;
197 191
 
198 192
             if (returnValue == 0) {

+ 20
- 25
src/com/dmdirc/addons/debug/commands/Error.java View File

@@ -19,7 +19,6 @@
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
21 21
  */
22
-
23 22
 package com.dmdirc.addons.debug.commands;
24 23
 
25 24
 import com.dmdirc.FrameContainer;
@@ -38,9 +37,6 @@ import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
  */
39 38
 public class Error extends DebugCommand implements IntelligentCommand {
40 39
 
41
-    /** Error level to create. */
42
-    private ErrorLevel el = ErrorLevel.HIGH;
43
-
44 40
     /**
45 41
      * Creates a new instance of the command.
46 42
      *
@@ -51,33 +47,38 @@ public class Error extends DebugCommand implements IntelligentCommand {
51 47
         super(plugin, command);
52 48
     }
53 49
 
54
-    /** {@inheritDoc} */
50
+    /**
51
+     * {@inheritDoc}
52
+     */
55 53
     @Override
56 54
     public String getName() {
57 55
         return "error";
58 56
     }
59 57
 
60
-    /** {@inheritDoc} */
58
+    /**
59
+     * {@inheritDoc}
60
+     */
61 61
     @Override
62 62
     public String getUsage() {
63 63
         return "<user|app> [<low|medium|high|fatal|unknown>] - Creates an error"
64 64
                 + " with the specified parameters, defaults to high priority.";
65 65
     }
66 66
 
67
-    /** {@inheritDoc} */
67
+    /**
68
+     * {@inheritDoc}
69
+     */
68 70
     @Override
69 71
     public void execute(final FrameContainer origin,
70 72
             final CommandArguments args, final CommandContext context) {
71 73
         if ((args.getArguments().length == 1
72 74
                 || args.getArguments().length == 2)
73 75
                 && args.getArguments()[0].equals("user")) {
74
-            Logger.userError(getLevel(args.getArguments()),
75
-                    "Debug error message");
76
+            Logger.userError(getLevel(args.getArguments()), "Debug error message");
76 77
         } else if ((args.getArguments().length == 1
77 78
                 || args.getArguments().length == 2)
78 79
                 && args.getArguments()[0].equals("app")) {
79
-            Logger.appError(getLevel(args.getArguments()),
80
-                    "Debug error message", new IllegalArgumentException());
80
+            Logger.appError(getLevel(args.getArguments()), "Debug error message",
81
+                    new IllegalArgumentException());
81 82
         } else {
82 83
             showUsage(origin, args.isSilent(), getName(), getUsage());
83 84
         }
@@ -92,25 +93,19 @@ public class Error extends DebugCommand implements IntelligentCommand {
92 93
      */
93 94
     private ErrorLevel getLevel(final String... args) {
94 95
         if (args.length >= 2) {
95
-            final String level = args[1];
96
-            if ("low".equals(level)) {
97
-                el = ErrorLevel.LOW;
98
-            } else if ("medium".equals(level)) {
99
-                el = ErrorLevel.MEDIUM;
100
-            } else if ("fatal".equals(level)) {
101
-                el = ErrorLevel.FATAL;
102
-            } else if ("unknown".equals(level)) {
103
-                el = ErrorLevel.UNKNOWN;
104
-            } else {
105
-                el = ErrorLevel.HIGH;
96
+            try {
97
+                return ErrorLevel.valueOf(args[1].toUpperCase());
98
+            } catch (IllegalArgumentException ex) {
99
+                return ErrorLevel.HIGH;
106 100
             }
107 101
         } else {
108
-            el = ErrorLevel.HIGH;
102
+            return ErrorLevel.HIGH;
109 103
         }
110
-        return el;
111 104
     }
112 105
 
113
-    /** {@inheritDoc} */
106
+    /**
107
+     * {@inheritDoc}
108
+     */
114 109
     @Override
115 110
     public AdditionalTabTargets getSuggestions(final int arg,
116 111
             final IntelligentCommandContext context) {

+ 1
- 2
src/com/dmdirc/addons/debug/commands/FakeUpdates.java View File

@@ -95,8 +95,7 @@ public class FakeUpdates extends DebugCommand {
95 95
         @Override
96 96
         public Map<UpdateComponent, UpdateCheckResult> checkForUpdates(
97 97
                 final Collection<UpdateComponent> components) {
98
-            final Map<UpdateComponent, UpdateCheckResult> res
99
-                    = new HashMap<UpdateComponent, UpdateCheckResult>();
98
+            final Map<UpdateComponent, UpdateCheckResult> res = new HashMap<>();
100 99
 
101 100
             for (UpdateComponent component : components) {
102 101
                 if (Math.random() * components.size() < 10) {

+ 2
- 2
src/com/dmdirc/addons/dns/DNSPlugin.java View File

@@ -54,7 +54,7 @@ public final class DNSPlugin extends BaseCommandPlugin {
54 54
      * @return Resolved IP(s)
55 55
      */
56 56
     public static String getIPs(final String hostname) {
57
-        List<String> results = new ArrayList<String>();
57
+        List<String> results = new ArrayList<>();
58 58
 
59 59
         try {
60 60
             final InetAddress[] ips = InetAddress.getAllByName(hostname);
@@ -64,7 +64,7 @@ public final class DNSPlugin extends BaseCommandPlugin {
64 64
             }
65 65
 
66 66
         } catch (UnknownHostException ex) {
67
-            results = new ArrayList<String>();
67
+            results = new ArrayList<>();
68 68
         }
69 69
 
70 70
         return results.toString();

+ 1
- 1
src/com/dmdirc/addons/identd/IdentdServer.java View File

@@ -44,7 +44,7 @@ public final class IdentdServer implements Runnable {
44 44
     private ServerSocket serverSocket;
45 45
 
46 46
     /** Arraylist of all the clients we have */
47
-    private final List<IdentClient> clientList = new ArrayList<IdentClient>();
47
+    private final List<IdentClient> clientList = new ArrayList<>();
48 48
 
49 49
     /** The plugin that owns us. */
50 50
     private final IdentdPlugin myPlugin;

+ 1
- 1
src/com/dmdirc/addons/lagdisplay/PingHistoryPanel.java View File

@@ -102,7 +102,7 @@ public class PingHistoryPanel extends JPanel {
102 102
 
103 103
         long last1 = -1, last2 = -1;
104 104
         final List<Long> list = history.getList();
105
-        final List<Rectangle> rects = new ArrayList<Rectangle>();
105
+        final List<Rectangle> rects = new ArrayList<>();
106 106
 
107 107
         for (int i = 0; i < list.size(); i++) {
108 108
             final Long value = list.get(i);

+ 4
- 4
src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java View File

@@ -46,14 +46,14 @@ public class DBusMediaSource extends BasePlugin implements MediaSourceManager {
46 46
     private List<MediaSource> sources;
47 47
     /** A map of discovered mpris sources. */
48 48
     private final Map<String, MediaSource> mprisSources
49
-            = new HashMap<String, MediaSource>();
49
+            = new HashMap<>();
50 50
     /** The path to qdbus. */
51 51
     private String qdbus;
52 52
 
53 53
     /** {@inheritDoc} */
54 54
     @Override
55 55
     public void onLoad() {
56
-        sources = new ArrayList<MediaSource>();
56
+        sources = new ArrayList<>();
57 57
 
58 58
         if (new File("/usr/bin/qdbus").exists()) {
59 59
             qdbus = "/usr/bin/qdbus";
@@ -118,7 +118,7 @@ public class DBusMediaSource extends BasePlugin implements MediaSourceManager {
118 118
      * @return The output of the specified command
119 119
      */
120 120
     protected static List<String> getInfo(final String[] args) {
121
-        final ArrayList<String> result = new ArrayList<String>();
121
+        final ArrayList<String> result = new ArrayList<>();
122 122
 
123 123
         InputStreamReader reader;
124 124
         BufferedReader input;
@@ -154,7 +154,7 @@ public class DBusMediaSource extends BasePlugin implements MediaSourceManager {
154 154
      */
155 155
     protected static Map<String, String> parseDictionary(
156 156
             final List<String> lines) {
157
-        final Map<String, String> res = new HashMap<String, String>();
157
+        final Map<String, String> res = new HashMap<>();
158 158
 
159 159
         for (String line : lines) {
160 160
             final int index = line.indexOf(':', line.indexOf(':') + 1);

+ 1
- 1
src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSourcePlugin.java View File

@@ -41,7 +41,7 @@ public class TitleMediaSourcePlugin extends BasePlugin implements MediaSourceMan
41 41
     /** {@inheritDoc} */
42 42
     @Override
43 43
     public void onLoad() {
44
-        sources = new ArrayList<MediaSource>(2);
44
+        sources = new ArrayList<>(2);
45 45
         sources.add(new TitleMediaSource("grep -E '\\(\"last\\.?fm\" \"Last\\.?fm\"\\)'" +
46 46
                     "| grep -vE '(\"Last.fm " +
47 47
                     "Options\"|\"Diagnostics\"|\"last\\.?fm\"|\"Share\"|\\(has no " +

+ 1
- 1
src/com/dmdirc/addons/mediasource_mplayer/MplayerMediaSourcePlugin.java View File

@@ -102,7 +102,7 @@ public class MplayerMediaSourcePlugin extends BasePlugin implements MediaSource
102 102
      * @return Information about the currently playing track
103 103
      */
104 104
     public static List<String> getInfo() {
105
-        final ArrayList<String> result = new ArrayList<String>();
105
+        final ArrayList<String> result = new ArrayList<>();
106 106
 
107 107
         InputStreamReader reader;
108 108
         BufferedReader input;

+ 2
- 3
src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java View File

@@ -54,7 +54,7 @@ public class WindowsMediaSourcePlugin extends BasePlugin
54 54
     public WindowsMediaSourcePlugin(final PluginInfo pluginInfo) {
55 55
         super();
56 56
         this.filesHelper = new PluginFilesHelper(pluginInfo);
57
-        sources = new ArrayList<MediaSource>();
57
+        sources = new ArrayList<>();
58 58
         sources.add(new DllSource(this, "Winamp", true));
59 59
         sources.add(new DllSource(this, "iTunes", false));
60 60
     }
@@ -87,8 +87,7 @@ public class WindowsMediaSourcePlugin extends BasePlugin
87 87
             }
88 88
 
89 89
             return new MediaInfoOutput(myProcess.exitValue(), data.toString());
90
-        } catch (SecurityException e) {
91
-        } catch (IOException e) {
90
+        } catch (SecurityException | IOException e) {
92 91
         }
93 92
 
94 93
         return new MediaInfoOutput(-1, "Error executing GetMediaInfo.exe");

+ 27
- 33
src/com/dmdirc/addons/nickcolours/NickColourPanel.java View File

@@ -59,8 +59,7 @@ public class NickColourPanel extends JPanel implements ActionListener,
59 59
     private static final long serialVersionUID = 1;
60 60
 
61 61
     /** The table headings. */
62
-    private static final String[] HEADERS =
63
-            {"Network", "Nickname", "Text colour", "Nicklist colour"};
62
+    private static final String[] HEADERS = {"Network", "Nickname", "Text colour", "Nicklist colour"};
64 63
 
65 64
     /** The table used for displaying the options. */
66 65
     private final JTable table;
@@ -127,8 +126,7 @@ public class NickColourPanel extends JPanel implements ActionListener,
127 126
         table.setFillsViewportHeight(true);
128 127
         table.setDefaultRenderer(Color.class, new ColourRenderer(colourManager));
129 128
 
130
-        setLayout(new MigLayout("ins 0, fillx, hmax "
131
-                + controller.getPrefsDialog().getPanelHeight()));
129
+        setLayout(new MigLayout("ins 0, fillx, hmax " + controller.getPrefsDialog().getPanelHeight()));
132 130
         add(scrollPane, "grow, push, wrap, spanx");
133 131
 
134 132
         final JButton addButton = new JButton("Add");
@@ -163,35 +161,31 @@ public class NickColourPanel extends JPanel implements ActionListener,
163 161
      */
164 162
     @Override
165 163
     public void actionPerformed(final ActionEvent e) {
166
-        if (e.getActionCommand().equals("Add")) {
167
-            new NickColourInputDialog(swingController, this);
168
-        } else if (e.getActionCommand().equals("Edit")) {
169
-            final DefaultTableModel model
170
-                    = ((DefaultTableModel) table.getModel());
171
-            final int row = table.getSelectedRow();
172
-
173
-            final String network = (String) model.getValueAt(row, 0);
174
-            final String nickname = (String) model.getValueAt(row, 1);
175
-
176
-            String textcolour = (String) model.getValueAt(row, 2);
177
-            String nickcolour = (String) model.getValueAt(row, 3);
178
-
179
-            if (textcolour == null) {
180
-                textcolour = "";
181
-            }
182
-
183
-            if (nickcolour == null) {
184
-                nickcolour = "";
185
-            }
186
-
187
-            new NickColourInputDialog(swingController, this, row, nickname, network, textcolour,
188
-                    nickcolour);
189
-        } else if (e.getActionCommand().equals("Delete")) {
190
-            final int row = table.getSelectedRow();
191
-
192
-            if (row > -1) {
193
-                ((DefaultTableModel) table.getModel()).removeRow(row);
194
-            }
164
+        final int row = table.getSelectedRow();
165
+        switch (e.getActionCommand()) {
166
+            case "Add":
167
+                new NickColourInputDialog(swingController, this);
168
+                break;
169
+            case "Edit":
170
+                final DefaultTableModel model = ((DefaultTableModel) table.getModel());
171
+                final String network = (String) model.getValueAt(row, 0);
172
+                final String nickname = (String) model.getValueAt(row, 1);
173
+                String textcolour = (String) model.getValueAt(row, 2);
174
+                String nickcolour = (String) model.getValueAt(row, 3);
175
+                if (textcolour == null) {
176
+                    textcolour = "";
177
+                }
178
+                if (nickcolour == null) {
179
+                    nickcolour = "";
180
+                }
181
+                new NickColourInputDialog(swingController, this, row, nickname, network,
182
+                        textcolour, nickcolour);
183
+                break;
184
+            case "Delete":
185
+                if (row > -1) {
186
+                    ((DefaultTableModel) table.getModel()).removeRow(row);
187
+                }
188
+                break;
195 189
         }
196 190
     }
197 191
 

+ 1
- 1
src/com/dmdirc/addons/nma/NotifyMyAndroidClient.java View File

@@ -72,7 +72,7 @@ public class NotifyMyAndroidClient {
72 72
      * @throws IOException If the NMA service couldn't be reached
73 73
      */
74 74
     public void notify(final String event, final String description) throws IOException {
75
-        final Map<String, String> arguments = new HashMap<String, String>();
75
+        final Map<String, String> arguments = new HashMap<>();
76 76
         arguments.put("apikey", getApiKeys());
77 77
         arguments.put("application", application);
78 78
         arguments.put("event", event);

+ 3
- 3
src/com/dmdirc/addons/notifications/NotificationConfig.java View File

@@ -67,9 +67,9 @@ public class NotificationConfig extends JPanel implements PreferencesInterface {
67 67
         super();
68 68
 
69 69
         if (methods == null) {
70
-            this.methods = new LinkedList<String>();
70
+            this.methods = new LinkedList<>();
71 71
         } else {
72
-            this.methods = new LinkedList<String>(methods);
72
+            this.methods = new LinkedList<>(methods);
73 73
         }
74 74
         this.plugin = plugin;
75 75
 
@@ -115,7 +115,7 @@ public class NotificationConfig extends JPanel implements PreferencesInterface {
115 115
      * @return An ordered list of methods
116 116
      */
117 117
     public List<String> getMethods() {
118
-        final List<String> newMethods = new LinkedList<String>();
118
+        final List<String> newMethods = new LinkedList<>();
119 119
 
120 120
         final Enumeration<?> values = list.getModel().elements();
121 121
 

+ 1
- 1
src/com/dmdirc/addons/nowplaying/NowPlayingSubsitutionPanel.java View File

@@ -67,7 +67,7 @@ public class NowPlayingSubsitutionPanel extends SubstitutionsPanel<List<String>>
67 67
             /** {@inheritDoc} */
68 68
             @Override
69 69
             public void run() {
70
-                substitutions = new ArrayList<SubstitutionLabel>();
70
+                substitutions = new ArrayList<>();
71 71
 
72 72
                 if (type != null) {
73 73
                     for (String sub : type) {

+ 4
- 7
src/com/dmdirc/addons/parser_msn/MSNListener.java View File

@@ -76,8 +76,7 @@ public class MSNListener extends MsnAdapter {
76 76
 
77 77
     /** {@inheritDoc} */
78 78
     @Override
79
-    public void contactAddCompleted(final MsnMessenger mm, final MsnContact mc,
80
-            final MsnList ml) {
79
+    public void contactAddCompleted(final MsnMessenger mm, final MsnContact mc, final MsnList ml) {
81 80
         parser.addClient(mc);
82 81
         parser.addClients(parser.getFakeChannel(), Arrays.asList(
83 82
                 new ClientInfo[]{ parser.getClient(mc), }));
@@ -86,9 +85,8 @@ public class MSNListener extends MsnAdapter {
86 85
     /** {@inheritDoc} */
87 86
     @Override
88 87
     public void contactListSyncCompleted(final MsnMessenger mm) {
89
-        final Collection<MsnContact> contacts = Arrays.asList(
90
-                mm.getContactList().getContacts());
91
-        final List<ClientInfo> clients = new ArrayList<ClientInfo>();
88
+        final Collection<MsnContact> contacts = Arrays.asList(mm.getContactList().getContacts());
89
+        final List<ClientInfo> clients = new ArrayList<>();
92 90
         for (MsnContact contact : contacts) {
93 91
             parser.addClient(contact);
94 92
             clients.add(parser.getClient(contact));
@@ -97,8 +95,7 @@ public class MSNListener extends MsnAdapter {
97 95
 
98 96
     /** {@inheritDoc} */
99 97
     @Override
100
-    public void contactStatusChanged(final MsnMessenger mm,
101
-            final MsnContact mc) {
98
+    public void contactStatusChanged(final MsnMessenger mm, final MsnContact mc) {
102 99
         if (mc.getStatus() != MsnUserStatus.OFFLINE) {
103 100
             parser.addClients(parser.getFakeChannel(), Arrays.asList(
104 101
                     new ClientInfo[]{ parser.getClient(mc), }));

+ 12
- 24
src/com/dmdirc/addons/parser_msn/MSNParser.java View File

@@ -56,8 +56,7 @@ public class MSNParser extends BaseParser {
56 56
     /** MSN Connection. */
57 57
     private MsnMessenger msn;
58 58
     /** A cache of known clients. */
59
-    private final Map<String, MSNClientInfo> clients
60
-            = new HashMap<String, MSNClientInfo>();
59
+    private final Map<String, MSNClientInfo> clients = new HashMap<>();
61 60
     /** Whether or not to use a channel for contact lists. */
62 61
     private final boolean useFakeChannel;
63 62
     /** The fake channel to use is useFakeChannel is enabled. */
@@ -130,10 +129,8 @@ public class MSNParser extends BaseParser {
130 129
     /** {@inheritDoc} */
131 130
     @Override
132 131
     public LocalClientInfo getLocalClient() {
133
-        final String[] parts = parseHostmask(msn.getOwner().getEmail()
134
-                .getEmailAddress());
135
-        return new MSNLocalClientInfo(msn.getOwner(), this, parts[0], parts[2],
136
-                parts[1]);
132
+        final String[] parts = parseHostmask(msn.getOwner().getEmail().getEmailAddress());
133
+        return new MSNLocalClientInfo(msn.getOwner(), this, parts[0], parts[2], parts[1]);
137 134
     }
138 135
 
139 136
     /** {@inheritDoc} */
@@ -163,8 +160,7 @@ public class MSNParser extends BaseParser {
163 160
 
164 161
     /** {@inheritDoc} */
165 162
     @Override
166
-    public void sendRawMessage(final String message,
167
-            final QueuePriority priority) {
163
+    public void sendRawMessage(final String message, final QueuePriority priority) {
168 164
         //Ignore
169 165
     }
170 166
 
@@ -188,8 +184,7 @@ public class MSNParser extends BaseParser {
188 184
 
189 185
     /** {@inheritDoc} */
190 186
     @Override
191
-    public Collection<? extends ChannelJoinRequest> extractChannels(
192
-            final URI uri) {
187
+    public Collection<? extends ChannelJoinRequest> extractChannels(final URI uri) {
193 188
         return Collections.<ChannelJoinRequest>emptyList();
194 189
     }
195 190
 
@@ -291,15 +286,13 @@ public class MSNParser extends BaseParser {
291 286
 
292 287
     /** {@inheritDoc} */
293 288
     @Override
294
-    public void sendCTCP(final String target, final String type,
295
-            final String message) {
289
+    public void sendCTCP(final String target, final String type, final String message) {
296 290
         throw new UnsupportedOperationException("Not supported yet.");
297 291
     }
298 292
 
299 293
     /** {@inheritDoc} */
300 294
     @Override
301
-    public void sendCTCPReply(final String target, final String type,
302
-            final String message) {
295
+    public void sendCTCPReply(final String target, final String type, final String message) {
303 296
         throw new UnsupportedOperationException("Not supported yet.");
304 297
     }
305 298
 
@@ -361,8 +354,7 @@ public class MSNParser extends BaseParser {
361 354
             removeMSNParser();
362 355
         }
363 356
         final String[] userInfoParts = getURI().getUserInfo().split(":", 2);
364
-        msn = MsnMessengerFactory.createMsnMessenger(
365
-                userInfoParts[0], userInfoParts[1]);
357
+        msn = MsnMessengerFactory.createMsnMessenger(userInfoParts[0], userInfoParts[1]);
366 358
         listener = new MSNListener(this);
367 359
         msn.addListener(listener);
368 360
     }
@@ -383,8 +375,7 @@ public class MSNParser extends BaseParser {
383 375
      * @param channel Channel to update
384 376
      * @param clients Clients to use in the channel
385 377
      */
386
-    public void updateClients(final ChannelInfo channel,
387
-            final Collection<ClientInfo> clients) {
378
+    public void updateClients(final ChannelInfo channel, final Collection<ClientInfo> clients) {
388 379
         if (channel == fakeChannel) {
389 380
             fakeChannel.replaceContacts(clients);
390 381
         }
@@ -396,8 +387,7 @@ public class MSNParser extends BaseParser {
396 387
      * @param channel Channel to update
397 388
      * @param clients Clients to add in the channel
398 389
      */
399
-    public void addClients(final ChannelInfo channel,
400
-            final Collection<ClientInfo> clients) {
390
+    public void addClients(final ChannelInfo channel, final Collection<ClientInfo> clients) {
401 391
         if (channel == fakeChannel) {
402 392
             fakeChannel.addContacts(clients);
403 393
         }
@@ -409,8 +399,7 @@ public class MSNParser extends BaseParser {
409 399
      * @param channel Channel to update
410 400
      * @param clients Clients to add in the channel
411 401
      */
412
-    public void removeClients(final ChannelInfo channel,
413
-            final Collection<ClientInfo> clients) {
402
+    public void removeClients(final ChannelInfo channel, final Collection<ClientInfo> clients) {
414 403
         if (channel == fakeChannel) {
415 404
             fakeChannel.removeContacts(clients);
416 405
         }
@@ -452,8 +441,7 @@ public class MSNParser extends BaseParser {
452 441
     public void addClient(final MsnContact contact) {
453 442
         final String email = contact.getEmail().getEmailAddress();
454 443
         final String[] parts = parseHostmask(email);
455
-        clients.put(email, new MSNClientInfo(contact, this, parts[0], parts[1],
456
-                parts[2]));
444
+        clients.put(email, new MSNClientInfo(contact, this, parts[0], parts[1], parts[2]));
457 445
     }
458 446
 
459 447
     /**

+ 3
- 4
src/com/dmdirc/addons/parser_xmpp/FixedXmppConnection.java View File

@@ -42,8 +42,7 @@ public class FixedXmppConnection extends XMPPConnection
42 42
         implements ConnectionCreationListener {
43 43
 
44 44
     /** A set of listeners that were registered with the XMPP Parser. */
45
-    private final Set<ConnectionCreationListener> oldListeners
46
-            = new HashSet<ConnectionCreationListener>();
45
+    private final Set<ConnectionCreationListener> oldListeners = new HashSet<>();
47 46
 
48 47
     /**
49 48
      * Creates a new fixed XMPP connection with the specified config.
@@ -109,10 +108,10 @@ public class FixedXmppConnection extends XMPPConnection
109 108
             final Field field = XMPPConnection.class.getDeclaredField("connectionEstablishedListeners");
110 109
             field.setAccessible(true);
111 110
             return (Set<ConnectionCreationListener>) field.get(null);
112
-        } catch (Exception ex) {
111
+        } catch (ReflectiveOperationException ex) {
113 112
             // Throws a bunch of exceptions... Try to carry on anyway, the
114 113
             // horrible concurrency bugs might not bite.
115
-            return new HashSet<ConnectionCreationListener>();
114
+            return new HashSet<>();
116 115
         }
117 116
     }
118 117
 

+ 5
- 7
src/com/dmdirc/addons/parser_xmpp/XmppClientInfo.java View File

@@ -44,8 +44,7 @@ import org.jivesoftware.smack.packet.Presence.Type;
44 44
 public class XmppClientInfo extends BaseClientInfo {
45 45
 
46 46
     /** A map of known endpoints for this client. */
47
-    private final Map<String, XmppEndpoint> endpoints
48
-            = new HashMap<String, XmppEndpoint>();
47
+    private final Map<String, XmppEndpoint> endpoints = new HashMap<>();
49 48
 
50 49
     /**
51 50
      * Creates a new XMPP Client Info object with the specified details.
@@ -55,8 +54,8 @@ public class XmppClientInfo extends BaseClientInfo {
55 54
      * @param user The username of the user this object represents
56 55
      * @param host The hostname of the user this object represents
57 56
      */
58
-    public XmppClientInfo(final XmppParser parser, final String nick,
59
-            final String user, final String host) {
57
+    public XmppClientInfo(final XmppParser parser, final String nick, final String user,
58
+            final String host) {
60 59
         super(parser, nick, user, host);
61 60
     }
62 61
 
@@ -131,12 +130,11 @@ public class XmppClientInfo extends BaseClientInfo {
131 130
      * endpoints, or <code>null</code> if no endpoints are available.
132 131
      */
133 132
     public Mode getAggregatePresence() {
134
-        final List<XmppEndpoint> sortedEndpoints
135
-                = new ArrayList<XmppEndpoint>(endpoints.values());
133
+        final List<XmppEndpoint> sortedEndpoints = new ArrayList<>(endpoints.values());
136 134
         Collections.sort(sortedEndpoints);
137 135
 
138 136
         // Get the set of the highest priority endpoints
139
-        final Set<XmppEndpoint> bestEndpoints = new HashSet<XmppEndpoint>(sortedEndpoints.size());
137
+        final Set<XmppEndpoint> bestEndpoints = new HashSet<>(sortedEndpoints.size());
140 138
         int best = 0;
141 139
         for (XmppEndpoint endpoint : sortedEndpoints) {
142 140
             if (endpoint.getType() != Type.available) {

+ 2
- 2
src/com/dmdirc/addons/parser_xmpp/XmppParser.java View File

@@ -98,10 +98,10 @@ public class XmppParser extends BaseSocketAwareParser {
98 98
     private ChatStateManager stateManager;
99 99
 
100 100
     /** A cache of known chats. */
101
-    private final Map<String, Chat> chats = new HashMap<String, Chat>();
101
+    private final Map<String, Chat> chats = new HashMap<>();
102 102
 
103 103
     /** A cache of known clients. */
104
-    private final Map<String, XmppClientInfo> contacts = new HashMap<String, XmppClientInfo>();
104
+    private final Map<String, XmppClientInfo> contacts = new HashMap<>();
105 105
 
106 106
     /** Whether or not to use a fake local channel for a buddy list replacement. */
107 107
     private final boolean useFakeChannel;

+ 2
- 3
src/com/dmdirc/addons/parserdebug/DebugPlugin.java View File

@@ -45,8 +45,7 @@ public final class DebugPlugin extends BaseCommandPlugin implements
45 45
         DebugInfoListener, ActionListener {
46 46
 
47 47
     /** Map of parsers registered. */
48
-    protected final Map<Parser, DebugWindow> registeredParsers
49
-            = new HashMap<Parser, DebugWindow>();
48
+    protected final Map<Parser, DebugWindow> registeredParsers = new HashMap<>();
50 49
     /** The action controller to use. */
51 50
     private final ActionController actionController;
52 51
 
@@ -79,7 +78,7 @@ public final class DebugPlugin extends BaseCommandPlugin implements
79 78
     public void onUnload() {
80 79
         actionController.unregisterListener(this);
81 80
 
82
-        final ArrayList<DebugWindow> windowList = new ArrayList<DebugWindow>();
81
+        final ArrayList<DebugWindow> windowList = new ArrayList<>();
83 82
         for (Parser parser : registeredParsers.keySet()) {
84 83
             try {
85 84
                 parser.getCallbackManager().delCallback(DebugInfoListener.class, this);

+ 17
- 19
src/com/dmdirc/addons/relaybot/RelayChannelPanel.java View File

@@ -28,7 +28,6 @@ import com.dmdirc.plugins.Plugin;
28 28
 
29 29
 import java.awt.event.ActionEvent;
30 30
 import java.awt.event.ActionListener;
31
-import java.lang.reflect.InvocationTargetException;
32 31
 import java.lang.reflect.Method;
33 32
 import java.util.ArrayList;
34 33
 import java.util.List;
@@ -96,15 +95,12 @@ public class RelayChannelPanel extends JPanel implements ActionListener,
96 95
         try {
97 96
             final Method getPrefsDialog = controller.getClass()
98 97
                     .getDeclaredMethod("getPrefsDialog", (Class<?>) null);
99
-            final Object prefsDialog = getPrefsDialog.invoke(controller,
100
-                    (Class<?>) null);
98
+            final Object prefsDialog = getPrefsDialog.invoke(controller, (Class<?>) null);
101 99
             final Method getPanelHeight = prefsDialog.getClass()
102 100
                     .getDeclaredMethod("getPanelHeight", (Class<?>) null);
103
-            final Object panelHeight = getPanelHeight.invoke(prefsDialog,
104
-                    (Class<?>) null);
101
+            final Object panelHeight = getPanelHeight.invoke(prefsDialog, (Class<?>) null);
105 102
             height = (Integer) panelHeight;
106
-        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
107
-                | NoSuchMethodException | SecurityException ex) {
103
+        } catch (ReflectiveOperationException ex) {
108 104
             height = 100;
109 105
         }
110 106
         setLayout(new MigLayout("ins 0, fillx, hmax " + height));
@@ -129,17 +125,19 @@ public class RelayChannelPanel extends JPanel implements ActionListener,
129 125
     @Override
130 126
     public void actionPerformed(final ActionEvent e) {
131 127
         final DefaultTableModel model = ((DefaultTableModel) table.getModel());
132
-
133
-        if (e.getActionCommand().equals("Add")) {
134
-            addRow("#changeme", "changeme");
135
-        } else if (e.getActionCommand().equals("Delete")) {
136
-            final int row = table.getSelectedRow();
137
-            if (table.isEditing()) {
138
-                table.getCellEditor().stopCellEditing();
139
-            }
140
-            if (row > -1) {
141
-                model.removeRow(row);
142
-            }
128
+        switch (e.getActionCommand()) {
129
+            case "Add":
130
+                addRow("#changeme", "changeme");
131
+                break;
132
+            case "Delete":
133
+                final int row = table.getSelectedRow();
134
+                if (table.isEditing()) {
135
+                    table.getCellEditor().stopCellEditing();
136
+                }
137
+                if (row > -1) {
138
+                    model.removeRow(row);
139
+                }
140
+                break;
143 141
         }
144 142
     }
145 143
 
@@ -169,7 +167,7 @@ public class RelayChannelPanel extends JPanel implements ActionListener,
169 167
      * @return This panel's current data.
170 168
      */
171 169
     public List<String[]> getData() {
172
-        final List<String[]> res = new ArrayList<String[]>();
170
+        final List<String[]> res = new ArrayList<>();
173 171
         final DefaultTableModel model = ((DefaultTableModel) table.getModel());
174 172
 
175 173
         for (int i = 0; i < model.getRowCount(); i++) {

+ 1
- 2
src/com/dmdirc/addons/scriptplugin/JavaScriptHelper.java View File

@@ -41,8 +41,7 @@ public class JavaScriptHelper {
41 41
     private static final int VERSION = 2;
42 42
 
43 43
     /** Hashtable for storing stuff. */
44
-    private static final Map<String, Object> SETTINGS
45
-            = new HashMap<String, Object>();
44
+    private static final Map<String, Object> SETTINGS = new HashMap<>();
46 45
 
47 46
     /**
48 47
      * Method to set Stuff.

+ 21
- 21
src/com/dmdirc/addons/scriptplugin/ScriptCommand.java View File

@@ -35,6 +35,7 @@ import com.dmdirc.interfaces.config.IdentityController;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37 37
 import java.io.File;
38
+import java.io.FileNotFoundException;
38 39
 import java.io.FileWriter;
39 40
 import java.io.IOException;
40 41
 import java.lang.reflect.Method;
@@ -43,6 +44,8 @@ import java.util.LinkedList;
43 44
 import java.util.List;
44 45
 import java.util.Map;
45 46
 
47
+import javax.script.ScriptException;
48
+
46 49
 /**
47 50
  * The Script Command allows controlling of the script plugin.
48 51
  */
@@ -50,8 +53,7 @@ public class ScriptCommand extends Command implements IntelligentCommand {
50 53
 
51 54
     /** A command info object for this command. */
52 55
     public static final CommandInfo INFO = new BaseCommandInfo("script",
53
-            "script - Allows controlling the script plugin",
54
-            CommandType.TYPE_GLOBAL);
56
+            "script - Allows controlling the script plugin", CommandType.TYPE_GLOBAL);
55 57
     /** My Plugin. */
56 58
     private final ScriptPlugin myPlugin;
57 59
     /** The controller to read/write settings with. */
@@ -64,9 +66,7 @@ public class ScriptCommand extends Command implements IntelligentCommand {
64 66
      * @param identityController The controller to read and write settings from.
65 67
      * @param commandController The controller to use for command information.
66 68
      */
67
-    public ScriptCommand(
68
-            final ScriptPlugin myPlugin,
69
-            final IdentityController identityController,
69
+    public ScriptCommand(final ScriptPlugin myPlugin, final IdentityController identityController,
70 70
             final CommandController commandController) {
71 71
         super(commandController);
72 72
         this.myPlugin = myPlugin;
@@ -75,8 +75,8 @@ public class ScriptCommand extends Command implements IntelligentCommand {
75 75
 
76 76
     /** {@inheritDoc} */
77 77
     @Override
78
-    public void execute(final FrameContainer origin,
79
-            final CommandArguments args, final CommandContext context) {
78
+    public void execute(final FrameContainer origin, final CommandArguments args,
79
+            final CommandContext context) {
80 80
         final String[] sargs = args.getArguments();
81 81
 
82 82
         if (sargs.length > 0 && (sargs[0].equalsIgnoreCase("rehash") || sargs[0].equalsIgnoreCase("reload"))) {
@@ -116,7 +116,7 @@ public class ScriptCommand extends Command implements IntelligentCommand {
116 116
                     wrapper.getScriptEngine().put("cmd_isSilent", args.isSilent());
117 117
                     wrapper.getScriptEngine().put("cmd_args", sargs);
118 118
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Result: "+wrapper.getScriptEngine().eval(script));
119
-                } catch (Exception e) {
119
+                } catch (FileNotFoundException | ScriptException e) {
120 120
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Exception: "+e+" -> "+e.getMessage());
121 121
 
122 122
                     if (identityController.getGlobalConfiguration().getOptionBool(myPlugin.getDomain(), "eval.showStackTrace")) {
@@ -131,7 +131,7 @@ public class ScriptCommand extends Command implements IntelligentCommand {
131 131
                                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Stack trace: "+line);
132 132
                                 }
133 133
                             }
134
-                        } catch (Exception ex) {
134
+                        } catch (ReflectiveOperationException ex) {
135 135
                             sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Stack trace: Exception showing stack trace: "+ex+" -> "+ex.getMessage());
136 136
                         }
137 137
                     }
@@ -149,19 +149,19 @@ public class ScriptCommand extends Command implements IntelligentCommand {
149 149
                 if (identityController.getGlobalConfiguration().hasOptionString(myPlugin.getDomain(), "eval.baseFile")) {
150 150
                     try {
151 151
                         final String baseFile = myPlugin.getScriptDir()+'/'+identityController.getGlobalConfiguration().getOption(myPlugin.getDomain(), "eval.baseFile");
152
-                        final FileWriter writer = new FileWriter(baseFile, true);
153
-                        writer.write("function ");
154
-                        writer.write(functionName);
155
-                        writer.write("(");
156
-                        for (int i = 1; i < bits.length; i++) {
157
-                            writer.write(bits[i]);
158
-                            writer.write(" ");
152
+                        try (FileWriter writer = new FileWriter(baseFile, true)) {
153
+                            writer.write("function ");
154
+                            writer.write(functionName);
155
+                            writer.write("(");
156
+                            for (int i = 1; i < bits.length; i++) {
157
+                                writer.write(bits[i]);
158
+                                writer.write(" ");
159
+                            }
160
+                            writer.write(") {\n");
161
+                            writer.write(script);
162
+                            writer.write("\n}\n");
163
+                            writer.flush();
159 164
                         }
160
-                        writer.write(") {\n");
161
-                        writer.write(script);
162
-                        writer.write("\n}\n");
163
-                        writer.flush();
164
-                        writer.close();
165 165
                     } catch (IOException ioe) {
166 166
                         sendLine(origin, args.isSilent(), FORMAT_ERROR, "IOException: "+ioe.getMessage());
167 167
                     }

+ 2
- 2
src/com/dmdirc/addons/scriptplugin/ScriptEngineWrapper.java View File

@@ -132,7 +132,7 @@ public class ScriptEngineWrapper {
132 132
             // There is no "methodExists" function, so we catch NoSuchMethodException
133 133
             // and do nothing rather that add an erropr every time a method is called
134 134
             // that doesn't exist (such as the action_* methods)
135
-        } catch (Exception e) {
135
+        } catch (ScriptException e) {
136 136
             Logger.userError(ErrorLevel.LOW, "Error calling '"+functionName+"' in '"+file.getPath()+"': "+e.getMessage(), e);
137 137
         }
138 138
     }
@@ -151,7 +151,7 @@ public class ScriptEngineWrapper {
151 151
             engine = createEngine();
152 152
             // Tell it that it has been rehashed
153 153
             callFunction("onRehashSucess");
154
-        } catch (Exception e) {
154
+        } catch (FileNotFoundException | ScriptException e) {
155 155
             Logger.userError(ErrorLevel.LOW, "Reloading '"+file.getPath()+"' failed: "+e.getMessage(), e);
156 156
             // Tell it that its rehash failed
157 157
             callFunction("onRehashFailed", e);

+ 3
- 1
src/com/dmdirc/addons/scriptplugin/ScriptPlugin.java View File

@@ -36,6 +36,7 @@ import com.dmdirc.util.validators.ValidationResponse;
36 36
 
37 37
 import java.io.File;
38 38
 import java.io.FileInputStream;
39
+import java.io.FileNotFoundException;
39 40
 import java.io.FileOutputStream;
40 41
 import java.io.IOException;
41 42
 import java.util.HashMap;
@@ -43,6 +44,7 @@ import java.util.List;
43 44
 import java.util.Map;
44 45
 
45 46
 import javax.script.ScriptEngineManager;
47
+import javax.script.ScriptException;
46 48
 
47 49
 /**
48 50
  * This allows javascript scripts to be used in DMDirc.
@@ -235,7 +237,7 @@ public class ScriptPlugin extends BaseCommandPlugin implements ActionListener {
235 237
             try {
236 238
                 final ScriptEngineWrapper wrapper = new ScriptEngineWrapper(this, scriptFilename);
237 239
                 scripts.put(scriptFilename, wrapper);
238
-            } catch (Exception e) {
240
+            } catch (FileNotFoundException | ScriptException e) {
239 241
                 Logger.userError(ErrorLevel.LOW, "Error loading '"+scriptFilename+"': "+e.getMessage(), e);
240 242
                 return false;
241 243
             }

+ 1
- 1
src/com/dmdirc/addons/serverlists/io/ServerGroupWriter.java View File

@@ -85,7 +85,7 @@ public class ServerGroupWriter {
85 85
     protected void writeGroup(final ServerGroup group, final Set<String> sections) {
86 86
         final String domain = group.getName() + " servergroup";
87 87
 
88
-        final List<String> children = new ArrayList<String>();
88
+        final List<String> children = new ArrayList<>();
89 89
 
90 90
         for (ServerGroupItem item : group.getItems()) {
91 91
             if (item instanceof ServerGroup) {

+ 3
- 1
src/com/dmdirc/addons/swingdebug/TracingEventQueue.java View File

@@ -33,6 +33,7 @@ import com.dmdirc.interfaces.config.IdentityController;
33 33
 import com.dmdirc.plugins.Plugin;
34 34
 
35 35
 import java.awt.AWTEvent;
36
+import java.io.IOException;
36 37
 import java.lang.management.ManagementFactory;
37 38
 import java.lang.management.ThreadInfo;
38 39
 import java.lang.management.ThreadMXBean;
@@ -42,6 +43,7 @@ import java.util.Map;
42 43
 import java.util.Set;
43 44
 
44 45
 import javax.management.MBeanServer;
46
+import javax.management.MalformedObjectNameException;
45 47
 import javax.management.ObjectName;
46 48
 
47 49
 /**
@@ -100,7 +102,7 @@ public class TracingEventQueue extends DMDircEventQueue implements
100 102
                 threadBean = ManagementFactory.newPlatformMXBeanProxy(
101 103
                         mbeanServer, name.toString(), ThreadMXBean.class);
102 104
             }
103
-        } catch (final Exception e) {
105
+        } catch (final MalformedObjectNameException | IOException e) {
104 106
             e.printStackTrace();
105 107
         }
106 108
     }

+ 7
- 4
src/com/dmdirc/addons/systray/SystrayPlugin.java View File

@@ -148,10 +148,13 @@ public class SystrayPlugin extends BaseCommandPlugin implements
148 148
      */
149 149
     @Override
150 150
     public void actionPerformed(final ActionEvent e) {
151
-        if (e.getActionCommand().equals("Show/hide")) {
152
-            mainFrame.setVisible(!mainFrame.isVisible());
153
-        } else if (e.getActionCommand().equals("Quit")) {
154
-            mainFrame.quit();
151
+        switch (e.getActionCommand()) {
152
+            case "Show/hide":
153
+                mainFrame.setVisible(!mainFrame.isVisible());
154
+                break;
155
+            case "Quit":
156
+                mainFrame.quit();
157
+                break;
155 158
         }
156 159
     }
157 160
 

+ 51
- 53
src/com/dmdirc/addons/time/TimerCommand.java View File

@@ -69,66 +69,64 @@ public class TimerCommand extends Command implements IntelligentCommand {
69 69
             final CommandArguments args, final CommandContext context) {
70 70
 
71 71
         if (args.getArguments().length > 0) {
72
-            if ("--cancel".equals(args.getArguments()[0])) {
73
-                int timerKey = 0;
74
-
75
-                try {
76
-                    timerKey = Integer.parseInt(args.getArgumentsAsString(1));
77
-                } catch (NumberFormatException ex) {
78
-                    doUsage(origin, args.isSilent());
79
-                    return;
80
-                }
81
-
82
-                if (manager.hasTimerWithID(timerKey)) {
83
-                    manager.getTimerByID(timerKey).cancelTimer();
84
-                    sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Timer cancelled");
85
-                } else {
86
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "There is currently" +
87
-                            " no timer with that ID");
88
-                    return;
89
-                }
90
-            } else if ("--list".equals(args.getArguments()[0])) {
91
-                final Set<Entry<Integer, TimedCommand>> timerList
92
-                        = manager.listTimers();
93
-
94
-                if (!timerList.isEmpty()) {
95
-                    for (Entry<Integer, TimedCommand> entry : timerList) {
96
-                        sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Timer"
97
-                                + " ID: " + entry.getKey() + " - " +
98
-                                entry.getValue().getCommand());
99
-                    }
100
-                } else {
101
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "There are " +
102
-                                "currently no active timers");
103
-                }
104
-            } else {
105
-                if (args.getArguments().length < 3) {
106
-                    doUsage(origin, args.isSilent());
107
-                } else {
108
-                    int repetitions = 0;
109
-                    int interval = 0;
110
-
111
-                    final String command = args.getArgumentsAsString(2);
112
-
72
+            switch (args.getArguments()[0]) {
73
+                case "--cancel":
74
+                    int timerKey = 0;
113 75
                     try {
114
-                        repetitions = Integer.parseInt(args.getArguments()[0]);
115
-                        interval = Integer.parseInt(args.getArguments()[1]);
76
+                        timerKey = Integer.parseInt(args.getArgumentsAsString(1));
116 77
                     } catch (NumberFormatException ex) {
117 78
                         doUsage(origin, args.isSilent());
118 79
                         return;
119 80
                     }
120
-
121
-                    if (interval < 1) {
122
-                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Cannot use" +
123
-                                " intervals below 1");
81
+                    if (manager.hasTimerWithID(timerKey)) {
82
+                        manager.getTimerByID(timerKey).cancelTimer();
83
+                        sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Timer cancelled");
84
+                    } else {
85
+                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "There is currently"
86
+                                + " no timer with that ID");
124 87
                         return;
125 88
                     }
126
-
127
-                    manager.addTimer(repetitions, interval, command,
128
-                            origin);
129
-
130
-                    sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Command scheduled.");
131
-                }
89
+                    break;
90
+                case "--list":
91
+                    final Set<Entry<Integer, TimedCommand>> timerList = manager.listTimers();
92
+                    if (!timerList.isEmpty()) {
93
+                        for (Entry<Integer, TimedCommand> entry : timerList) {
94
+                            sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Timer ID: "
95
+                                    + entry.getKey() + " - " + entry.getValue().getCommand());
96
+                        }
97
+                    } else {
98
+                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "There are " +
99
+                                "currently no active timers");
100
+                    }
101
+                    break;
102
+                default:
103
+                    if (args.getArguments().length < 3) {
104
+                        doUsage(origin, args.isSilent());
105
+                    } else {
106
+                        int repetitions = 0;
107
+                        int interval = 0;
108
+
109
+                        final String command = args.getArgumentsAsString(2);
110
+
111
+                        try {
112
+                            repetitions = Integer.parseInt(args.getArguments()[0]);
113
+                            interval = Integer.parseInt(args.getArguments()[1]);
114
+                        } catch (NumberFormatException ex) {
115
+                            doUsage(origin, args.isSilent());
116
+                            return;
117
+                        }
118
+
119
+                        if (interval < 1) {
120
+                            sendLine(origin, args.isSilent(), FORMAT_ERROR, "Cannot use" +
121
+                                    " intervals below 1");
122
+                            return;
123
+                        }
124
+
125
+                        manager.addTimer(repetitions, interval, command,
126
+                                origin);
127
+
128
+                        sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Command scheduled.");
129
+                    }   break;
132 130
             }
133 131
         } else {
134 132
             doUsage(origin, args.isSilent());

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

@@ -139,7 +139,7 @@ public final class PrefsComponentFactory {
139 139
         option.setPreferredSize(new Dimension(Short.MAX_VALUE, option.getFont().
140 140
                 getSize()));
141 141
 
142
-        return new JXLayer<JComponent>(option);
142
+        return new JXLayer<>(option);
143 143
     }
144 144
 
145 145
     /**

+ 10
- 14
src/com/dmdirc/addons/ui_swing/SwingWindowFactory.java View File

@@ -28,11 +28,11 @@ import com.dmdirc.addons.ui_swing.components.frames.CustomFrame;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.CustomInputFrame;
29 29
 import com.dmdirc.addons.ui_swing.components.frames.ServerFrame;
30 30
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
31
+import com.dmdirc.interfaces.ui.FrameListener;
32
+import com.dmdirc.interfaces.ui.Window;
31 33
 import com.dmdirc.logger.ErrorLevel;
32 34
 import com.dmdirc.logger.Logger;
33 35
 import com.dmdirc.ui.core.components.WindowComponent;
34
-import com.dmdirc.interfaces.ui.FrameListener;
35
-import com.dmdirc.interfaces.ui.Window;
36 36
 import com.dmdirc.util.collections.ListenerList;
37 37
 
38 38
 import java.util.Arrays;
@@ -50,12 +50,9 @@ import java.util.Set;
50 50
 public class SwingWindowFactory implements FrameListener {
51 51
 
52 52
     /** A map of known implementations of window interfaces. */
53
-    private final Map<Collection<String>, Class<? extends Window>>
54
-            implementations = new HashMap<Collection<String>,
55
-            Class<? extends Window>>();
53
+    private final Map<Collection<String>, Class<? extends Window>> implementations = new HashMap<>();
56 54
     /** A map of frame containers to their Swing windows. */
57
-    private final Map<FrameContainer, TextFrame> windows
58
-            = new HashMap<FrameContainer, TextFrame>();
55
+    private final Map<FrameContainer, TextFrame> windows = new HashMap<>();
59 56
     /** The controller that owns this window factory. */
60 57
     private final SwingController controller;
61 58
     /** Our list of listeners. */
@@ -69,19 +66,19 @@ public class SwingWindowFactory implements FrameListener {
69 66
     public SwingWindowFactory(final SwingController controller) {
70 67
         this.controller = controller;
71 68
 
72
-        registerImplementation(new HashSet<String>(
69
+        registerImplementation(new HashSet<>(
73 70
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier())),
74 71
                 CustomFrame.class);
75
-        registerImplementation(new HashSet<String>(
72
+        registerImplementation(new HashSet<>(
76 73
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
77 74
                 WindowComponent.INPUTFIELD.getIdentifier())),
78 75
                 CustomInputFrame.class);
79
-        registerImplementation(new HashSet<String>(
76
+        registerImplementation(new HashSet<>(
80 77
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
81 78
                 WindowComponent.INPUTFIELD.getIdentifier(),
82 79
                 WindowComponent.CERTIFICATE_VIEWER.getIdentifier())),
83 80
                 ServerFrame.class);
84
-        registerImplementation(new HashSet<String>(
81
+        registerImplementation(new HashSet<>(
85 82
                 Arrays.asList(WindowComponent.TEXTAREA.getIdentifier(),
86 83
                 WindowComponent.INPUTFIELD.getIdentifier(),
87 84
                 WindowComponent.TOPICBAR.getIdentifier(),
@@ -134,8 +131,7 @@ public class SwingWindowFactory implements FrameListener {
134 131
         if (implementations.containsKey(window.getComponents())) {
135 132
             clazz = implementations.get(window.getComponents());
136 133
         } else {
137
-            Logger.userError(ErrorLevel.HIGH,
138
-                    "Unable to create window: Unknown type");
134
+            Logger.userError(ErrorLevel.HIGH, "Unable to create window: Unknown type");
139 135
             return null;
140 136
         }
141 137
 
@@ -145,7 +141,7 @@ public class SwingWindowFactory implements FrameListener {
145 141
             windows.put(window, frame);
146 142
 
147 143
             return frame;
148
-        } catch (Exception ex) {
144
+        } catch (ReflectiveOperationException ex) {
149 145
             Logger.appError(ErrorLevel.HIGH, "Unable to create window", ex);
150 146
             return null;
151 147
         }

+ 2
- 2
src/com/dmdirc/addons/ui_swing/cinch/ConfirmAction.java View File

@@ -103,7 +103,7 @@ public @interface ConfirmAction {
103 103
                         ConfirmAction.class);
104 104
                 try {
105 105
                     wire(action.call(), action.message(), field, context);
106
-                } catch (Exception e) {
106
+                } catch (ReflectiveOperationException e) {
107 107
                     throw new BindingException("could not wire up "
108 108
                             + "@ConfirmAction on " + field.getName(), e);
109 109
                 }
@@ -159,7 +159,7 @@ public @interface ConfirmAction {
159 159
                             } catch (InvocationTargetException itex) {
160 160
                                 LOGGER.error("exception during action firing",
161 161
                                         itex.getCause());
162
-                            } catch (Exception ex) {
162
+                            } catch (ReflectiveOperationException ex) {
163 163
                                 LOGGER.error("exception during action firing", ex);
164 164
                             }
165 165
                             return true;

+ 4
- 3
src/com/dmdirc/addons/ui_swing/cinch/InputAction.java View File

@@ -27,6 +27,7 @@ import com.dmdirc.util.validators.PermissiveValidator;
27 27
 import com.dmdirc.util.validators.Validator;
28 28
 
29 29
 import com.google.common.collect.ImmutableList;
30
+
30 31
 import com.palantir.ptoss.cinch.core.Bindable;
31 32
 import com.palantir.ptoss.cinch.core.BindableModel;
32 33
 import com.palantir.ptoss.cinch.core.Binding;
@@ -120,7 +121,7 @@ public @interface InputAction {
120 121
                 try {
121 122
                     wire(action.call(), action.message(), action.content(),
122 123
                             action.validator(), field, context);
123
-                } catch (final Exception e) {
124
+                } catch (ReflectiveOperationException e) {
124 125
                     Throwables.throwUncheckedException(e);
125 126
                     throw new BindingException("could not wire up "
126 127
                             + "@InputAction on " + field.getName(), e);
@@ -210,7 +211,7 @@ public @interface InputAction {
210 211
                             } catch (final InvocationTargetException itex) {
211 212
                                 LOGGER.error("exception during action firing",
212 213
                                         itex.getCause());
213
-                            } catch (final Exception ex) {
214
+                            } catch (ReflectiveOperationException ex) {
214 215
                                 LOGGER.error("exception during action firing", ex);
215 216
                             }
216 217
                             return true;
@@ -231,7 +232,7 @@ public @interface InputAction {
231 232
                                             .invoke(existingMethod.getObject());
232 233
                                     existingMethod.getMethod()
233 234
                                             .setAccessible(accessible);
234
-                                } catch (final Exception e) {
235
+                                } catch (ReflectiveOperationException e) {
235 236
                                     content = "";
236 237
                                 }
237 238
                             } else {

+ 2
- 2
src/com/dmdirc/addons/ui_swing/cinch/ValidatesIf.java View File

@@ -77,7 +77,7 @@ public @interface ValidatesIf {
77 77
                 final String to = action.to();
78 78
                 try {
79 79
                     bindings.addAll(wire(to, field, context));
80
-                } catch (final Exception e) {
80
+                } catch (IntrospectionException | NoSuchMethodException e) {
81 81
                     throw new BindingException("could not wire up @ValidatesIf on " + field.getName(), e);
82 82
                 }
83 83
             }
@@ -124,7 +124,7 @@ public @interface ValidatesIf {
124 124
                     try {
125 125
                         ValidationResponse validation = (ValidationResponse) getter.getMethod().invoke(getter.getObject());
126 126
                         callMethod.invoke(setValidationObject, validation);
127
-                    } catch (final Exception e) {
127
+                    } catch (ReflectiveOperationException e) {
128 128
                         Throwables.throwUncheckedException(e);
129 129
                     }
130 130
                 }

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

@@ -62,7 +62,7 @@ public class GenericListModel<T> extends AbstractListModel {
62 62
     public GenericListModel(final List<T> list) {
63 63
         super();
64 64
 
65
-        this.list = Collections.synchronizedList(new ArrayList<T>(list));
65
+        this.list = Collections.synchronizedList(new ArrayList<>(list));
66 66
     }
67 67
 
68 68
     /** {@inheritDoc} */

+ 7
- 4
src/com/dmdirc/addons/ui_swing/components/NicklistListModel.java View File

@@ -186,10 +186,13 @@ public final class NicklistListModel extends AbstractListModel implements
186 186
     /** {@inheritDoc} */
187 187
     @Override
188 188
     public void configChanged(final String domain, final String key) {
189
-        if ("sortByMode".equals(key)) {
190
-            sortByMode = config.getOptionBool("nicklist", "sortByMode");
191
-        } else if ("sortByCase".equals(key)) {
192
-            sortByCase = config.getOptionBool("nicklist", "sortByCase");
189
+        switch (key) {
190
+            case "sortByMode":
191
+                sortByMode = config.getOptionBool("nicklist", "sortByMode");
192
+                break;
193
+            case "sortByCase":
194
+                sortByCase = config.getOptionBool("nicklist", "sortByCase");
195
+                break;
193 196
         }
194 197
 
195 198
         sort();

+ 2
- 4
src/com/dmdirc/addons/ui_swing/components/SendWorker.java View File

@@ -92,8 +92,7 @@ public class SendWorker extends LoggingSwingWorker<Object, Void> {
92 92
     /** {@inheritDoc} */
93 93
     @Override
94 94
     protected Object doInBackground() {
95
-        final Map<String, String> postData =
96
-                new HashMap<String, String>();
95
+        final Map<String, String> postData = new HashMap<>();
97 96
 
98 97
         if (!name.isEmpty()) {
99 98
             postData.put("name", name);
@@ -126,8 +125,7 @@ public class SendWorker extends LoggingSwingWorker<Object, Void> {
126 125
      */
127 126
     private void sendData(final Map<String, String> postData) {
128 127
         try {
129
-            final List<String> response =
130
-                    Downloader.getPage("http://www.dmdirc.com/feedback.php",
128
+            final List<String> response = Downloader.getPage("http://www.dmdirc.com/feedback.php",
131 129
                     postData);
132 130
             if (response.size() >= 1) {
133 131
                 for (final String responseLine : response) {

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

@@ -110,7 +110,7 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
110 110
 
111 111
     /** Initialises components. */
112 112
     private void initComponents() {
113
-        closeButton = new ImageButton<Object>("close",
113
+        closeButton = new ImageButton<>("close",
114 114
                 parent.getIconManager().getIcon("close-inactive"),
115 115
                 parent.getIconManager().getIcon("close-active"));
116 116
         nextButton = new JButton();

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

@@ -73,7 +73,7 @@ public class ToolTipPanel extends JPanel implements MouseListener {
73 73
         super(new MigLayout("hidemode 3"));
74 74
 
75 75
         defaultHelp = helpText;
76
-        tooltips = new HashMap<JComponent, String>();
76
+        tooltips = new HashMap<>();
77 77
         icon = new JLabel(iconManager.getIcon("warning"));
78 78
 
79 79
         setBackground(Color.WHITE);

+ 15
- 11
src/com/dmdirc/addons/ui_swing/components/URLProtocolPanel.java View File

@@ -211,17 +211,21 @@ public class URLProtocolPanel extends JPanel implements ActionListener,
211 211
             final String option =
212 212
                     controller.getGlobalConfig().getOption("protocol",
213 213
                             uri.getScheme());
214
-
215
-            if ("DMDIRC".equals(option)) {
216
-                optionType.setSelected(dmdirc.getModel(), true);
217
-            } else if ("BROWSER".equals(option)) {
218
-                optionType.setSelected(browser.getModel(), true);
219
-            } else if ("MAIL".equals(option)) {
220
-                optionType.setSelected(mail.getModel(), true);
221
-            } else {
222
-                optionType.setSelected(custom.getModel(), true);
223
-                commandPath.setText(option);
224
-                actionPerformed(null);
214
+            switch (option) {
215
+                case "DMDIRC":
216
+                    optionType.setSelected(dmdirc.getModel(), true);
217
+                    break;
218
+                case "BROWSER":
219
+                    optionType.setSelected(browser.getModel(), true);
220
+                    break;
221
+                case "MAIL":
222
+                    optionType.setSelected(mail.getModel(), true);
223
+                    break;
224
+                default:
225
+                    optionType.setSelected(custom.getModel(), true);
226
+                    commandPath.setText(option);
227
+                    actionPerformed(null);
228
+                    break;
225 229
             }
226 230
         } else {
227 231
             optionType.clearSelection();

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/expandingsettings/CurrentOptionsPanel.java View File

@@ -66,7 +66,7 @@ public final class CurrentOptionsPanel extends JPanel implements
66 66
         this.parent = parent;
67 67
 
68 68
         setOpaque(UIUtilities.getTabbedPaneOpaque());
69
-        settings = new ArrayList<JComponent>();
69
+        settings = new ArrayList<>();
70 70
     }
71 71
 
72 72
     /** Clears all the current options. */
@@ -106,7 +106,7 @@ public final class CurrentOptionsPanel extends JPanel implements
106 106
      */
107 107
     private void addCurrentOption(final JComponent component) {
108 108
         final JLabel label = new JLabel();
109
-        final ImageButton<JComponent> button = new ImageButton<JComponent>(
109
+        final ImageButton<JComponent> button = new ImageButton<>(
110 110
                 component.getName(), iconManager.getIcon("close-inactive"),
111 111
                 iconManager.getIcon("close-active"));
112 112
         button.setObject(component);

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/expandingsettings/SettingsPanel.java View File

@@ -85,7 +85,7 @@ public class SettingsPanel extends JPanel {
85 85
 
86 86
         this.controller = controller;
87 87
 
88
-        settings = new DoubleMap<PreferencesSetting, JComponent>();
88
+        settings = new DoubleMap<>();
89 89
 
90 90
         setOpaque(UIUtilities.getTabbedPaneOpaque());
91 91
         this.padding = padding;

+ 5
- 12
src/com/dmdirc/addons/ui_swing/components/frames/ComponentCreator.java View File

@@ -50,12 +50,11 @@ public class ComponentCreator {
50 50
      *
51 51
      * @return Set of initialised components
52 52
      */
53
-    public Set<JComponent> initFrameComponents(final Object frame,
54
-            final SwingController controller,
53
+    public Set<JComponent> initFrameComponents(final Object frame, final SwingController controller,
55 54
             final FrameContainer owner) {
56 55
         final SimpleInjector injector = new SimpleInjector();
57 56
         final Set<String> names = owner.getComponents();
58
-        final Set<JComponent> components = new HashSet<JComponent>();
57
+        final Set<JComponent> components = new HashSet<>();
59 58
 
60 59
         injector.addParameter(frame);
61 60
         injector.addParameter(owner);
@@ -68,21 +67,15 @@ public class ComponentCreator {
68 67
                 Class<?> clazz = null;
69 68
                 if (string.equals(WindowComponent.INPUTFIELD.getIdentifier())) {
70 69
                     clazz = SwingInputField.class;
71
-                } else if (string.equals(WindowComponent.TEXTAREA
72
-                        .getIdentifier())) {
70
+                } else if (string.equals(WindowComponent.TEXTAREA.getIdentifier())) {
73 71
                     clazz = TextPane.class;
74 72
                 } else {
75 73
                     clazz = Class.forName(string);
76 74
                 }
77 75
                 object = injector.createInstance(clazz);
78
-            } catch(ClassNotFoundException ex) {
76
+            } catch(ClassNotFoundException | IllegalArgumentException ex) {
79 77
                 object = null;
80
-                Logger.userError(ErrorLevel.HIGH, "Unable to create component: "
81
-                        + ex.getMessage());
82
-            } catch (IllegalArgumentException ex) {
83
-                object = null;
84
-                Logger.userError(ErrorLevel.HIGH, "Unable to create component: "
85
-                        + ex.getMessage());
78
+                Logger.userError(ErrorLevel.HIGH, "Unable to create component: " + ex.getMessage());
86 79
             }
87 80
             if (object instanceof JComponent) {
88 81
                 components.add((JComponent) object);

+ 19
- 16
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java View File

@@ -368,22 +368,25 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
368 368
 
369 369
         if ("ui".equals(domain) && getContainer().getConfigManager() != null
370 370
                 && getInputField() != null && !UIUtilities.isGTKUI()) {
371
-            if ("inputbackgroundcolour".equals(key)
372
-                    || "backgroundcolour".equals(key)) {
373
-                getInputField().setBackground(UIUtilities.convertColour(
374
-                        getContainer().getConfigManager().
375
-                        getOptionColour("ui", "inputbackgroundcolour",
376
-                        "ui", "backgroundcolour")));
377
-            } else if ("inputforegroundcolour".equals(key)
378
-                    || "foregroundcolour".equals(key)) {
379
-                getInputField().setForeground(UIUtilities.convertColour(
380
-                        getContainer().getConfigManager()
381
-                        .getOptionColour("ui", "inputforegroundcolour",
382
-                        "ui", "foregroundcolour")));
383
-                getInputField().setCaretColor(UIUtilities.convertColour(
384
-                        getContainer().getConfigManager()
385
-                        .getOptionColour("ui", "inputforegroundcolour",
386
-                        "ui", "foregroundcolour")));
371
+            switch (key) {
372
+                case "inputbackgroundcolour":
373
+                case "backgroundcolour":
374
+                    getInputField().setBackground(UIUtilities.convertColour(
375
+                            getContainer().getConfigManager().
376
+                                    getOptionColour("ui", "inputbackgroundcolour",
377
+                                            "ui", "backgroundcolour")));
378
+                    break;
379
+                case "inputforegroundcolour":
380
+                case "foregroundcolour":
381
+                    getInputField().setForeground(UIUtilities.convertColour(
382
+                            getContainer().getConfigManager()
383
+                                    .getOptionColour("ui", "inputforegroundcolour",
384
+                                            "ui", "foregroundcolour")));
385
+                    getInputField().setCaretColor(UIUtilities.convertColour(
386
+                            getContainer().getConfigManager()
387
+                                    .getOptionColour("ui", "inputforegroundcolour",
388
+                                            "ui", "foregroundcolour")));
389
+                    break;
387 390
             }
388 391
         }
389 392
     }

+ 15
- 12
src/com/dmdirc/addons/ui_swing/components/menubar/ChannelMenu.java View File

@@ -105,18 +105,21 @@ public class ChannelMenu extends JMenu implements ActionListener,
105 105
     /** {@inheritDoc} */
106 106
     @Override
107 107
     public void actionPerformed(final ActionEvent e) {
108
-        if (e.getActionCommand().equals("JoinChannel")) {
109
-            new ChannelJoinDialog(controller, ModalityType.MODELESS,
110
-                    "Join channel", "Enter the name of the channel to join.")
111
-                    .display();
112
-        } else if (e.getActionCommand().equals("ChannelSettings")) {
113
-            final FrameContainer activeWindow = controller.getMainFrame()
114
-                    .getActiveFrame().getContainer();
115
-            if (activeWindow instanceof Channel) {
116
-                controller.showChannelSettingsDialog(((Channel) activeWindow));
117
-            }
118
-        } else if (e.getActionCommand().equals("ListChannels")) {
119
-            new ChannelListDialog(controller).display();
108
+        switch (e.getActionCommand()) {
109
+            case "JoinChannel":
110
+                new ChannelJoinDialog(controller, ModalityType.MODELESS,
111
+                        "Join channel", "Enter the name of the channel to join.")
112
+                        .display();
113
+                break;
114
+            case "ChannelSettings":
115
+                final FrameContainer activeWindow = controller.getMainFrame()
116
+                        .getActiveFrame().getContainer();
117
+                if (activeWindow instanceof Channel) {
118
+                    controller.showChannelSettingsDialog(((Channel) activeWindow));
119
+                }   break;
120
+            case "ListChannels":
121
+                new ChannelListDialog(controller).display();
122
+                break;
120 123
         }
121 124
     }
122 125
 

+ 15
- 10
src/com/dmdirc/addons/ui_swing/components/menubar/ServerMenu.java View File

@@ -112,16 +112,21 @@ public class ServerMenu extends JMenu implements ActionListener,
112 112
     /** {@inheritDoc} */
113 113
     @Override
114 114
     public void actionPerformed(final ActionEvent e) {
115
-        if ("NewServer".equals(e.getActionCommand())) {
116
-            controller.showDialog(NewServerDialog.class);
117
-        } else if (e.getActionCommand().equals("Exit")) {
118
-            mainFrame.quit();
119
-        } else if (e.getActionCommand().equals("ServerSettings")) {
120
-            controller.showServerSettingsDialog(controller.getMainFrame()
121
-                    .getActiveFrame().getContainer().getServer());
122
-        } else if (e.getActionCommand().equals("Disconnect")) {
123
-            controller.getMainFrame().getActiveFrame().getContainer()
124
-                    .getServer().disconnect();
115
+        switch (e.getActionCommand()) {
116
+            case "NewServer":
117
+                controller.showDialog(NewServerDialog.class);
118
+                break;
119
+            case "Exit":
120
+                mainFrame.quit();
121
+                break;
122
+            case "ServerSettings":
123
+                controller.showServerSettingsDialog(controller.getMainFrame()
124
+                        .getActiveFrame().getContainer().getServer());
125
+                break;
126
+            case "Disconnect":
127
+                controller.getMainFrame().getActiveFrame().getContainer()
128
+                        .getServer().disconnect();
129
+                break;
125 130
         }
126 131
     }
127 132
 

+ 13
- 8
src/com/dmdirc/addons/ui_swing/components/menubar/SettingsMenu.java View File

@@ -92,14 +92,19 @@ public class SettingsMenu extends JMenu implements ActionListener {
92 92
     /** {@inheritDoc} */
93 93
     @Override
94 94
     public void actionPerformed(final ActionEvent e) {
95
-        if ("Preferences".equals(e.getActionCommand())) {
96
-            controller.showDialog(SwingPreferencesDialog.class);
97
-        } else if (e.getActionCommand().equals("Profile")) {
98
-            controller.showDialog(ProfileManagerDialog.class);
99
-        }  else if (e.getActionCommand().equals("Actions")) {
100
-            controller.showDialog(ActionsManagerDialog.class);
101
-        } else if (e.getActionCommand().equals("Aliases")) {
102
-            controller.showDialog(AliasManagerDialog.class);
95
+        switch (e.getActionCommand()) {
96
+            case "Preferences":
97
+                controller.showDialog(SwingPreferencesDialog.class);
98
+                break;
99
+            case "Profile":
100
+                controller.showDialog(ProfileManagerDialog.class);
101
+                break;
102
+            case "Actions":
103
+                controller.showDialog(ActionsManagerDialog.class);
104
+                break;
105
+            case "Aliases":
106
+                controller.showDialog(AliasManagerDialog.class);
107
+                break;
103 108
         }
104 109
     }
105 110
 }

+ 3
- 3
src/com/dmdirc/addons/ui_swing/components/modes/ModesPane.java View File

@@ -63,9 +63,9 @@ public abstract class ModesPane extends JPanel {
63 63
         setLayout(new MigLayout("fill, wmax 100%, wrap 1"));
64 64
         booleanModesPanel = new JPanel(new MigLayout("wrap 2"));
65 65
         paramModesPanel = new JPanel(new MigLayout("wrap 2"));
66
-        modes = new TreeSet<String>(new ModesComparator());
67
-        modeCheckBoxes = new HashMap<String, JCheckBox>();
68
-        modeInputs = new HashMap<String, ParamModePanel>();
66
+        modes = new TreeSet<>(new ModesComparator());
67
+        modeCheckBoxes = new HashMap<>();
68
+        modeInputs = new HashMap<>();
69 69
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
70 70
     }
71 71
 

+ 16
- 10
src/com/dmdirc/addons/ui_swing/components/renderers/URIHandlerCellRenderer.java View File

@@ -52,16 +52,22 @@ public class URIHandlerCellRenderer extends DefaultTableCellRenderer {
52 52
         }
53 53
 
54 54
         String handler = (String) value;
55
-        if ("DMDIRC".equals(handler)) {
56
-            handler = "Handle internally (irc links only).";
57
-        } else if ("BROWSER".equals(handler)) {
58
-            handler = "Use browser (or system registered handler).";
59
-        } else if ("MAIL".equals(handler)) {
60
-            handler = "Use mail client.";
61
-        } else if ("".equals(handler)) {
62
-            handler = "No handler.";
63
-        } else {
64
-            handler = "Custom command: " + handler;
55
+        switch (handler) {
56
+            case "DMDIRC":
57
+                handler = "Handle internally (irc links only).";
58
+                break;
59
+            case "BROWSER":
60
+                handler = "Use browser (or system registered handler).";
61
+                break;
62
+            case "MAIL":
63
+                handler = "Use mail client.";
64
+                break;
65
+            case "":
66
+                handler = "No handler.";
67
+                break;
68
+            default:
69
+                handler = "Custom command: " + handler;
70
+                break;
65 71
         }
66 72
 
67 73
         setValue(handler);

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/reorderablelist/ArrayListTransferHandler.java View File

@@ -221,7 +221,7 @@ public final class ArrayListTransferHandler extends TransferHandler {
221 221
                 return null;
222 222
             }
223 223
 
224
-            final ArrayList<Object> alist = new ArrayList<Object>(values.length);
224
+            final ArrayList<Object> alist = new ArrayList<>(values.length);
225 225
 
226 226
             for (int i = 0; i < values.length; i++) {
227 227
                 final Object o = values[i];

+ 2
- 4
src/com/dmdirc/addons/ui_swing/components/reorderablelist/ReorderableJList.java View File

@@ -258,9 +258,7 @@ public class ReorderableJList extends JList implements DragSourceListener,
258 258
         Object dragged;
259 259
         try {
260 260
             dragged = dtde.getTransferable().getTransferData(dataFlavor);
261
-        } catch (UnsupportedFlavorException e) {
262
-            return;
263
-        } catch (IOException e) {
261
+        } catch (UnsupportedFlavorException | IOException e) {
264 262
             return;
265 263
         }
266 264
 
@@ -293,7 +291,7 @@ public class ReorderableJList extends JList implements DragSourceListener,
293 291
         //get the list object
294 292
         final Object target = getModel().getElementAt(index);
295 293
         //create the trasnferable object
296
-        final ArrayList<Object> transferObject = new ArrayList<Object>();
294
+        final ArrayList<Object> transferObject = new ArrayList<>();
297 295
         transferObject.add(target);
298 296
         final Transferable trans = new ArrayListTransferable(transferObject);
299 297
         //start drag

+ 3
- 6
src/com/dmdirc/addons/ui_swing/components/statusbar/ErrorPopup.java View File

@@ -66,12 +66,9 @@ public class ErrorPopup extends StatusbarPopupWindow {
66 66
     /** {@inheritDoc} */
67 67
     @Override
68 68
     protected void initContent(final JPanel panel) {
69
-        final List<ProgramError> errors = ErrorManager.getErrorManager()
70
-                .getErrors();
71
-        final MapList<ErrorLevel, ProgramError> buckets
72
-                = new MapList<ErrorLevel, ProgramError>();
73
-        final MapList<ErrorReportStatus, ProgramError> statuses
74
-                = new MapList<ErrorReportStatus, ProgramError>();
69
+        final List<ProgramError> errors = ErrorManager.getErrorManager().getErrors();
70
+        final MapList<ErrorLevel, ProgramError> buckets = new MapList<>();
71
+        final MapList<ErrorReportStatus, ProgramError> statuses = new MapList<>();
75 72
 
76 73
         for (final ProgramError error : errors) {
77 74
             buckets.add(error.getLevel(), error);

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/statusbar/MessageLabel.java View File

@@ -78,7 +78,7 @@ public class MessageLabel extends JPanel implements StatusBarComponent,
78 78
             final Window parentWindow) {
79 79
         super(new MigLayout("fill, ins 0, gap 0  0"));
80 80
         this.controller = controller;
81
-        queue = new ConcurrentLinkedQueue<StatusMessage>();
81
+        queue = new ConcurrentLinkedQueue<>();
82 82
         defaultMessage = new StatusMessage(null, "Ready.", null, -1,
83 83
                 controller.getGlobalConfig());
84 84
         currentMessage = defaultMessage;

+ 1
- 1
src/com/dmdirc/addons/ui_swing/components/statusbar/MessagePopup.java View File

@@ -73,7 +73,7 @@ class MessagePopup extends StatusbarTogglePanel<JLabel> {
73 73
         this.parentWindow = parentWindow;
74 74
         this.parent = parent;
75 75
         this.controller = controller;
76
-        messages = new RollingList<StatusMessage>(5);
76
+        messages = new RollingList<>(5);
77 77
     }
78 78
 
79 79
     /* {@inheritDoc} */

+ 11
- 10
src/com/dmdirc/addons/ui_swing/components/text/WrapColumnFactory.java View File

@@ -26,16 +26,17 @@ public class WrapColumnFactory implements ViewFactory {
26 26
     public View create(final Element elem) {
27 27
         final String kind = elem.getName();
28 28
         if (kind != null) {
29
-            if (kind.equals(AbstractDocument.ContentElementName)) {
30
-                return new WrapLabelView(elem);
31
-            } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
32
-                return new NoWrapParagraphView(elem);
33
-            } else if (kind.equals(AbstractDocument.SectionElementName)) {
34
-                return new BoxView(elem, View.Y_AXIS);
35
-            } else if (kind.equals(StyleConstants.ComponentElementName)) {
36
-                return new ComponentView(elem);
37
-            } else if (kind.equals(StyleConstants.IconElementName)) {
38
-                return new IconView(elem);
29
+            switch (kind) {
30
+                case AbstractDocument.ContentElementName:
31
+                    return new WrapLabelView(elem);
32
+                case AbstractDocument.ParagraphElementName:
33
+                    return new NoWrapParagraphView(elem);
34
+                case AbstractDocument.SectionElementName:
35
+                    return new BoxView(elem, View.Y_AXIS);
36
+                case StyleConstants.ComponentElementName:
37
+                    return new ComponentView(elem);
38
+                case StyleConstants.IconElementName:
39
+                    return new IconView(elem);
39 40
             }
40 41
         }
41 42
 

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionConditionDisplayPanel.java View File

@@ -129,7 +129,7 @@ public class ActionConditionDisplayPanel extends JPanel implements
129 129
         label = new TextLabel("", false);
130 130
         editButton = new ImageToggleButton("edit", iconManager.
131 131
                 getIcon("edit-inactive"), iconManager.getIcon("edit"));
132
-        deleteButton = new ImageButton<Object>("delete", iconManager.
132
+        deleteButton = new ImageButton<>("delete", iconManager.
133 133
                 getIcon("close-inactive"), iconManager.
134 134
                 getIcon("close-inactive"), iconManager.getIcon("close-active"));
135 135
 

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionNamePanel.java View File

@@ -108,7 +108,7 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
108 108
         } else {
109 109
             this.existingName = newName;
110 110
         }
111
-        name.setValidator(new ValidatorChain<String>(new FileNameValidator(),
111
+        name.setValidator(new ValidatorChain<>(new FileNameValidator(),
112 112
                 new ActionNameValidator(group, existingName)));
113 113
         this.name.setText(newName);
114 114
     }
@@ -123,7 +123,7 @@ public class ActionNamePanel extends JPanel implements PropertyChangeListener {
123 123
     private void initComponents() {
124 124
         name = new ValidatingJTextField(iconManager,
125 125
                 new JTextField(existingName),
126
-                new ValidatorChain<String>(new FileNameValidator(),
126
+                new ValidatorChain<>(new FileNameValidator(),
127 127
                 new ActionNameValidator(group, existingName)));
128 128
     }
129 129
 

+ 8
- 7
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionResponsePanel.java View File

@@ -83,7 +83,7 @@ public class ActionResponsePanel extends JPanel {
83 83
         ((DefaultComboBoxModel) formatter.getModel()).addElement("No change");
84 84
         ((DefaultComboBoxModel) formatter.getModel()).addElement("No response");
85 85
 
86
-        final TreeSet<String> formatters = new TreeSet<String>(
86
+        final TreeSet<String> formatters = new TreeSet<>(
87 87
                 String.CASE_INSENSITIVE_ORDER);
88 88
         formatters.addAll(controller.getGlobalConfig().getOptions("formatter")
89 89
                 .keySet());
@@ -163,12 +163,13 @@ public class ActionResponsePanel extends JPanel {
163 163
      */
164 164
     public String getFormatter() {
165 165
         final String newFormat = (String) formatter.getSelectedItem();
166
-        if ("No change".equals(newFormat)) {
167
-            return null;
168
-        } else if ("No response".equals(newFormat)) {
169
-            return "";
170
-        } else {
171
-            return newFormat;
166
+        switch (newFormat) {
167
+            case "No change":
168
+                return null;
169
+            case "No response":
170
+                return "";
171
+            default:
172
+                return newFormat;
172 173
         }
173 174
     }
174 175
 

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersListPanel.java View File

@@ -77,7 +77,7 @@ public class ActionTriggersListPanel extends JPanel {
77 77
         super();
78 78
 
79 79
         this.iconManager = iconManager;
80
-        this.triggers = new ArrayList<ActionType>(triggers);
80
+        this.triggers = new ArrayList<>(triggers);
81 81
 
82 82
         initComponents();
83 83
         layoutComponents();
@@ -101,7 +101,7 @@ public class ActionTriggersListPanel extends JPanel {
101 101
             removeAll();
102 102
 
103 103
             for (final ActionType trigger : triggers) {
104
-                final ImageButton<?> button = new ImageButton<Object>(
104
+                final ImageButton<?> button = new ImageButton<>(
105 105
                         "delete", iconManager.getIcon("close-inactive"),
106 106
                         iconManager.getIcon("close-active"));
107 107
                 button.addActionListener(new ActionListener() {

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/actioneditor/ActionTriggersPanel.java View File

@@ -79,7 +79,7 @@ public class ActionTriggersPanel extends JPanel implements ActionListener,
79 79
     public ActionTriggersPanel(final IconManager iconManager) {
80 80
         super();
81 81
 
82
-        compatibleTriggers = new ArrayList<ActionType>();
82
+        compatibleTriggers = new ArrayList<>();
83 83
 
84 84
         initComponents(iconManager);
85 85
         addListeners();

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionGroupSettingsPanel.java View File

@@ -101,7 +101,7 @@ public final class ActionGroupSettingsPanel extends JPanel implements ActionList
101 101
      * Initialises the components.
102 102
      */
103 103
     private void initComponents() {
104
-        settingMap = new HashMap<JButton, PreferencesSetting>();
104
+        settingMap = new HashMap<>();
105 105
     }
106 106
 
107 107
     /**
@@ -147,7 +147,7 @@ public final class ActionGroupSettingsPanel extends JPanel implements ActionList
147 147
      */
148 148
     public void setActionGroup(final ActionGroup group) {
149 149
         if (group == null || group.getSettings().isEmpty()) {
150
-            this.settings = new ArrayList<PreferencesSetting>();
150
+            this.settings = new ArrayList<>();
151 151
         } else {
152 152
             this.settings = group.getSettings().values();
153 153
         }

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionTableModel.java View File

@@ -61,7 +61,7 @@ public class ActionTableModel extends AbstractTableModel {
61 61
         super();
62 62
 
63 63
         if (actions == null) {
64
-            this.actions = new ArrayList<Action>();
64
+            this.actions = new ArrayList<>();
65 65
         } else {
66 66
             this.actions = actions;
67 67
         }
@@ -165,7 +165,7 @@ public class ActionTableModel extends AbstractTableModel {
165 165
     public void setActionGroup(final ActionGroup group) {
166 166
         synchronized (actions) {
167 167
             if (group == null) {
168
-                actions = new ArrayList<Action>();
168
+                actions = new ArrayList<>();
169 169
             } else {
170 170
                 actions = group.getActions();
171 171
             }

+ 6
- 10
src/com/dmdirc/addons/ui_swing/dialogs/actionsmanager/ActionsGroupPanel.java View File

@@ -33,8 +33,8 @@ import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
33 33
 import com.dmdirc.addons.ui_swing.dialogs.StringArrayComparator;
34 34
 import com.dmdirc.addons.ui_swing.dialogs.actioneditor.ActionEditorDialog;
35 35
 
36
-import java.awt.Window;
37 36
 import java.awt.Dialog.ModalityType;
37
+import java.awt.Window;
38 38
 import java.awt.event.ActionEvent;
39 39
 import java.awt.event.ActionListener;
40 40
 import java.awt.event.MouseAdapter;
@@ -138,8 +138,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
138 138
      */
139 139
     private void initComponents() {
140 140
         scrollPane = new JScrollPane();
141
-        model = new ActionTableModel(group == null ? new ArrayList<Action>()
142
-                : group.getActions());
141
+        model = new ActionTableModel(group == null ? new ArrayList<Action>() : group.getActions());
143 142
         table = new PackingTable(model, scrollPane, false) {
144 143
 
145 144
             /**
@@ -150,16 +149,13 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
150 149
              */
151 150
             private static final long serialVersionUID = 1;
152 151
             /** Action type renderer. */
153
-            private final ActionTypeTableCellRenderer typeRenderer =
154
-                    new ActionTypeTableCellRenderer();
152
+            private final ActionTypeTableCellRenderer typeRenderer = new ActionTypeTableCellRenderer();
155 153
             /** Action response renrderer. */
156
-            private final ArrayCellRenderer arrayRenderer =
157
-                    new ArrayCellRenderer();
154
+            private final ArrayCellRenderer arrayRenderer = new ArrayCellRenderer();
158 155
 
159 156
             /** {@inheritDoc} */
160 157
             @Override
161
-            public TableCellRenderer getCellRenderer(final int row,
162
-                    final int column) {
158
+            public TableCellRenderer getCellRenderer(final int row, final int column) {
163 159
                 switch (column) {
164 160
                     case 1:
165 161
                         return typeRenderer;
@@ -173,7 +169,7 @@ public final class ActionsGroupPanel extends JPanel implements ActionListener,
173 169
 
174 170
 
175 171
         final TableRowSorter<ActionTableModel> sorter
176
-                = new TableRowSorter<ActionTableModel>(model);
172
+                = new TableRowSorter<>(model);
177 173
         sorter.setComparator(1, new ActionTypeComparator());
178 174
         sorter.setComparator(2, new StringArrayComparator());
179 175
 

+ 3
- 3
src/com/dmdirc/addons/ui_swing/dialogs/aliases/AliasTableModel.java View File

@@ -58,7 +58,7 @@ public final class AliasTableModel extends AbstractTableModel {
58 58
     public AliasTableModel(final List<Alias> aliases) {
59 59
         super();
60 60
 
61
-        this.aliases = new ArrayList<Alias>(aliases);
61
+        this.aliases = new ArrayList<>(aliases);
62 62
     }
63 63
 
64 64
     /**
@@ -67,7 +67,7 @@ public final class AliasTableModel extends AbstractTableModel {
67 67
      * @param aliases List of aliases
68 68
      */
69 69
     public void setAliases(final List<Alias> aliases) {
70
-        this.aliases = new ArrayList<Alias>(aliases);
70
+        this.aliases = new ArrayList<>(aliases);
71 71
 
72 72
         fireTableDataChanged();
73 73
     }
@@ -181,7 +181,7 @@ public final class AliasTableModel extends AbstractTableModel {
181 181
      * @return Complete alias list
182 182
      */
183 183
     public List<Alias> getAliases() {
184
-        return new ArrayList<Alias>(aliases);
184
+        return new ArrayList<>(aliases);
185 185
     }
186 186
 
187 187
     /**

+ 21
- 37
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelListModesPane.java View File

@@ -28,13 +28,13 @@ import com.dmdirc.addons.ui_swing.UIUtilities;
28 28
 import com.dmdirc.addons.ui_swing.components.renderers.ExtendedListModeCellRenderer;
29 29
 import com.dmdirc.addons.ui_swing.components.renderers.ListModeCellRenderer;
30 30
 import com.dmdirc.addons.ui_swing.dialogs.StandardInputDialog;
31
-import com.dmdirc.util.validators.NotEmptyValidator;
32 31
 import com.dmdirc.interfaces.config.ConfigChangeListener;
33 32
 import com.dmdirc.parser.common.ChannelListModeItem;
34 33
 import com.dmdirc.util.collections.MapList;
34
+import com.dmdirc.util.validators.NotEmptyValidator;
35 35
 
36
-import java.awt.Window;
37 36
 import java.awt.Dialog.ModalityType;
37
+import java.awt.Window;
38 38
 import java.awt.event.ActionEvent;
39 39
 import java.awt.event.ActionListener;
40 40
 import java.util.ArrayList;
@@ -119,25 +119,23 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
119 119
 
120 120
         list = new JList();
121 121
         nativeRenderer = list.getCellRenderer();
122
-        if (channel.getConfigManager().getOptionBool("general",
123
-                "extendedListModes")) {
122
+        if (channel.getConfigManager().getOptionBool("general", "extendedListModes")) {
124 123
             renderer = new ExtendedListModeCellRenderer();
125 124
         } else {
126 125
             renderer = new ListModeCellRenderer(nativeRenderer);
127 126
         }
128 127
         listModesPanel = new JScrollPane();
129
-        listModesPanels = new ArrayList<JList>();
128
+        listModesPanels = new ArrayList<>();
130 129
         listModesArray = channel.getServer().getParser().getListChannelModes().
131 130
                 toCharArray();
132
-        existingListItems = new MapList<Character, ChannelListModeItem>();
131
+        existingListItems = new MapList<>();
133 132
         listModesMenu = new JComboBox(new DefaultComboBoxModel());
134 133
         addListModeButton = new JButton("Add");
135 134
         removeListModeButton = new JButton("Remove");
136 135
         removeListModeButton.setEnabled(false);
137 136
         modeCount = new JLabel();
138
-        toggle = new JCheckBox("Show extended information",
139
-                channel.getConfigManager().getOptionBool("general",
140
-                "extendedListModes"));
137
+        toggle = new JCheckBox("Show extended information", channel.getConfigManager()
138
+                .getOptionBool("general", "extendedListModes"));
141 139
         toggle.setOpaque(UIUtilities.getTabbedPaneOpaque());
142 140
 
143 141
         initListModesPanel();
@@ -158,9 +156,8 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
158 156
             if (listItems == null) {
159 157
                 continue;
160 158
             }
161
-            existingListItems.add(mode, new ArrayList<ChannelListModeItem>(listItems));
162
-            final DefaultListModel model =
163
-                    (DefaultListModel) listModesPanels.get(i).getModel();
159
+            existingListItems.add(mode, new ArrayList<>(listItems));
160
+            final DefaultListModel model =(DefaultListModel) listModesPanels.get(i).getModel();
164 161
 
165 162
             model.removeAllElements();
166 163
             for (ChannelListModeItem listItem : listItems) {
@@ -180,12 +177,10 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
180 177
             addListModeButton.setEnabled(true);
181 178
         }
182 179
 
183
-        final DefaultComboBoxModel model =
184
-                (DefaultComboBoxModel) listModesMenu.getModel();
180
+        final DefaultComboBoxModel model = (DefaultComboBoxModel) listModesMenu.getModel();
185 181
         for (char mode : listModesArray) {
186 182
             String modeText = mode + " list";
187
-            if (channel.getConfigManager().hasOptionString("server", "mode"
188
-                    + mode)) {
183
+            if (channel.getConfigManager().hasOptionString("server", "mode" + mode)) {
189 184
                 modeText = channel.getConfigManager().getOption("server",
190 185
                         "mode" + mode) + " list [+" + mode + "]";
191 186
             }
@@ -230,34 +225,28 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
230 225
         removeListModeButton.addActionListener(this);
231 226
         listModesMenu.addActionListener(this);
232 227
         toggle.addActionListener(this);
233
-        channel.getConfigManager().addChangeListener("general",
234
-                "extendedListModes", this);
228
+        channel.getConfigManager().addChangeListener("general", "extendedListModes", this);
235 229
 
236 230
     }
237 231
 
238 232
     /** Sends the list modes to the server. */
239 233
     public void save() {
240
-        final Map<ChannelListModeItem, Character> currentModes =
241
-                new HashMap<ChannelListModeItem, Character>();
242
-        final Map<ChannelListModeItem, Character> newModes =
243
-                new HashMap<ChannelListModeItem, Character>();
234
+        final Map<ChannelListModeItem, Character> currentModes = new HashMap<>();
235
+        final Map<ChannelListModeItem, Character> newModes = new HashMap<>();
244 236
 
245 237
         for (int i = 0; i < listModesArray.length;
246 238
                 i++) {
247 239
             final char mode = listModesArray[i];
248
-            final Enumeration<?> values =
249
-                    ((DefaultListModel) listModesPanels.get(i).getModel()).
240
+            final Enumeration<?> values = ((DefaultListModel) listModesPanels.get(i).getModel()).
250 241
                     elements();
251
-            final List<ChannelListModeItem> listItems =
252
-                    existingListItems.get(mode);
242
+            final List<ChannelListModeItem> listItems = existingListItems.get(mode);
253 243
 
254 244
             for (ChannelListModeItem listItem : listItems) {
255 245
                 currentModes.put(listItem, mode);
256 246
             }
257 247
 
258 248
             while (values.hasMoreElements()) {
259
-                final ChannelListModeItem value =
260
-                        (ChannelListModeItem) values.nextElement();
249
+                final ChannelListModeItem value = (ChannelListModeItem) values.nextElement();
261 250
                 newModes.put(value, mode);
262 251
             }
263 252
         }
@@ -266,22 +255,17 @@ public final class ChannelListModesPane extends JPanel implements ActionListener
266 255
             if (currentModes.containsKey(entry.getKey())) {
267 256
                 currentModes.remove(entry.getKey());
268 257
             } else {
269
-                channel.getChannelInfo().
270
-                        alterMode(true, entry.getValue(),
271
-                        entry.getKey().getItem());
258
+                channel.getChannelInfo().alterMode(true, entry.getValue(), entry.getKey().getItem());
272 259
             }
273 260
         }
274 261
 
275
-        for (Entry<ChannelListModeItem, Character> entry :
276
-                currentModes.entrySet()) {
277
-            channel.getChannelInfo().
278
-                    alterMode(false, entry.getValue(), entry.getKey().getItem());
262
+        for (Entry<ChannelListModeItem, Character> entry : currentModes.entrySet()) {
263
+            channel.getChannelInfo().alterMode(false, entry.getValue(), entry.getKey().getItem());
279 264
         }
280 265
 
281 266
         channel.getChannelInfo().flushModes();
282 267
 
283
-        controller.getGlobalIdentity().setOption("general",
284
-                "extendedListModes", toggle.isSelected());
268
+        controller.getGlobalIdentity().setOption("general", "extendedListModes", toggle.isSelected());
285 269
     }
286 270
 
287 271
     /** Adds a list mode. */

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLConfigPanel.java View File

@@ -135,7 +135,7 @@ public class URLConfigPanel extends JPanel implements
135 135
         table.setRowSelectionAllowed(true);
136 136
         table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
137 137
         table.getRowSorter().toggleSortOrder(0);
138
-        details = new HashMap<URI, URLProtocolPanel>();
138
+        details = new HashMap<>();
139 139
         empty = new URLProtocolPanel(controller, null, true);
140 140
         activeComponent = empty;
141 141
         add = new JButton("Add");

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/prefs/URLHandlerTableModel.java View File

@@ -211,7 +211,7 @@ public class URLHandlerTableModel extends AbstractTableModel {
211 211
      * @return URL Handler map
212 212
      */
213 213
     public Map<URI, String> getURLHandlers() {
214
-        final Map<URI, String> urlHandlers = new HashMap<URI, String>();
214
+        final Map<URI, String> urlHandlers = new HashMap<>();
215 215
 
216 216
         for (int i = 0; i < uris.size(); i++) {
217 217
             urlHandlers.put(uris.get(i), handlers.get(i));

+ 2
- 2
src/com/dmdirc/addons/ui_swing/dialogs/prefs/UpdateTableModel.java View File

@@ -65,8 +65,8 @@ public class UpdateTableModel extends AbstractTableModel {
65 65
     public UpdateTableModel(final Collection<UpdateComponent> updates) {
66 66
         super();
67 67
 
68
-        this.updates = new ArrayList<UpdateComponent>(updates);
69
-        this.enabled = new HashMap<UpdateComponent, Boolean>();
68
+        this.updates = new ArrayList<>(updates);
69
+        this.enabled = new HashMap<>();
70 70
 
71 71
         for (UpdateComponent update : this.updates) {
72 72
             enabled.put(update,

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/IgnoreListPanel.java View File

@@ -181,7 +181,7 @@ public final class IgnoreListPanel extends JPanel implements ActionListener,
181 181
             new StandardInputDialog(controller, parentWindow,
182 182
                     ModalityType.MODELESS, "New ignore list entry",
183 183
                     "Please enter the new ignore list entry",
184
-                    viewToggle.isSelected() ? new ValidatorChain<String>(
184
+                    viewToggle.isSelected() ? new ValidatorChain<>(
185 185
                     new NotEmptyValidator(), new RegexValidator())
186 186
                     : new NotEmptyValidator()) {
187 187
 

+ 4
- 7
src/com/dmdirc/addons/ui_swing/dialogs/sslcertificate/CertificateInfoPanel.java View File

@@ -69,13 +69,12 @@ public class CertificateInfoPanel extends JScrollPane {
69 69
 
70 70
     private void initComponents() {
71 71
         content = new JPanel();
72
-        certificateInfo = new ArrayList<List<CertificateInformationEntry>>();
72
+        certificateInfo = new ArrayList<>();
73 73
     }
74 74
 
75 75
     private void layoutComponents() {
76 76
         setBorder(BorderFactory.createTitledBorder(UIManager.getBorder(
77
-                "TitledBorder.border"), "Information for " +
78
-                certificateName));
77
+                "TitledBorder.border"), "Information for " + certificateName));
79 78
         content.setVisible(false);
80 79
         content.removeAll();
81 80
         content.setLayout(new MigLayout("fillx, wmax 100%, wrap 2, pack"));
@@ -83,8 +82,7 @@ public class CertificateInfoPanel extends JScrollPane {
83 82
         int i = 1;
84 83
         for (List<CertificateInformationEntry> entry : certificateInfo) {
85 84
             for (CertificateInformationEntry info : entry) {
86
-                content.add(new TextLabel(info.getTitle() + ": "),
87
-                        "alignx right");
85
+                content.add(new TextLabel(info.getTitle() + ": "), "alignx right");
88 86
                 final TextLabel text = new TextLabel(info.getValue(), false);
89 87
                 if (info.isInvalid()) {
90 88
                     final SimpleAttributeSet sas = new SimpleAttributeSet();
@@ -120,8 +118,7 @@ public class CertificateInfoPanel extends JScrollPane {
120 118
         this.certificateName = certificateName;
121 119
 
122 120
         if (certificateInfo == null) {
123
-            this.certificateInfo =
124
-                    new ArrayList<List<CertificateInformationEntry>>();
121
+            this.certificateInfo = new ArrayList<>();
125 122
         }
126 123
         layoutComponents();
127 124
     }

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/sslcertificate/SummaryPanel.java View File

@@ -53,7 +53,7 @@ public class SummaryPanel extends JPanel {
53 53
      */
54 54
     public SummaryPanel(final IconManager iconManager) {
55 55
         this.iconManager = iconManager;
56
-        summary = new ArrayList<CertificateSummaryEntry>();
56
+        summary = new ArrayList<>();
57 57
         layoutComponents();
58 58
     }
59 59
 

+ 3
- 3
src/com/dmdirc/addons/ui_swing/dialogs/updater/UpdateTableModel.java View File

@@ -51,11 +51,11 @@ public class UpdateTableModel extends AbstractTableModel implements UpdateStatus
51 51
     /** The update manager to use. */
52 52
     private final CachingUpdateManager updateManager;
53 53
     /** Data list. */
54
-    private final List<UpdateComponent> updates = new ArrayList<UpdateComponent>();
54
+    private final List<UpdateComponent> updates = new ArrayList<>();
55 55
     /** Enabled list. */
56
-    private final List<UpdateComponent> enabled = new ArrayList<UpdateComponent>();
56
+    private final List<UpdateComponent> enabled = new ArrayList<>();
57 57
     /** Cached progress for each component. */
58
-    private final Map<UpdateComponent, Double> progress = new HashMap<UpdateComponent, Double>();
58
+    private final Map<UpdateComponent, Double> progress = new HashMap<>();
59 59
     /** Number formatter. */
60 60
     private NumberFormat formatter;
61 61
 

+ 1
- 1
src/com/dmdirc/addons/ui_swing/dialogs/url/URLSubsitutionsPanel.java View File

@@ -67,7 +67,7 @@ public class URLSubsitutionsPanel extends SubstitutionsPanel<List<String>> {
67 67
             /** {@inheritDoc} */
68 68
             @Override
69 69
             public void run() {
70
-                substitutions = new ArrayList<SubstitutionLabel>();
70
+                substitutions = new ArrayList<>();
71 71
 
72 72
                 if (type != null) {
73 73
                     for (String sub : type) {

+ 12
- 9
src/com/dmdirc/addons/ui_swing/framemanager/buttonbar/ButtonBar.java View File

@@ -193,7 +193,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
193 193
 
194 194
             if (!frame.getChildren().isEmpty()) {
195 195
                 final ArrayList<FrameContainer> childList = new ArrayList
196
-                        <FrameContainer>(frame.getChildren());
196
+                        <>(frame.getChildren());
197 197
                 initButtons(childList);
198 198
             }
199 199
         }
@@ -271,7 +271,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
271 271
                 buttonPanel.add(button);
272 272
                 if (!window.getChildren().isEmpty()) {
273 273
                     final ArrayList<FrameContainer> childList = new ArrayList
274
-                            <FrameContainer>(window.getChildren());
274
+                            <>(window.getChildren());
275 275
                     if (sortChildWindows) {
276 276
                          Collections.sort(childList,
277 277
                                  new FrameContainerComparator());
@@ -290,7 +290,7 @@ public final class ButtonBar implements FrameManager, ActionListener,
290 290
         buttonPanel.removeAll();
291 291
 
292 292
         final ArrayList<FrameContainer> windowList = new
293
- ArrayList<FrameContainer>(windowManager.getRootWindows());
293
+ ArrayList<>(windowManager.getRootWindows());
294 294
         if (sortRootWindows) {
295 295
             Collections.sort(windowList, new FrameContainerComparator());
296 296
         }
@@ -595,12 +595,15 @@ public final class ButtonBar implements FrameManager, ActionListener,
595 595
     /** {@inheritDoc} */
596 596
     @Override
597 597
     public void configChanged(final String domain, final String key) {
598
-        if ("sortrootwindows".equals(key)) {
599
-            sortRootWindows = controller.getGlobalConfig()
600
-                    .getOptionBool("ui", "sortrootwindows");
601
-        } else if ("sortchildwindows".equals(key)) {
602
-            sortChildWindows = controller.getGlobalConfig()
603
-                    .getOptionBool("ui", "sortrootwindows");
598
+        switch (key) {
599
+            case "sortrootwindows":
600
+                sortRootWindows = controller.getGlobalConfig()
601
+                        .getOptionBool("ui", "sortrootwindows");
602
+                break;
603
+            case "sortchildwindows":
604
+                sortChildWindows = controller.getGlobalConfig()
605
+                        .getOptionBool("ui", "sortrootwindows");
606
+                break;
604 607
         }
605 608
         relayout();
606 609
     }

+ 1
- 1
src/com/dmdirc/addons/ui_swing/framemanager/ctrltab/CtrlTabWindowManager.java View File

@@ -76,7 +76,7 @@ public class CtrlTabWindowManager implements SwingWindowListener,
76 76
     public CtrlTabWindowManager(final SwingController controller,
77 77
             final MainFrame mainFrame,
78 78
             final JComponent component) {
79
-        nodes = new HashMap<Window, TreeViewNode>();
79
+        nodes = new HashMap<>();
80 80
         model = new TreeViewModel(controller, new TreeViewNode(null, null));
81 81
         selectionModel = new DefaultTreeSelectionModel();
82 82
         treeScroller = new TreeScroller(model, selectionModel, false) {

+ 35
- 33
src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java View File

@@ -93,11 +93,9 @@ public class Tree extends JTree implements MouseMotionListener,
93 93
         getInputMap(JComponent.WHEN_FOCUSED).clear();
94 94
         getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).clear();
95 95
         getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).clear();
96
-        getSelectionModel().setSelectionMode(
97
-                TreeSelectionModel.SINGLE_TREE_SELECTION);
96
+        getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
98 97
         setRootVisible(false);
99
-        setRowHeight(getFontMetrics(
100
-                UIManager.getFont("Tree.font")).getHeight() + 2);
98
+        setRowHeight(getFontMetrics(UIManager.getFont("Tree.font")).getHeight() + 2);
101 99
         setOpaque(true);
102 100
         setBorder(BorderFactory.createEmptyBorder(
103 101
                 (int) PlatformDefaults.getUnitValueX("related").getValue(),
@@ -121,8 +119,7 @@ public class Tree extends JTree implements MouseMotionListener,
121 119
     /** {@inheritDoc} */
122 120
     @Override
123 121
     public void scrollRectToVisible(final Rectangle aRect) {
124
-        final Rectangle rect = new Rectangle(0, aRect.y,
125
-                aRect.width, aRect.height);
122
+        final Rectangle rect = new Rectangle(0, aRect.y, aRect.width, aRect.height);
126 123
         super.scrollRectToVisible(rect);
127 124
     }
128 125
 
@@ -163,12 +160,15 @@ public class Tree extends JTree implements MouseMotionListener,
163 160
     /** {@inheritDoc} */
164 161
     @Override
165 162
     public void configChanged(final String domain, final String key) {
166
-        if ("dragSelection".equals(key)) {
167
-            dragSelect = config.getOptionBool("treeview", "dragSelection");
168
-        } else if ("showtreeexpands".equals(key)) {
169
-            config.getOptionBool(controller.getDomain(), "showtreeexpands");
170
-            setShowsRootHandles(showHandles);
171
-            putClientProperty("showHandles", showHandles);
163
+        switch (key) {
164
+            case "dragSelection":
165
+                dragSelect = config.getOptionBool("treeview", "dragSelection");
166
+                break;
167
+            case "showtreeexpands":
168
+                config.getOptionBool(controller.getDomain(), "showtreeexpands");
169
+                setShowsRootHandles(showHandles);
170
+                putClientProperty("showHandles", showHandles);
171
+                break;
172 172
         }
173 173
     }
174 174
 
@@ -268,9 +268,8 @@ public class Tree extends JTree implements MouseMotionListener,
268 268
     public void processMouseEvents(final MouseEvent e) {
269 269
         final TreePath localPath = getPathForLocation(e.getX(), e.getY());
270 270
         if (localPath != null && e.isPopupTrigger()) {
271
-            final TextFrame frame = controller.getWindowFactory()
272
-                    .getSwingWindow(((TreeViewNode) localPath.getLastPathComponent())
273
-                    .getWindow());
271
+            final TextFrame frame = controller.getWindowFactory().getSwingWindow(
272
+                    ((TreeViewNode) localPath.getLastPathComponent()).getWindow());
274 273
 
275 274
             if (frame == null) {
276 275
                 return;
@@ -322,24 +321,27 @@ public class Tree extends JTree implements MouseMotionListener,
322 321
         final TreeViewNode node = ((TreeViewNodeMenuItem) e.getSource()).
323 322
                 getTreeNode();
324 323
         int index = getModel().getIndexOfChild(node.getParent(), node);
325
-        if ("Up".equals(e.getActionCommand())) {
326
-            if (index == 0) {
327
-                index = node.getSiblingCount() - 1;
328
-            } else {
329
-                index--;
330
-            }
331
-        } else if ("Down".equals(e.getActionCommand())) {
332
-            if (index == (node.getSiblingCount() - 1)) {
333
-                index = 0;
334
-            } else {
335
-                index++;
336
-            }
337
-        } else if ("popout".equals(e.getActionCommand())) {
338
-            controller.getWindowFactory().getSwingWindow(node.getWindow())
339
-                    .setPopout(true);
340
-        } else if ("popin".equals(e.getActionCommand())) {
341
-            controller.getWindowFactory().getSwingWindow(node.getWindow())
342
-                    .setPopout(false);
324
+        switch (e.getActionCommand()) {
325
+            case "Up":
326
+                if (index == 0) {
327
+                    index = node.getSiblingCount() - 1;
328
+                } else {
329
+                    index--;
330
+                }
331
+                break;
332
+            case "Down":
333
+                if (index == (node.getSiblingCount() - 1)) {
334
+                    index = 0;
335
+                } else {
336
+                    index++;
337
+                }
338
+                break;
339
+            case "popout":
340
+                controller.getWindowFactory().getSwingWindow(node.getWindow()).setPopout(true);
341
+                break;
342
+            case "popin":
343
+                controller.getWindowFactory().getSwingWindow(node.getWindow()).setPopout(false);
344
+                break;
343 345
         }
344 346
         final TreeViewNode parentNode = (TreeViewNode) node.getParent();
345 347
         final TreePath nodePath = new TreePath(node.getPath());

+ 1
- 2
src/com/dmdirc/addons/ui_swing/framemanager/tree/TreeFrameManager.java View File

@@ -337,8 +337,7 @@ public class TreeFrameManager implements FrameManager,
337 337
     @Override
338 338
     public void selectionChanged(final TextFrame window) {
339 339
         synchronized (nodes) {
340
-            final Collection<TreeViewNode> collection =
341
-                    new ArrayList<TreeViewNode>(nodes.values());
340
+            final Collection<TreeViewNode> collection = new ArrayList<>(nodes.values());
342 341
             for (TreeViewNode treeNode : collection) {
343 342
                 final NodeLabel label = treeNode.getLabel();
344 343
                 label.selectionChanged(window);

+ 1
- 2
src/com/dmdirc/addons/ui_swing/framemanager/windowmenu/WindowMenuFrameManager.java View File

@@ -301,8 +301,7 @@ public final class WindowMenuFrameManager extends JMenu implements
301 301
     /** {@inheritDoc} */
302 302
     @Override
303 303
     public void selectionChanged(final TextFrame window) {
304
-        final Collection<SelectionListener> values =
305
-                new ArrayList<SelectionListener>();
304
+        final Collection<SelectionListener> values = new ArrayList<>();
306 305
         synchronized (menus) {
307 306
             synchronized (items) {
308 307
                 synchronized (menuItems) {

+ 2
- 2
src/com/dmdirc/addons/ui_swing/textpane/TextPaneCanvas.java View File

@@ -111,8 +111,8 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
111 111
         startLine = 0;
112 112
         setDoubleBuffered(true);
113 113
         setOpaque(true);
114
-        textLayouts = new HashMap<TextLayout, LineInfo>();
115
-        positions = new HashMap<Rectangle, TextLayout>();
114
+        textLayouts = new HashMap<>();
115
+        positions = new HashMap<>();
116 116
         selection = new LinePosition(-1, -1, -1, -1);
117 117
         addMouseListener(this);
118 118
         addMouseMotionListener(this);

+ 3
- 3
src/com/dmdirc/addons/ui_web/Client.java View File

@@ -48,7 +48,7 @@ public class Client {
48 48
     private final String ip;
49 49
 
50 50
     /** An ordered list of events to be sent to the client */
51
-    private final List<Event> events = new LinkedList<Event>();
51
+    private final List<Event> events = new LinkedList<>();
52 52
 
53 53
     /**
54 54
      * Creates a new client for the specified controller.
@@ -62,7 +62,7 @@ public class Client {
62 62
 
63 63
         this.ip = ip;
64 64
 
65
-        final List<Window> added = new LinkedList<Window>();
65
+        final List<Window> added = new LinkedList<>();
66 66
         final List<Window> queued
67 67
                 = new LinkedList<Window>(controller.getWindowManager().getWindows());
68 68
 
@@ -142,7 +142,7 @@ public class Client {
142 142
      */
143 143
     public List<Event> retrieveEvents() {
144 144
         synchronized (events) {
145
-            final List<Event> res = new LinkedList<Event>(events);
145
+            final List<Event> res = new LinkedList<>(events);
146 146
             events.clear();
147 147
             return res;
148 148
         }

+ 1
- 1
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java View File

@@ -98,7 +98,7 @@ public class WebWindow implements Window, IRCDocumentListener,
98 98
             return Collections.<String>emptyList();
99 99
         }
100 100
 
101
-        final List<String> messages = new ArrayList<String>(document.getNumLines());
101
+        final List<String> messages = new ArrayList<>(document.getNumLines());
102 102
 
103 103
         for (int i = 0; i < document.getNumLines(); i++) {
104 104
             messages.add(style(document.getStyledLine(i)));

+ 8
- 8
test/com/dmdirc/addons/calc/ParserTest.java View File

@@ -42,7 +42,7 @@ public class ParserTest {
42 42
 
43 43
     @Test
44 44
     public void testFindTokenType() {
45
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
45
+        final List<TreeToken> tokens = new ArrayList<>();
46 46
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_CLOSE, null)));
47 47
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_CLOSE, null)));
48 48
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_OPEN, null)));
@@ -62,7 +62,7 @@ public class ParserTest {
62 62
     public void testParseBracket() throws ParseException {
63 63
         final Parser parser = new Parser(null);
64 64
 
65
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
65
+        final List<TreeToken> tokens = new ArrayList<>();
66 66
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
67 67
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_OPEN, null)));
68 68
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
@@ -80,7 +80,7 @@ public class ParserTest {
80 80
     public void testParseBracket2() throws ParseException {
81 81
         final Parser parser = new Parser(null);
82 82
 
83
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
83
+        final List<TreeToken> tokens = new ArrayList<>();
84 84
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
85 85
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_OPEN, null)));
86 86
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
@@ -104,7 +104,7 @@ public class ParserTest {
104 104
     public void testUnmatchedBracket() throws ParseException {
105 105
         final Parser parser = new Parser(null);
106 106
 
107
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
107
+        final List<TreeToken> tokens = new ArrayList<>();
108 108
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
109 109
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
110 110
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_CLOSE, null)));
@@ -117,7 +117,7 @@ public class ParserTest {
117 117
     public void testParseNumber() {
118 118
         final Parser parser = new Parser(null);
119 119
 
120
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
120
+        final List<TreeToken> tokens = new ArrayList<>();
121 121
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
122 122
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_OPEN, null)));
123 123
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
@@ -133,7 +133,7 @@ public class ParserTest {
133 133
     public void testParseHidden() {
134 134
         final Parser parser = new Parser(null);
135 135
 
136
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
136
+        final List<TreeToken> tokens = new ArrayList<>();
137 137
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
138 138
         tokens.add(new TreeToken(new Token(TokenType.BRACKET_OPEN, null)));
139 139
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
@@ -153,7 +153,7 @@ public class ParserTest {
153 153
     public void testParseUnaryOps() {
154 154
         final Parser parser = new Parser(null);
155 155
 
156
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
156
+        final List<TreeToken> tokens = new ArrayList<>();
157 157
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
158 158
         tokens.add(new TreeToken(new Token(TokenType.MOD_NEGATIVE, null)));
159 159
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, null)));
@@ -174,7 +174,7 @@ public class ParserTest {
174 174
     public void testParseBinaryOps() {
175 175
         final Parser parser = new Parser(null);
176 176
 
177
-        final List<TreeToken> tokens = new ArrayList<TreeToken>();
177
+        final List<TreeToken> tokens = new ArrayList<>();
178 178
         tokens.add(new TreeToken(new Token(TokenType.START, null)));
179 179
         tokens.add(new TreeToken(new Token(TokenType.NUMBER_INT, "15")));
180 180
         tokens.add(new TreeToken(new Token(TokenType.OP_MINUS, null)));

+ 1
- 1
test/com/dmdirc/addons/osd/OsdPolicyTest.java View File

@@ -34,7 +34,7 @@ public class OsdPolicyTest {
34 34
 
35 35
     @Before
36 36
     public void setup() {
37
-        final ArrayList<OsdWindow> windows = new ArrayList<OsdWindow>();
37
+        final ArrayList<OsdWindow> windows = new ArrayList<>();
38 38
 
39 39
         OsdWindow window = mock(OsdWindow.class);
40 40
         when(window.getY()).thenReturn(75);

+ 3
- 3
test/com/dmdirc/addons/ui_swing/dialogs/profiles/ProfileNameValidatorTest.java View File

@@ -43,7 +43,7 @@ public class ProfileNameValidatorTest {
43 43
         when(other.getName()).thenReturn("other");
44 44
         final Profile selected = mock(Profile.class);
45 45
         when(selected.getName()).thenReturn("selected");
46
-        final List<Profile> profiles = new ArrayList<Profile>();
46
+        final List<Profile> profiles = new ArrayList<>();
47 47
         profiles.add(selected);
48 48
         profiles.add(other);
49 49
         ProfileNameValidator instance = new ProfileNameValidator(profiles, selected);
@@ -59,7 +59,7 @@ public class ProfileNameValidatorTest {
59 59
         when(other.getName()).thenReturn("other");
60 60
         final Profile selected = mock(Profile.class);
61 61
         when(selected.getName()).thenReturn("selected");
62
-        final List<Profile> profiles = new ArrayList<Profile>();
62
+        final List<Profile> profiles = new ArrayList<>();
63 63
         profiles.add(selected);
64 64
         profiles.add(other);
65 65
         ProfileNameValidator instance = new ProfileNameValidator(profiles, selected);
@@ -75,7 +75,7 @@ public class ProfileNameValidatorTest {
75 75
         when(other.getName()).thenReturn("other");
76 76
         final Profile selected = mock(Profile.class);
77 77
         when(selected.getName()).thenReturn("selected");
78
-        final List<Profile> profiles = new ArrayList<Profile>();
78
+        final List<Profile> profiles = new ArrayList<>();
79 79
         profiles.add(selected);
80 80
         profiles.add(other);
81 81
         ProfileNameValidator instance = new ProfileNameValidator(profiles, selected);

Loading…
Cancel
Save