Browse Source

Add Tab Completion category to preferences and move all relavent settings into it

fixes issue 3919

Change-Id: Id6862ebbc85a8c4acc755a0defb0a30e8337becd
Reviewed-on: http://gerrit.dmdirc.com/1024
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.6.4rc1
Simon Mott 14 years ago
parent
commit
29eb9a354e
1 changed files with 25 additions and 9 deletions
  1. 25
    9
      src/com/dmdirc/config/prefs/PreferencesManager.java

+ 25
- 9
src/com/dmdirc/config/prefs/PreferencesManager.java View File

@@ -100,7 +100,7 @@ public class PreferencesManager {
100 100
      */
101 101
     public boolean save() {
102 102
         fireSaveListeners();
103
-        
103
+
104 104
         boolean restart = false;
105 105
         for (PreferencesCategory category : categories) {
106 106
             if (category.save()) {
@@ -167,17 +167,36 @@ public class PreferencesManager {
167 167
                 new OptionalValidator(new NumericalValidator(0, 100)), "ui", "pasteProtectionLimit",
168 168
                 "Paste protection trigger", "Confirm pasting of text that " +
169 169
                 "contains more than this many lines."));
170
-        
170
+
171
+        addTabCompletionCategory(category);
172
+        addCategory(category.setInlineAfter());
173
+    }
174
+
175
+    /**
176
+     * Creates and adds the "Tab Completion" category.
177
+     * @since 0.6.4
178
+     */
179
+    private void addTabCompletionCategory(PreferencesCategory parent) {
180
+        final PreferencesCategory category = new PreferencesCategory("Tab Completion", "");
171 181
         final Map<String, String> taboptions = new HashMap<String, String>();
172
-        for (Service service : PluginManager.getPluginManager().getServicesByType("tabcompletion")) {
182
+
183
+        for (Service service : PluginManager.getPluginManager()
184
+                .getServicesByType("tabcompletion")) {
173 185
             taboptions.put(service.getName(), service.getName());
174 186
         }
175
-        
187
+
176 188
         category.addSetting(new PreferencesSetting("tabcompletion", "style",
177 189
                 "Tab completion style", "Determines the behaviour of " +
178 190
                 "the tab completer when there are multiple matches", taboptions));
191
+        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
192
+                "tabcompletion", "casesensitive", "Case-sensitive tab completion",
193
+                "Respect case when tab completing"));
194
+        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
195
+                "tabcompletion", "allowempty", "Allow empty tab completion",
196
+                "Attempt to tab complete when the Tab key is pressed even " +
197
+                "if there is nothing to complete"));
179 198
 
180
-        addCategory(category);
199
+        parent.addSubCategory(category.setInline());
181 200
     }
182 201
 
183 202
     /**
@@ -357,7 +376,7 @@ public class PreferencesManager {
357 376
      * Creates and adds the "Advanced" category.
358 377
      */
359 378
     private void addAdvancedCategory() {
360
-        final PreferencesCategory category = new PreferencesCategory("Advanced", 
379
+        final PreferencesCategory category = new PreferencesCategory("Advanced",
361 380
                 "", "category-advanced");
362 381
 
363 382
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
@@ -373,9 +392,6 @@ public class PreferencesManager {
373 392
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
374 393
                 "general", "logerrors", "Log errors to disk",
375 394
                 "Save copies of all client errors to disk"));
376
-        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
377
-                "tabcompletion", "casesensitive", "Case-sensitive tab completion",
378
-                "Respect case when tab completing"));
379 395
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
380 396
                 "ui", "quickCopy", "Quick copy", "Automatically copy" +
381 397
                 " text that's selected when the mouse button is released"));

Loading…
Cancel
Save