Преглед на файлове

Fixed a bunch of minor code/style issues


git-svn-id: http://svn.dmdirc.com/trunk@2496 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Chris Smith преди 16 години
родител
ревизия
308407f168
променени са 34 файла, в които са добавени 32 реда и са изтрити 59 реда
  1. 1
    1
      src/com/dmdirc/Channel.java
  2. 1
    2
      src/com/dmdirc/IconManager.java
  3. 1
    1
      src/com/dmdirc/ServerState.java
  4. 4
    10
      src/com/dmdirc/actions/Action.java
  5. 1
    1
      src/com/dmdirc/actions/ActionManager.java
  6. 1
    3
      src/com/dmdirc/addons/audio/AudioCommand.java
  7. 0
    1
      src/com/dmdirc/addons/audio/AudioPlayer.java
  8. 1
    1
      src/com/dmdirc/addons/identd/IdentdPlugin.java
  9. 1
    0
      src/com/dmdirc/addons/logging/LoggingPlugin.java
  10. 1
    1
      src/com/dmdirc/addons/nowplaying/plugin/NowPlayingPlugin.java
  11. 5
    5
      src/com/dmdirc/commandparser/CommandManager.java
  12. 0
    1
      src/com/dmdirc/commandparser/commands/global/LoadPlugin.java
  13. 1
    1
      src/com/dmdirc/config/ConfigTarget.java
  14. 1
    1
      src/com/dmdirc/config/IdentityManager.java
  15. 0
    1
      src/com/dmdirc/installer/LinuxInstaller.java
  16. 0
    1
      src/com/dmdirc/installer/StepConfirm.java
  17. 0
    1
      src/com/dmdirc/installer/StepSettings.java
  18. 0
    2
      src/com/dmdirc/installer/WindowsInstaller.java
  19. 0
    1
      src/com/dmdirc/parser/callbacks/CallbackOnChannelNickChanged.java
  20. 0
    3
      src/com/dmdirc/plugins/PluginClassLoader.java
  21. 1
    1
      src/com/dmdirc/themes/ThemeManager.java
  22. 0
    3
      src/com/dmdirc/ui/dummy/DummyStatusBar.java
  23. 0
    2
      src/com/dmdirc/ui/interfaces/StatusBar.java
  24. 1
    1
      src/com/dmdirc/ui/swing/DMDircEventQueue.java
  25. 1
    1
      src/com/dmdirc/ui/swing/components/ColourChooser.java
  26. 1
    1
      src/com/dmdirc/ui/swing/components/PackingTable.java
  27. 1
    1
      src/com/dmdirc/ui/swing/components/SearchBar.java
  28. 1
    2
      src/com/dmdirc/ui/swing/components/SwingPreferencesPanel.java
  29. 2
    2
      src/com/dmdirc/ui/swing/dialogs/channelsetting/ChannelSettingsDialog.java
  30. 0
    2
      src/com/dmdirc/ui/swing/dialogs/wizard/WizardDialog.java
  31. 2
    1
      src/com/dmdirc/ui/swing/framemanager/ctrltab/CtrlTabFrameManager.java
  32. 1
    1
      src/com/dmdirc/ui/swing/textpane/TextPaneCanvas.java
  33. 1
    2
      src/com/dmdirc/util/CipherUtils.java
  34. 1
    1
      src/com/dmdirc/util/resourcemanager/ResourceManager.java

+ 1
- 1
src/com/dmdirc/Channel.java Целия файл

@@ -385,7 +385,7 @@ public final class Channel extends MessageTarget implements
385 385
      * to send a who request.
386 386
      */
387 387
     public void checkWho() {
388
-        if (onChannel && configManager.getOptionBool("channel", "sendwho", false)) {
388
+        if (onChannel && sendWho) {
389 389
             server.getParser().sendLine("WHO :" + channelInfo.getName());
390 390
         }
391 391
     }

+ 1
- 2
src/com/dmdirc/IconManager.java Целия файл

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.config.ConfigChangeListener;
26
-import com.dmdirc.config.ConfigManager;
27 26
 import com.dmdirc.config.IdentityManager;
28 27
 
29 28
 import java.awt.Image;
@@ -94,7 +93,7 @@ public final class IconManager implements ConfigChangeListener {
94 93
      */
95 94
     public Image getImage(final String type) {
96 95
         if (!images.containsKey(type)) {
97
-            images.put(type, Toolkit.getDefaultToolkit().getDefaultToolkit().createImage(getIconURL(type)));
96
+            images.put(type, Toolkit.getDefaultToolkit().createImage(getIconURL(type)));
98 97
         }
99 98
         return images.get(type);
100 99
     }

+ 1
- 1
src/com/dmdirc/ServerState.java Целия файл

@@ -36,4 +36,4 @@ public enum ServerState {
36 36
     RECONNECT_WAIT,
37 37
     /** Indicates that the server frame and its children are closing. */
38 38
     CLOSING,
39
-};
39
+}

+ 4
- 10
src/com/dmdirc/actions/Action.java Целия файл

@@ -118,9 +118,7 @@ public class Action extends ActionModel implements Serializable {
118 118
         // Read the triggers
119 119
         if (properties.containsKey("trigger")) {
120 120
             final String[] triggerStrings = properties.getProperty("trigger").split("\\|");
121
-            
122
-            Class[] args = null;
123
-            
121
+                        
124 122
             triggers = new ActionType[triggerStrings.length];
125 123
             
126 124
             for (int i = 0; i < triggerStrings.length; i++) {
@@ -130,13 +128,9 @@ public class Action extends ActionModel implements Serializable {
130 128
                     error("Invalid trigger specified");
131 129
                     return;
132 130
                 } else {
133
-                    if (i == 0) {
134
-                        args = triggers[i].getType().getArgTypes();
135
-                    } else {
136
-                        if (!triggers[i].getType().equals(triggers[0].getType())) {
137
-                            error("Triggers are not compatible");
138
-                            return;
139
-                        }
131
+                    if (i != 0 && !triggers[i].getType().equals(triggers[0].getType())) {
132
+                        error("Triggers are not compatible");
133
+                        return;
140 134
                     }
141 135
                 }
142 136
             }

+ 1
- 1
src/com/dmdirc/actions/ActionManager.java Целия файл

@@ -194,7 +194,7 @@ public final class ActionManager {
194 194
             }
195 195
         }
196 196
         
197
-        if (dir == null || dir.listFiles() == null) {
197
+        if (dir.listFiles() == null) {
198 198
             Logger.userError(ErrorLevel.MEDIUM, "Unable to load user action files");
199 199
         } else {
200 200
             for (File file : dir.listFiles()) {

+ 1
- 3
src/com/dmdirc/addons/audio/AudioCommand.java Целия файл

@@ -24,11 +24,9 @@ package com.dmdirc.addons.audio;
24 24
 
25 25
 import com.dmdirc.commandparser.CommandManager;
26 26
 import com.dmdirc.commandparser.commands.GlobalCommand;
27
-import com.dmdirc.plugins.Plugin;
28
-import com.dmdirc.plugins.PluginManager;
29 27
 import com.dmdirc.ui.interfaces.InputWindow;
28
+
30 29
 import java.io.File;
31
-import java.io.IOException;
32 30
 
33 31
 /**
34 32
  * The Audio Command allows playing of audio files.

+ 0
- 1
src/com/dmdirc/addons/audio/AudioPlayer.java Целия файл

@@ -28,7 +28,6 @@ import javax.sound.sampled.AudioFormat;
28 28
 import javax.sound.sampled.SourceDataLine;
29 29
 import javax.sound.sampled.DataLine;
30 30
 import java.io.File;
31
-import java.io.IOException;
32 31
 
33 32
 /**
34 33
  * The AudioPlayer handles the playing of the audio

+ 1
- 1
src/com/dmdirc/addons/identd/IdentdPlugin.java Целия файл

@@ -152,7 +152,7 @@ public class IdentdPlugin extends Plugin implements EventPlugin, PreferencesInte
152 152
 			}
153 153
 		} else if (type == CoreActionType.SERVER_CONNECTED || type == CoreActionType.SERVER_CONNECTERROR) {
154 154
 			synchronized (servers) {
155
-				servers.remove((Server) arguments[0]);
155
+				servers.remove(arguments[0]);
156 156
 			
157 157
 				if (servers.size() == 0) {
158 158
 					if (!IdentityManager.getGlobalConfig().getOptionBool(getDomain(), "advanced.alwaysOn")) {

+ 1
- 0
src/com/dmdirc/addons/logging/LoggingPlugin.java Целия файл

@@ -517,6 +517,7 @@ public final class LoggingPlugin extends Plugin implements EventPlugin, Preferen
517 517
 		final boolean showTimestamp = IdentityManager.getGlobalConfig().getOptionBool(MY_DOMAIN, "backbuffer.timestamp");
518 518
 		if (frame == null) {
519 519
 			Logger.userError(ErrorLevel.LOW, "Given a null frame");
520
+            return;
520 521
 		}
521 522
 		
522 523
 		File testFile = new File(filename);

+ 1
- 1
src/com/dmdirc/addons/nowplaying/plugin/NowPlayingPlugin.java Целия файл

@@ -206,7 +206,7 @@ public class NowPlayingPlugin extends Plugin implements EventPlugin,
206 206
      */
207 207
     private void removePlugin(final Plugin target) {
208 208
         if (target instanceof MediaSource) {
209
-            sources.remove((MediaSource) target);
209
+            sources.remove(target);
210 210
         }
211 211
         
212 212
         if (target instanceof MediaSourceManager) {

+ 5
- 5
src/com/dmdirc/commandparser/CommandManager.java Целия файл

@@ -414,15 +414,15 @@ public final class CommandManager {
414 414
      */
415 415
     public static Command getCommand(final String name) {
416 416
         if (getGlobalCommandByName(name) != null) {
417
-            return (Command) getGlobalCommandByName(name);
417
+            return getGlobalCommandByName(name);
418 418
         } else if (getServerCommandByName(name) != null) {
419
-            return (Command) getServerCommandByName(name);
419
+            return getServerCommandByName(name);
420 420
         } else if (getChannelCommandByName(name) != null) {
421
-            return (Command) getChannelCommandByName(name);
421
+            return getChannelCommandByName(name);
422 422
         } else if (getChatCommandByName(name) != null) {
423
-            return (Command) getChatCommandByName(name);
423
+            return getChatCommandByName(name);
424 424
         } else {
425
-            return (Command) getChannelCommandByName(name);
425
+            return getChannelCommandByName(name);
426 426
         }
427 427
     }
428 428
     

+ 0
- 1
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java Целия файл

@@ -30,7 +30,6 @@ import com.dmdirc.plugins.PluginManager;
30 30
 import com.dmdirc.ui.input.AdditionalTabTargets;
31 31
 import com.dmdirc.ui.interfaces.InputWindow;
32 32
 
33
-import java.util.Arrays;
34 33
 import java.util.List;
35 34
 
36 35
 /**

+ 1
- 1
src/com/dmdirc/config/ConfigTarget.java Целия файл

@@ -36,7 +36,7 @@ public final class ConfigTarget implements Comparable, Serializable {
36 36
     /** The possible target types. */
37 37
     public static enum TYPE {
38 38
         GLOBALDEFAULT, GLOBAL, THEME, PROFILE, IRCD, NETWORK, SERVER, CHANNEL,
39
-    };
39
+    }
40 40
     
41 41
     /**
42 42
      * A version number for this class. It should be changed whenever the class

+ 1
- 1
src/com/dmdirc/config/IdentityManager.java Целия файл

@@ -110,7 +110,7 @@ public final class IdentityManager {
110 110
             }
111 111
         }
112 112
         
113
-        if (dir == null || dir.listFiles() == null) {
113
+        if (dir.listFiles() == null) {
114 114
             Logger.userError(ErrorLevel.MEDIUM, "Unable to load user identity files");
115 115
         } else {
116 116
             for (File file : dir.listFiles()) {

+ 0
- 1
src/com/dmdirc/installer/LinuxInstaller.java Целия файл

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.installer;
24 24
 
25 25
 import com.dmdirc.installer.cliparser.CLIParser;
26
-import com.dmdirc.ui.swing.dialogs.wizard.TextStep;
27 26
 
28 27
 import java.io.PrintWriter;
29 28
 import java.io.IOException;

+ 0
- 1
src/com/dmdirc/installer/StepConfirm.java Целия файл

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.installer;
24 24
 
25 25
 import com.dmdirc.installer.Installer.ShortcutType;
26
-import com.dmdirc.installer.WindowsInstaller;
27 26
 import com.dmdirc.ui.swing.dialogs.wizard.SpecialStep;
28 27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
29 28
 import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;

+ 0
- 1
src/com/dmdirc/installer/StepSettings.java Целия файл

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.installer;
24 24
 
25 25
 import com.dmdirc.installer.Installer.ShortcutType;
26
-import com.dmdirc.installer.WindowsInstaller;
27 26
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28 27
 import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
29 28
 import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;

+ 0
- 2
src/com/dmdirc/installer/WindowsInstaller.java Целия файл

@@ -22,8 +22,6 @@
22 22
 
23 23
 package com.dmdirc.installer;
24 24
 
25
-import com.dmdirc.ui.swing.dialogs.wizard.TextStep;
26
-
27 25
 import java.io.File;
28 26
 
29 27
 /**

+ 0
- 1
src/com/dmdirc/parser/callbacks/CallbackOnChannelNickChanged.java Целия файл

@@ -24,7 +24,6 @@
24 24
 
25 25
 package com.dmdirc.parser.callbacks;
26 26
 
27
-import com.dmdirc.parser.ClientInfo;
28 27
 import com.dmdirc.parser.ChannelClientInfo;
29 28
 import com.dmdirc.parser.ChannelInfo;
30 29
 import com.dmdirc.parser.IRCParser;

+ 0
- 3
src/com/dmdirc/plugins/PluginClassLoader.java Целия файл

@@ -23,14 +23,11 @@
23 23
  */
24 24
 package com.dmdirc.plugins;
25 25
 
26
-import java.io.BufferedReader;
27 26
 import java.io.FileInputStream;
28 27
 import java.io.DataInputStream;
29 28
 import java.io.File;
30 29
 import java.io.IOException;
31 30
 
32
-import java.util.Hashtable;
33
-
34 31
 public class PluginClassLoader extends ClassLoader {
35 32
 	/** Directory where plugins are stored. */
36 33
 	String myDir;

+ 1
- 1
src/com/dmdirc/themes/ThemeManager.java Целия файл

@@ -69,7 +69,7 @@ public class ThemeManager {
69 69
             }
70 70
         }
71 71
         
72
-        if (dir == null || dir.listFiles() == null) {
72
+        if (dir.listFiles() == null) {
73 73
             Logger.userError(ErrorLevel.MEDIUM, "Unable to load themes");
74 74
         } else {
75 75
             for (File file : dir.listFiles()) {

+ 0
- 3
src/com/dmdirc/ui/dummy/DummyStatusBar.java Целия файл

@@ -23,13 +23,10 @@
23 23
 package com.dmdirc.ui.dummy;
24 24
 
25 25
 import com.dmdirc.ui.interfaces.StatusBar;
26
-import com.dmdirc.ui.interfaces.StatusErrorNotifier;
27 26
 import com.dmdirc.ui.interfaces.StatusMessageNotifier;
28 27
 
29 28
 import java.awt.Component;
30 29
 
31
-import javax.swing.Icon;
32
-
33 30
 /**
34 31
  * Dummy status bar, used for testing.
35 32
  */

+ 0
- 2
src/com/dmdirc/ui/interfaces/StatusBar.java Целия файл

@@ -24,8 +24,6 @@ package com.dmdirc.ui.interfaces;
24 24
 
25 25
 import java.awt.Component;
26 26
 
27
-import javax.swing.Icon;
28
-
29 27
 /**
30 28
  * Status bar interface.
31 29
  */

+ 1
- 1
src/com/dmdirc/ui/swing/DMDircEventQueue.java Целия файл

@@ -61,7 +61,7 @@ public final class DMDircEventQueue extends EventQueue {
61 61
             return;
62 62
         }
63 63
         
64
-        if (me == null || me.getComponent() == null) {
64
+        if (me.getComponent() == null) {
65 65
             return;
66 66
         }
67 67
         

+ 1
- 1
src/com/dmdirc/ui/swing/components/ColourChooser.java Целия файл

@@ -204,7 +204,7 @@ public final class ColourChooser extends JPanel implements ActionListener {
204 204
         for (int i = 0; i < listenerList.length; i += 2) {
205 205
             if (listenerList[i] == ActionListener.class) {
206 206
                 ((ActionListener) listenerList[i + 1]).actionPerformed(
207
-                        new ActionEvent((Object) this, 
207
+                        new ActionEvent(this, 
208 208
                         ActionEvent.ACTION_PERFORMED, command));
209 209
             }
210 210
         }

+ 1
- 1
src/com/dmdirc/ui/swing/components/PackingTable.java Целия файл

@@ -62,7 +62,7 @@ public class PackingTable extends JTable {
62 62
      */
63 63
     public PackingTable(final Object[][] rows, final Object[] cols,
64 64
             final boolean editable, final JScrollPane scrollPane) {
65
-        this((TableModel) new DefaultTableModel(rows, cols), editable, scrollPane);
65
+        this(new DefaultTableModel(rows, cols), editable, scrollPane);
66 66
     }
67 67
     
68 68
     /**

+ 1
- 1
src/com/dmdirc/ui/swing/components/SearchBar.java Целия файл

@@ -86,7 +86,7 @@ public final class SearchBar extends JPanel implements ActionListener,
86 86
         UP,
87 87
         /** Move down through the document. */
88 88
         DOWN,
89
-    };
89
+    }
90 90
     
91 91
     /** Line to search from. */
92 92
     private int line;

+ 1
- 2
src/com/dmdirc/ui/swing/components/SwingPreferencesPanel.java Целия файл

@@ -28,7 +28,6 @@ import com.dmdirc.logger.ErrorLevel;
28 28
 import com.dmdirc.logger.Logger;
29 29
 import com.dmdirc.ui.interfaces.PreferencesInterface;
30 30
 import com.dmdirc.ui.interfaces.PreferencesPanel;
31
-import com.dmdirc.ui.interfaces.PreferencesPanel.OptionType;
32 31
 import com.dmdirc.ui.swing.MainFrame;
33 32
 import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
34 33
 import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
@@ -568,7 +567,7 @@ public final class SwingPreferencesPanel extends StandardDialog implements
568 567
     /** {@inheritDoc} */
569 568
     public void display() {
570 569
         for (JPanel panel : categories.values()) {
571
-            if (!panels.contains((JPanel) panel.getComponent(1))) {
570
+            if (!panels.contains(panel.getComponent(1))) {
572 571
                 layoutGrid((JPanel) panel.getComponent(1), ((JPanel) panel
573 572
                         .getComponent(1)).getComponentCount() / 2, 2, SMALL_BORDER,
574 573
                         SMALL_BORDER, LARGE_BORDER, LARGE_BORDER);

+ 2
- 2
src/com/dmdirc/ui/swing/dialogs/channelsetting/ChannelSettingsDialog.java Целия файл

@@ -31,15 +31,15 @@ import com.dmdirc.ui.swing.components.StandardDialog;
31 31
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel;
32 32
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel.OptionType;
33 33
 import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
34
+
34 35
 import java.awt.GridBagConstraints;
35 36
 import java.awt.GridBagLayout;
36 37
 import java.awt.Insets;
37 38
 import java.awt.event.ActionEvent;
38 39
 import java.awt.event.ActionListener;
39
-import javax.swing.BorderFactory;
40
+
40 41
 import javax.swing.Box;
41 42
 import javax.swing.JButton;
42
-import javax.swing.JPanel;
43 43
 import javax.swing.JTabbedPane;
44 44
 import javax.swing.WindowConstants;
45 45
 

+ 0
- 2
src/com/dmdirc/ui/swing/dialogs/wizard/WizardDialog.java Целия файл

@@ -22,8 +22,6 @@
22 22
 
23 23
 package com.dmdirc.ui.swing.dialogs.wizard;
24 24
 
25
-import com.dmdirc.Main;
26
-import com.dmdirc.ui.swing.MainFrame;
27 25
 import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
28 26
 import com.dmdirc.ui.swing.components.StandardDialog;
29 27
 

+ 2
- 1
src/com/dmdirc/ui/swing/framemanager/ctrltab/CtrlTabFrameManager.java Целия файл

@@ -30,12 +30,13 @@ import com.dmdirc.ui.interfaces.FrameManager;
30 30
 import com.dmdirc.ui.interfaces.Window;
31 31
 import com.dmdirc.ui.swing.components.TreeScroller;
32 32
 import com.dmdirc.ui.swing.framemanager.tree.TreeViewModel;
33
+
33 34
 import java.awt.Color;
34 35
 import java.awt.event.ActionEvent;
35 36
 import java.io.Serializable;
36
-import java.util.Arrays;
37 37
 import java.util.HashMap;
38 38
 import java.util.Map;
39
+
39 40
 import javax.swing.AbstractAction;
40 41
 import javax.swing.JComponent;
41 42
 import javax.swing.JDesktopPane;

+ 1
- 1
src/com/dmdirc/ui/swing/textpane/TextPaneCanvas.java Целия файл

@@ -80,7 +80,7 @@ class TextPaneCanvas extends JPanel implements MouseInputListener,
80 80
         DRAG,
81 81
         /** Mouse released.*/
82 82
         RELEASE,
83
-    };
83
+    }
84 84
     
85 85
     /** position of the scrollbar. */
86 86
     private int scrollBarPosition;

+ 1
- 2
src/com/dmdirc/util/CipherUtils.java Целия файл

@@ -112,9 +112,8 @@ public final class CipherUtils {
112 112
             Logger.userError(ErrorLevel.LOW, "Unable to decrypt string: " + e.getMessage());
113 113
         } catch (UnsupportedEncodingException e) {
114 114
             Logger.userError(ErrorLevel.LOW, "Unable to decrypt string: " + e.getMessage());
115
-        } catch (IOException e) {
116
-            Logger.userError(ErrorLevel.LOW, "Unable to decrypt string: " + e.getMessage());
117 115
         }
116
+
118 117
         return null;
119 118
     }
120 119
     

+ 1
- 1
src/com/dmdirc/util/resourcemanager/ResourceManager.java Целия файл

@@ -50,7 +50,7 @@ public abstract class ResourceManager {
50 50
         JAR,
51 51
         /** No resource manager. */
52 52
         NONE,
53
-    };
53
+    }
54 54
     
55 55
     /**
56 56
      * Returns an appropriate instance of ResourceManager.

Loading…
Отказ
Запис