KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > editor > html > NbHTMLSettingsInitializer


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.editor.html;
21
22 import java.awt.event.KeyEvent JavaDoc;
23 import java.awt.event.InputEvent JavaDoc;
24 import java.util.Map JavaDoc;
25 import java.util.HashMap JavaDoc;
26 import javax.swing.KeyStroke JavaDoc;
27 import org.netbeans.editor.MultiKeyBinding;
28 import org.netbeans.editor.Settings;
29 import org.netbeans.editor.SettingsUtil;
30 import org.netbeans.editor.SettingsNames;
31 import org.netbeans.editor.ext.html.HTMLSettingsDefaults;
32 import org.netbeans.editor.ext.html.HTMLSettingsNames;
33
34 /**
35 * Nb settings for HTML.
36 *
37 * @author Miloslav Metelka
38 * @version 1.00
39 */

40
41 public class NbHTMLSettingsInitializer extends Settings.AbstractInitializer {
42
43     public static final String JavaDoc NAME = "nb-html-settings-initializer"; // NOI18N
44

45     public NbHTMLSettingsInitializer() {
46         super(NAME);
47     }
48
49     /** Update map filled with the settings.
50     * @param kitClass kit class for which the settings are being updated.
51     * It is always non-null value.
52     * @param settingsMap map holding [setting-name, setting-value] pairs.
53     * The map can be empty if this is the first initializer
54     * that updates it or if no previous initializers updated it.
55     */

56     public void updateSettingsMap(Class JavaDoc kitClass, Map JavaDoc settingsMap) {
57
58         if (kitClass == HTMLKit.class) {
59
60             settingsMap.put(SettingsNames.CODE_FOLDING_ENABLE, Boolean.TRUE);
61             
62             settingsMap.put(HTMLSettingsNames.CODE_FOLDING_UPDATE_TIMEOUT,
63                             HTMLSettingsDefaults.defaultCodeFoldingUpdateInterval);
64             
65             SettingsUtil.updateListSetting(settingsMap, SettingsNames.KEY_BINDING_LIST, getHTMLKeyBindings());
66             
67             
68         }
69
70     }
71
72     public MultiKeyBinding[] getHTMLKeyBindings() {
73         return new MultiKeyBinding[] {
74             new MultiKeyBinding(
75                 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK),
76                 HTMLKit.shiftInsertBreakAction
77             )
78         };
79     }
80
81 }
82
Popular Tags