Parcourir la source

Rename PreferencesManager to PreferencesDialogModel

Change-Id: Ied76e21fbf72039d47ec2b35b236149c13941645
Depends-On: Ia126a15b60e54c08c1e780676fe363821e9b7518
Reviewed-on: http://gerrit.dmdirc.com/1591
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.5b1
Chris Smith il y a 13 ans
Parent
révision
33bae9d01d

+ 2
- 2
src/com/dmdirc/actions/metatypes/ClientEvents.java Voir le fichier

28
 import com.dmdirc.commandparser.PopupType;
28
 import com.dmdirc.commandparser.PopupType;
29
 import com.dmdirc.config.ConfigManager;
29
 import com.dmdirc.config.ConfigManager;
30
 
30
 
31
-import com.dmdirc.config.prefs.PreferencesManager;
31
+import com.dmdirc.config.prefs.PreferencesDialogModel;
32
 import javax.swing.KeyStroke;
32
 import javax.swing.KeyStroke;
33
 import javax.swing.text.StyledDocument;
33
 import javax.swing.text.StyledDocument;
34
 
34
 
52
     /** Client event with an origin and editable buffer. */
52
     /** Client event with an origin and editable buffer. */
53
     CLIENT_EVENT_WITH_BUFFER(new String[]{"origin", "buffer"}, FrameContainer.class, StringBuffer.class),
53
     CLIENT_EVENT_WITH_BUFFER(new String[]{"origin", "buffer"}, FrameContainer.class, StringBuffer.class),
54
     /** Client event with preferences manager. */
54
     /** Client event with preferences manager. */
55
-    CLIENT_EVENT_WITH_PREFS(new String[]{"preferences manager"}, PreferencesManager.class),
55
+    CLIENT_EVENT_WITH_PREFS(new String[]{"preferences manager"}, PreferencesDialogModel.class),
56
     /** Client event with a styled doc. */
56
     /** Client event with a styled doc. */
57
     CLIENT_EVENT_WITH_STYLE(new String[]{"styled document", "start offset", "length"}, StyledDocument.class, Integer.class, Integer.class),
57
     CLIENT_EVENT_WITH_STYLE(new String[]{"styled document", "start offset", "length"}, StyledDocument.class, Integer.class, Integer.class),
58
     /** Unknown command event type. */
58
     /** Unknown command event type. */

src/com/dmdirc/config/prefs/PreferencesManager.java → src/com/dmdirc/config/prefs/PreferencesDialogModel.java Voir le fichier

42
  *
42
  *
43
  * @author chris
43
  * @author chris
44
  */
44
  */
45
-public class PreferencesManager {
45
+public class PreferencesDialogModel {
46
 
46
 
47
     /** The UI controller to use for custom categories. */
47
     /** The UI controller to use for custom categories. */
48
     private final UIController controller;
48
     private final UIController controller;
55
     private final ListenerList listeners = new ListenerList();
55
     private final ListenerList listeners = new ListenerList();
56
 
56
 
57
     /**
57
     /**
58
-     * Creates a new instance of PreferencesManager.
58
+     * Creates a new instance of PreferencesDialogModel.
59
      *
59
      *
60
      * @param controller The UI controller to use to retrieve custom UIs for
60
      * @param controller The UI controller to use to retrieve custom UIs for
61
      * preferences panels.
61
      * preferences panels.
62
      */
62
      */
63
-    public PreferencesManager(final UIController controller) {
63
+    public PreferencesDialogModel(final UIController controller) {
64
         this.controller = controller;
64
         this.controller = controller;
65
 
65
 
66
         addDefaultCategories();
66
         addDefaultCategories();

+ 2
- 2
src/com/dmdirc/plugins/Plugin.java Voir le fichier

22
 
22
 
23
 package com.dmdirc.plugins;
23
 package com.dmdirc.plugins;
24
 
24
 
25
-import com.dmdirc.config.prefs.PreferencesManager;
25
+import com.dmdirc.config.prefs.PreferencesDialogModel;
26
 import com.dmdirc.util.validators.ValidationResponse;
26
 import com.dmdirc.util.validators.ValidationResponse;
27
 import java.io.File;
27
 import java.io.File;
28
 
28
 
154
      * @param manager The preferences manager that configuration options
154
      * @param manager The preferences manager that configuration options
155
      * need to be added to.
155
      * need to be added to.
156
      */
156
      */
157
-    public void showConfig(final PreferencesManager manager) {
157
+    public void showConfig(final PreferencesDialogModel manager) {
158
     }
158
     }
159
 
159
 
160
     /**
160
     /**

+ 2
- 2
src/com/dmdirc/plugins/PluginManager.java Voir le fichier

27
 import com.dmdirc.actions.CoreActionType;
27
 import com.dmdirc.actions.CoreActionType;
28
 import com.dmdirc.actions.interfaces.ActionType;
28
 import com.dmdirc.actions.interfaces.ActionType;
29
 import com.dmdirc.config.IdentityManager;
29
 import com.dmdirc.config.IdentityManager;
30
-import com.dmdirc.config.prefs.PreferencesManager;
30
+import com.dmdirc.config.prefs.PreferencesDialogModel;
31
 import com.dmdirc.interfaces.ActionListener;
31
 import com.dmdirc.interfaces.ActionListener;
32
 import com.dmdirc.logger.ErrorLevel;
32
 import com.dmdirc.logger.ErrorLevel;
33
 import com.dmdirc.logger.Logger;
33
 import com.dmdirc.logger.Logger;
488
                 }
488
                 }
489
                 if (pi.isLoaded() || pi.isTempLoaded()) {
489
                 if (pi.isLoaded() || pi.isTempLoaded()) {
490
                     try {
490
                     try {
491
-                        pi.getPlugin().showConfig((PreferencesManager) arguments[0]);
491
+                        pi.getPlugin().showConfig((PreferencesDialogModel) arguments[0]);
492
                     } catch (LinkageError le) {
492
                     } catch (LinkageError le) {
493
                         Logger.userError(ErrorLevel.MEDIUM, "Error with plugin (" + pi.getNiceName() + "), unable to show config (" + le + ")", le);
493
                         Logger.userError(ErrorLevel.MEDIUM, "Error with plugin (" + pi.getNiceName() + "), unable to show config (" + le + ")", le);
494
                     } catch (Exception ex) {
494
                     } catch (Exception ex) {

+ 9
- 9
test/com/dmdirc/config/prefs/PreferencesManagerTest.java Voir le fichier

50
 
50
 
51
     @Test
51
     @Test
52
     public void testDefaults() {
52
     public void testDefaults() {
53
-        final PreferencesManager pm = new PreferencesManager(controller);
53
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
54
         assertNotNull(pm.getCategory("General"));
54
         assertNotNull(pm.getCategory("General"));
55
         assertNotNull(pm.getCategory("Connection"));
55
         assertNotNull(pm.getCategory("Connection"));
56
         assertNotNull(pm.getCategory("Messages"));
56
         assertNotNull(pm.getCategory("Messages"));
64
     @Test
64
     @Test
65
     public void testDismiss() {
65
     public void testDismiss() {
66
         final PreferencesCategory category = mock(PreferencesCategory.class);
66
         final PreferencesCategory category = mock(PreferencesCategory.class);
67
-        final PreferencesManager pm = new PreferencesManager(controller);
67
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
68
         pm.addCategory(category);
68
         pm.addCategory(category);
69
         pm.dismiss();
69
         pm.dismiss();
70
 
70
 
76
         final PreferencesCategory category = mock(PreferencesCategory.class);
76
         final PreferencesCategory category = mock(PreferencesCategory.class);
77
         when(category.save()).thenReturn(false);
77
         when(category.save()).thenReturn(false);
78
 
78
 
79
-        final PreferencesManager pm = new PreferencesManager(controller);
79
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
80
         pm.addCategory(category);
80
         pm.addCategory(category);
81
         assertFalse(pm.save());
81
         assertFalse(pm.save());
82
 
82
 
88
         final PreferencesCategory category = mock(PreferencesCategory.class);
88
         final PreferencesCategory category = mock(PreferencesCategory.class);
89
         when(category.save()).thenReturn(true);
89
         when(category.save()).thenReturn(true);
90
 
90
 
91
-        final PreferencesManager pm = new PreferencesManager(controller);
91
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
92
         pm.addCategory(category);
92
         pm.addCategory(category);
93
         assertTrue(pm.save());
93
         assertTrue(pm.save());
94
 
94
 
97
 
97
 
98
     @Test
98
     @Test
99
     public void testGetCategory() {
99
     public void testGetCategory() {
100
-        final PreferencesManager pm = new PreferencesManager(controller);
100
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
101
         assertNull(pm.getCategory("unittest123"));
101
         assertNull(pm.getCategory("unittest123"));
102
     }
102
     }
103
 
103
 
104
     @Test
104
     @Test
105
     public void testGetCategories() {
105
     public void testGetCategories() {
106
-        final PreferencesManager pm = new PreferencesManager(controller);
106
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
107
         assertNotNull(pm.getCategories());
107
         assertNotNull(pm.getCategories());
108
         assertFalse(pm.getCategories().isEmpty());
108
         assertFalse(pm.getCategories().isEmpty());
109
 
109
 
114
 
114
 
115
     @Test
115
     @Test
116
     public void testSaveListener() {
116
     public void testSaveListener() {
117
-        final PreferencesManager pm = new PreferencesManager(controller);
117
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
118
         final PreferencesInterface tpi = mock(PreferencesInterface.class);
118
         final PreferencesInterface tpi = mock(PreferencesInterface.class);
119
 
119
 
120
         pm.registerSaveListener(tpi);
120
         pm.registerSaveListener(tpi);
129
         ActionManager.init();
129
         ActionManager.init();
130
         ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_OPENED);
130
         ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_OPENED);
131
 
131
 
132
-        final PreferencesManager pm = new PreferencesManager(controller);
132
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
133
 
133
 
134
         verify(tal).processEvent(eq(CoreActionType.CLIENT_PREFS_OPENED),
134
         verify(tal).processEvent(eq(CoreActionType.CLIENT_PREFS_OPENED),
135
                 (StringBuffer) same(null), same(pm));
135
                 (StringBuffer) same(null), same(pm));
142
         ActionManager.init();
142
         ActionManager.init();
143
         ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_CLOSED);
143
         ActionManager.addListener(tal, CoreActionType.CLIENT_PREFS_CLOSED);
144
 
144
 
145
-        final PreferencesManager pm = new PreferencesManager(controller);
145
+        final PreferencesDialogModel pm = new PreferencesDialogModel(controller);
146
         pm.close();
146
         pm.close();
147
 
147
 
148
         verify(tal).processEvent(eq(CoreActionType.CLIENT_PREFS_CLOSED),
148
         verify(tal).processEvent(eq(CoreActionType.CLIENT_PREFS_CLOSED),

Chargement…
Annuler
Enregistrer