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
      */
100
      */
101
     public boolean save() {
101
     public boolean save() {
102
         fireSaveListeners();
102
         fireSaveListeners();
103
-        
103
+
104
         boolean restart = false;
104
         boolean restart = false;
105
         for (PreferencesCategory category : categories) {
105
         for (PreferencesCategory category : categories) {
106
             if (category.save()) {
106
             if (category.save()) {
167
                 new OptionalValidator(new NumericalValidator(0, 100)), "ui", "pasteProtectionLimit",
167
                 new OptionalValidator(new NumericalValidator(0, 100)), "ui", "pasteProtectionLimit",
168
                 "Paste protection trigger", "Confirm pasting of text that " +
168
                 "Paste protection trigger", "Confirm pasting of text that " +
169
                 "contains more than this many lines."));
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
         final Map<String, String> taboptions = new HashMap<String, String>();
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
             taboptions.put(service.getName(), service.getName());
185
             taboptions.put(service.getName(), service.getName());
174
         }
186
         }
175
-        
187
+
176
         category.addSetting(new PreferencesSetting("tabcompletion", "style",
188
         category.addSetting(new PreferencesSetting("tabcompletion", "style",
177
                 "Tab completion style", "Determines the behaviour of " +
189
                 "Tab completion style", "Determines the behaviour of " +
178
                 "the tab completer when there are multiple matches", taboptions));
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
      * Creates and adds the "Advanced" category.
376
      * Creates and adds the "Advanced" category.
358
      */
377
      */
359
     private void addAdvancedCategory() {
378
     private void addAdvancedCategory() {
360
-        final PreferencesCategory category = new PreferencesCategory("Advanced", 
379
+        final PreferencesCategory category = new PreferencesCategory("Advanced",
361
                 "", "category-advanced");
380
                 "", "category-advanced");
362
 
381
 
363
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
382
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
373
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
392
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
374
                 "general", "logerrors", "Log errors to disk",
393
                 "general", "logerrors", "Log errors to disk",
375
                 "Save copies of all client errors to disk"));
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
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
395
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
380
                 "ui", "quickCopy", "Quick copy", "Automatically copy" +
396
                 "ui", "quickCopy", "Quick copy", "Automatically copy" +
381
                 " text that's selected when the mouse button is released"));
397
                 " text that's selected when the mouse button is released"));

Loading…
Cancel
Save