Browse Source

Remove usages of deprecated method getCommandParser from InputWindow.

Fixes issue SWINGUI-35

Change-Id: I04ffd7e8392820a51d08a144edc876323c164c1b
Reviewed-on: http://gerrit.dmdirc.com/1515
Automatic-Compile: Gregory Holmes <greg@dmdirc.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.5
Greg Holmes 13 years ago
parent
commit
3c7acd4360

+ 2
- 1
src/com/dmdirc/addons/ui_dummy/DummyInputWindow.java View File

@@ -63,8 +63,9 @@ public class DummyInputWindow implements InputWindow {
63 63
 
64 64
     /** {@inheritDoc} */
65 65
     @Override
66
+    @Deprecated
66 67
     public CommandParser getCommandParser() {
67
-        return commandParser;
68
+        return getContainer().getCommandParser();
68 69
     }
69 70
 
70 71
     /** {@inheritDoc} */

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

@@ -125,7 +125,7 @@ public class TopicBar extends JComponent implements ActionListener,
125 125
                 getIcon("close-active"));
126 126
 
127 127
         final SwingInputHandler handler = new SwingInputHandler(topicText,
128
-                channelFrame.getCommandParser(), channelFrame);
128
+                channelFrame.getContainer().getCommandParser(), channelFrame);
129 129
         handler.setTypes(true, false, true, false);
130 130
         handler.setTabCompleter(channel.getTabCompleter());
131 131
 

+ 3
- 6
src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java View File

@@ -115,14 +115,11 @@ public final class ChannelFrame extends InputTextFrame implements ActionListener
115 115
                 .getChannelClients());
116 116
     }
117 117
 
118
-    /**
119
-     * Retrieves the command Parser for this command window.
120
-     *
121
-     * @return This window's command Parser
122
-     */
118
+    /** {@inheritDoc} */
123 119
     @Override
120
+    @Deprecated
124 121
     public CommandParser getCommandParser() {
125
-        return commandParser;
122
+        return getContainer().getCommandParser();
126 123
     }
127 124
 
128 125
     /** {@inheritDoc} */

+ 1
- 0
src/com/dmdirc/addons/ui_swing/components/frames/CustomInputFrame.java View File

@@ -65,6 +65,7 @@ public class CustomInputFrame extends InputTextFrame {
65 65
 
66 66
     /** {@inheritDoc} */
67 67
     @Override
68
+    @Deprecated
68 69
     @SuppressWarnings("unchecked")
69 70
     public final CommandParser getCommandParser() {
70 71
         return ((WritableFrameContainer<? extends InputWindow>) frameParent).getCommandParser();

+ 3
- 2
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java View File

@@ -474,8 +474,9 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
474 474
             } else {
475 475
                 menu.add(
476 476
                         new JMenuItem(
477
-                        new CommandAction(getCommandParser(),
478
-                        this, menuItem.getName(), menuItem.getCommand(arguments))));
477
+                        new CommandAction(getContainer().getCommandParser(),
478
+                        this, menuItem.getName(), menuItem.getCommand(
479
+                        arguments))));
479 480
             }
480 481
         }
481 482
         return menu;

+ 2
- 1
src/com/dmdirc/addons/ui_swing/components/frames/QueryFrame.java View File

@@ -64,8 +64,9 @@ public final class QueryFrame extends InputTextFrame implements QueryWindow {
64 64
 
65 65
     /** {@inheritDoc} */
66 66
     @Override
67
+    @Deprecated
67 68
     public CommandParser getCommandParser() {
68
-        return commandParser;
69
+        return getContainer().getCommandParser();
69 70
     }
70 71
 
71 72
     /**

+ 3
- 5
src/com/dmdirc/addons/ui_swing/components/frames/ServerFrame.java View File

@@ -72,13 +72,11 @@ public final class ServerFrame extends InputTextFrame implements ServerWindow,
72 72
         setInputHandler(new SwingInputHandler(getInputField(), commandParser, this));
73 73
     }
74 74
 
75
-    /**
76
-     * Retrieves the command Parser for this command window.
77
-     * @return This window's command Parser
78
-     */
75
+    /** {@inheritDoc} */
79 76
     @Override
77
+    @Deprecated
80 78
     public CommandParser getCommandParser() {
81
-        return commandParser;
79
+        return getContainer().getCommandParser();
82 80
     }
83 81
 
84 82
     /**

+ 73
- 48
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java View File

@@ -79,7 +79,18 @@ import java.nio.charset.IllegalCharsetNameException;
79 79
 import java.nio.charset.UnsupportedCharsetException;
80 80
 import java.util.concurrent.atomic.AtomicBoolean;
81 81
 
82
-import javax.swing.*;
82
+import javax.swing.BorderFactory;
83
+import javax.swing.JComponent;
84
+import javax.swing.JInternalFrame;
85
+import javax.swing.JMenu;
86
+import javax.swing.JMenuItem;
87
+import javax.swing.JPanel;
88
+import javax.swing.JPopupMenu;
89
+import javax.swing.JSeparator;
90
+import javax.swing.KeyStroke;
91
+import javax.swing.SwingUtilities;
92
+import javax.swing.UIManager;
93
+import javax.swing.WindowConstants;
83 94
 import javax.swing.event.InternalFrameEvent;
84 95
 import javax.swing.event.InternalFrameListener;
85 96
 import javax.swing.plaf.basic.BasicInternalFrameUI;
@@ -115,9 +126,9 @@ public abstract class TextFrame extends JInternalFrame implements Window,
115 126
     /** Are we closing? */
116 127
     private boolean closing = false;
117 128
     /** Command parser for popup commands. */
118
-    private CommandParser commandParser;
129
+    private final CommandParser commandParser;
119 130
     /** Swing controller. */
120
-    private SwingController controller;
131
+    private final SwingController controller;
121 132
     /** Are we maximising/restoring? */
122 133
     private AtomicBoolean maximiseRestoreInProgress = new AtomicBoolean(false);
123 134
     /** Content pane. */
@@ -161,8 +172,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
161 172
         setResizable(true);
162 173
         setIconifiable(true);
163 174
         setFocusable(true);
164
-        setPreferredSize(new Dimension(controller.getMainFrame().getWidth() / 2, controller.
165
-                getMainFrame().getHeight() / 3));
175
+        setPreferredSize(new Dimension(controller.getMainFrame().getWidth() / 2,
176
+                controller.getMainFrame().getHeight() / 3));
166 177
         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
167 178
 
168 179
         addPropertyChangeListener("UI", this);
@@ -186,7 +197,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
186 197
 
187 198
     /**
188 199
      * Locate the appropriate command parser in the window heirarchy.
189
-     * 
200
+     *
190 201
      * @return Closest command parser in the tree
191 202
      */
192 203
     private CommandParser findCommandParser() {
@@ -198,7 +209,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
198 209
                     inputWindow.getContainer().getParent());
199 210
         }
200 211
         if (inputWindow instanceof InputWindow) {
201
-            localParser = ((InputWindow) inputWindow).getCommandParser();
212
+            localParser = ((InputWindow) inputWindow).getContainer()
213
+                    .getCommandParser();
202 214
         }
203 215
 
204 216
         if (localParser == null) {
@@ -216,7 +228,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
216 228
 
217 229
     /**
218 230
      * {@inheritDoc}
219
-     * 
231
+     *
220 232
      * @deprecated Should use {@link FrameContainer#setTitle(java.lang.String)}
221 233
      */
222 234
     @Override
@@ -234,7 +246,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
234 246
 
235 247
     /**
236 248
      * {@inheritDoc}
237
-     * 
249
+     *
238 250
      * @deprecated Use {@link FrameContainer#getTitle()} instead
239 251
      */
240 252
     @Override
@@ -353,7 +365,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
353 365
                         setIcon(true);
354 366
                     }
355 367
                 } catch (PropertyVetoException ex) {
356
-                    Logger.userError(ErrorLevel.LOW, "Unable to minimise frame");
368
+                    Logger.userError(ErrorLevel.LOW,
369
+                            "Unable to minimise frame");
357 370
                 }
358 371
             }
359 372
         });
@@ -385,7 +398,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
385 398
                     setMaximum(true);
386 399
                     LOGGER.finest("maximise(): Done?");
387 400
                 } catch (PropertyVetoException ex) {
388
-                    Logger.userError(ErrorLevel.LOW, "Unable to minimise frame");
401
+                    Logger.userError(ErrorLevel.LOW,
402
+                            "Unable to minimise frame");
389 403
                 }
390 404
                 maximiseRestoreInProgress.set(false);
391 405
 
@@ -414,7 +428,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
414 428
                     }
415 429
                     setMaximum(false);
416 430
                 } catch (PropertyVetoException ex) {
417
-                    Logger.userError(ErrorLevel.LOW, "Unable to minimise frame");
431
+                    Logger.userError(ErrorLevel.LOW,
432
+                            "Unable to minimise frame");
418 433
                 }
419 434
                 maximiseRestoreInProgress.set(false);
420 435
             }
@@ -440,7 +455,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
440 455
 
441 456
     /**
442 457
      * {@inheritDoc}
443
-     * 
458
+     *
444 459
      * @deprecated Use corresponding methods in {@link FrameContainer} instead
445 460
      */
446 461
     @Override
@@ -451,7 +466,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
451 466
 
452 467
     /**
453 468
      * {@inheritDoc}
454
-     * 
469
+     *
455 470
      * @deprecated Use corresponding methods in {@link FrameContainer} instead
456 471
      */
457 472
     @Override
@@ -462,19 +477,21 @@ public abstract class TextFrame extends JInternalFrame implements Window,
462 477
 
463 478
     /**
464 479
      * {@inheritDoc}
465
-     * 
480
+     *
466 481
      * @deprecated Use corresponding methods in {@link FrameContainer} instead
467 482
      */
468 483
     @Override
469 484
     @Deprecated
470
-    public final void addLine(final StringBuffer messageType, final Object... args) {
485
+    public final void addLine(final StringBuffer messageType,
486
+            final Object... args) {
471 487
         frameParent.addLine(messageType, args);
472 488
     }
473 489
 
474 490
     /**
475 491
      * {@inheritDoc}
476
-     * 
477
-     * @deprecated Call {@link IRCDocument#clear()} via {@link FrameContainer#getDocument()}
492
+     *
493
+     * @deprecated Call {@link IRCDocument#clear()} via
494
+     * {@link FrameContainer#getDocument()}
478 495
      */
479 496
     @Override
480 497
     @Deprecated
@@ -542,13 +559,14 @@ public abstract class TextFrame extends JInternalFrame implements Window,
542 559
     /**
543 560
      * Removes and reinserts the border of an internal frame on maximising.
544 561
      * {@inheritDoc}
545
-     * 
562
+     *
546 563
      * @param event Property change event
547 564
      */
548 565
     @Override
549 566
     public final void propertyChange(final PropertyChangeEvent event) {
550 567
         LOGGER.finer("Property change: name: " + event.getPropertyName()
551
-                + " value: " + event.getOldValue() + "->" + event.getNewValue());
568
+                + " value: " + event.getOldValue() + "->"
569
+                + event.getNewValue());
552 570
         if ("UI".equals(event.getPropertyName())) {
553 571
             if (isMaximum()) {
554 572
                 hideTitlebar();
@@ -591,7 +609,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
591 609
                 final String componentUI = (String) UIManager.get(
592 610
                         "InternalFrameUI");
593 611
 
594
-                if ("javax.swing.plaf.synth.SynthLookAndFeel".equals(componentUI)) {
612
+                if ("javax.swing.plaf.synth.SynthLookAndFeel"
613
+                        .equals(componentUI)) {
595 614
                     temp = SynthLookAndFeel.createUI(TextFrame.this);
596 615
                 } else {
597 616
                     try {
@@ -642,7 +661,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
642 661
 
643 662
     /**
644 663
      * Not needed for this class. {@inheritDoc}
645
-     * 
664
+     *
646 665
      * @param event Internal frame event
647 666
      */
648 667
     @Override
@@ -652,7 +671,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
652 671
 
653 672
     /**
654 673
      * Not needed for this class. {@inheritDoc}
655
-     * 
674
+     *
656 675
      * @param event Internal frame event
657 676
      */
658 677
     @Override
@@ -670,7 +689,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
670 689
 
671 690
     /**
672 691
      * Not needed for this class. {@inheritDoc}
673
-     * 
692
+     *
674 693
      * @param event Internal frame event
675 694
      */
676 695
     @Override
@@ -680,7 +699,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
680 699
 
681 700
     /**
682 701
      * Makes the internal frame invisible. {@inheritDoc}
683
-     * 
702
+     *
684 703
      * @param event Internal frame event
685 704
      */
686 705
     @Override
@@ -696,7 +715,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
696 715
 
697 716
     /**
698 717
      * Not needed for this class. {@inheritDoc}
699
-     * 
718
+     *
700 719
      * @param event Internal frame event
701 720
      */
702 721
     @Override
@@ -706,7 +725,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
706 725
 
707 726
     /**
708 727
      * Activates the input field on frame focus. {@inheritDoc}
709
-     * 
728
+     *
710 729
      * @param event Internal frame event
711 730
      */
712 731
     @Override
@@ -731,7 +750,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
731 750
 
732 751
     /**
733 752
      * Not needed for this class. {@inheritDoc}
734
-     * 
753
+     *
735 754
      * @param event Internal frame event
736 755
      */
737 756
     @Override
@@ -749,7 +768,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
749 768
 
750 769
     /**
751 770
      * {@inheritDoc}
752
-     * 
771
+     *
753 772
      * @deprecated Use {@link FrameContainer#getConfigManager()}
754 773
      */
755 774
     @Deprecated
@@ -768,7 +787,7 @@ public abstract class TextFrame extends JInternalFrame implements Window,
768 787
     }
769 788
 
770 789
     /**
771
-     * {@inheritDoc} 
790
+     * {@inheritDoc}
772 791
      *
773 792
      * @deprecated Use {@link FrameContainer#getTranscoder()} instead
774 793
      */
@@ -819,7 +838,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
819 838
                     if (ActionManager.processEvent(
820 839
                             CoreActionType.LINK_URL_CLICKED, null, this,
821 840
                             clicktype.getValue())) {
822
-                        URLHandler.getURLHander().launchApp(clicktype.getValue());
841
+                        URLHandler.getURLHander().launchApp(
842
+                                clicktype.getValue());
823 843
                     }
824 844
                     break;
825 845
                 case NICKNAME:
@@ -839,42 +859,42 @@ public abstract class TextFrame extends JInternalFrame implements Window,
839 859
 
840 860
     /**
841 861
      * What popup type should be used for popup menus for nicknames
842
-     * 
862
+     *
843 863
      * @return Appropriate popuptype for this frame
844 864
      */
845 865
     public abstract PopupType getNicknamePopupType();
846 866
 
847 867
     /**
848 868
      * What popup type should be used for popup menus for channels
849
-     * 
869
+     *
850 870
      * @return Appropriate popuptype for this frame
851 871
      */
852 872
     public abstract PopupType getChannelPopupType();
853 873
 
854 874
     /**
855 875
      * What popup type should be used for popup menus for hyperlinks
856
-     * 
876
+     *
857 877
      * @return Appropriate popuptype for this frame
858 878
      */
859 879
     public abstract PopupType getHyperlinkPopupType();
860 880
 
861 881
     /**
862 882
      * What popup type should be used for popup menus for normal clicks
863
-     * 
883
+     *
864 884
      * @return Appropriate popuptype for this frame
865 885
      */
866 886
     public abstract PopupType getNormalPopupType();
867 887
 
868 888
     /**
869 889
      * A method called to add custom popup items.
870
-     * 
890
+     *
871 891
      * @param popupMenu Popup menu to add popup items to
872 892
      */
873 893
     public abstract void addCustomPopupItems(final JPopupMenu popupMenu);
874 894
 
875 895
     /**
876
-     * Shows a popup menu at the specified point for the specified click type
877
-     * 
896
+     * Shows a popup menu at the specified point for the specified click type.
897
+     *
878 898
      * @param type ClickType Click type
879 899
      * @param point Point Point of the click
880 900
      * @param argument Word under the click
@@ -885,7 +905,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
885 905
 
886 906
         switch (type.getType()) {
887 907
             case CHANNEL:
888
-                popupMenu = getPopupMenu(getChannelPopupType(), type.getValue());
908
+                popupMenu = getPopupMenu(getChannelPopupType(),
909
+                        type.getValue());
889 910
                 popupMenu.add(new ChannelCopyAction(type.getValue()));
890 911
                 if (popupMenu.getComponentCount() > 1) {
891 912
                     popupMenu.addSeparator();
@@ -893,7 +914,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
893 914
 
894 915
                 break;
895 916
             case HYPERLINK:
896
-                popupMenu = getPopupMenu(getHyperlinkPopupType(), type.getValue());
917
+                popupMenu = getPopupMenu(getHyperlinkPopupType(),
918
+                        type.getValue());
897 919
                 popupMenu.add(new HyperlinkCopyAction(type.getValue()));
898 920
                 if (popupMenu.getComponentCount() > 1) {
899 921
                     popupMenu.addSeparator();
@@ -901,7 +923,8 @@ public abstract class TextFrame extends JInternalFrame implements Window,
901 923
 
902 924
                 break;
903 925
             case NICKNAME:
904
-                popupMenu = getPopupMenu(getNicknamePopupType(), type.getValue());
926
+                popupMenu = getPopupMenu(getNicknamePopupType(),
927
+                        type.getValue());
905 928
                 if (popupMenu.getComponentCount() > 0) {
906 929
                     popupMenu.addSeparator();
907 930
                 }
@@ -935,10 +958,10 @@ public abstract class TextFrame extends JInternalFrame implements Window,
935 958
 
936 959
     /**
937 960
      * Builds a popup menu of a specified type
938
-     * 
961
+     *
939 962
      * @param type type of menu to build
940 963
      * @param arguments Arguments for the command
941
-     * 
964
+     *
942 965
      * @return PopupMenu
943 966
      */
944 967
     public JPopupMenu getPopupMenu(
@@ -956,12 +979,12 @@ public abstract class TextFrame extends JInternalFrame implements Window,
956 979
     }
957 980
 
958 981
     /**
959
-     * Populates the specified popupmenu
960
-     * 
982
+     * Populates the specified popupmenu.
983
+     *
961 984
      * @param menu Menu component
962 985
      * @param popup Popup to get info from
963 986
      * @param arguments Arguments for the command
964
-     * 
987
+     *
965 988
      * @return Populated popup
966 989
      */
967 990
     private JComponent populatePopupMenu(final JComponent menu,
@@ -1026,13 +1049,15 @@ public abstract class TextFrame extends JInternalFrame implements Window,
1026 1049
 
1027 1050
     /** {@inheritDoc} */
1028 1051
     @Override
1029
-    public void nameChanged(final FrameContainer<?> window, final String name) {
1052
+    public void nameChanged(final FrameContainer<?> window,
1053
+            final String name) {
1030 1054
         //Ignore
1031 1055
     }
1032 1056
 
1033 1057
     /** {@inheritDoc} */
1034 1058
     @Override
1035
-    public void titleChanged(final FrameContainer<?> window, final String title) {
1059
+    public void titleChanged(final FrameContainer<?> window,
1060
+            final String title) {
1036 1061
         UIUtilities.invokeLater(new Runnable() {
1037 1062
 
1038 1063
             /** {@inheritDoc} */

+ 3
- 2
src/com/dmdirc/addons/ui_swing/dialogs/paste/PasteDialog.java View File

@@ -124,8 +124,9 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
124 124
         textField.setColumns(50);
125 125
         textField.setRows(10);
126 126
 
127
-        new SwingInputHandler(textField, parent.getCommandParser(), parent)
128
-                .setTypes(false, false, true, false);
127
+        new SwingInputHandler(textField, parent.getContainer()
128
+                .getCommandParser(), parent)
129
+                .setTypes(false, false, true,false);
129 130
 
130 131
         scrollPane.setViewportView(textField);
131 132
         scrollPane.setVisible(false);

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

@@ -55,8 +55,9 @@ public class WebInputWindow extends WebWindow implements InputWindow {
55 55
 
56 56
     /** {@inheritDoc} */
57 57
     @Override
58
+    @Deprecated
58 59
     public CommandParser getCommandParser() {
59
-        return commandparser;
60
+        return getContainer().getCommandParser();
60 61
     }
61 62
 
62 63
     /** {@inheritDoc} */

Loading…
Cancel
Save