KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > gsf > GsfOptions


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 package org.netbeans.modules.gsf;
20
21 import org.netbeans.editor.SettingsNames;
22 import org.netbeans.modules.editor.options.BaseOptions;
23 import org.netbeans.modules.editor.options.OptionSupport;
24 //import org.netbeans.modules.gsf.GsfEditorKitFactory.ScriptEditorKit;
25
import org.openide.util.HelpCtx;
26 import org.openide.util.NbBundle;
27
28 import java.util.MissingResourceException JavaDoc;
29 import org.openide.filesystems.FileObject;
30
31 /**
32  *
33  * @author Administrator
34  */

35 public class GsfOptions extends BaseOptions {
36     
37     public static String JavaDoc LANGUAGES = "ScriptLanguages"; // NOI18N
38

39 // public static final String CODE_FOLDING_ENABLE_PROP = "codeFoldingEnable"; //NOI18N
40
//
41
//
42
// static final String[] LANGUAGES_PROP_NAMES = OptionSupport.mergeStringArrays (
43
// BaseOptions.BASE_PROP_NAMES,
44
// new String[] {
45
// CODE_FOLDING_ENABLE_PROP
46
// }
47
// );
48

49
50     public static final GsfOptions create(FileObject fo) {
51         String JavaDoc mimeType = fo.getParent().getPath().substring(8); //'Editors/'
52
// System.out.println("@@@ GsfOptions.create from " + fo.getPath() + " mimeType = '" + mimeType + "'");
53
return new GsfOptions(mimeType);
54     }
55  
56     /** Name of property. */
57     private static final String JavaDoc HELP_ID = "editing.editor.php"; // NOI18N
58

59     
60     private String JavaDoc mimeType;
61     
62     public GsfOptions(String JavaDoc mimeType) {
63         super(GsfEditorKitFactory.GsfEditorKit.class, LANGUAGES);
64         this.mimeType = mimeType;
65  // S ystem.out.println(this + " : " + getClass ().getClassLoader ());
66
// T hread.dumpStack();
67
}
68     
69     protected String JavaDoc getContentType() {
70         return mimeType;
71     }
72
73 // public boolean getCodeFoldingEnable() {
74
// return getSettingBoolean(SettingsNames.CODE_FOLDING_ENABLE);
75
// }
76
//
77
// public void setCodeFoldingEnable(boolean state) {
78
// setSettingBoolean(SettingsNames.CODE_FOLDING_ENABLE, state, CODE_FOLDING_ENABLE_PROP);
79
// }
80

81     /**
82      * Determines the class of the default indentation engine, in this case
83      * LanguagesIndentEngine.class
84      */

85 // protected Class getDefaultIndentEngineClass() {
86
// return LanguagesIndentEngine.class;
87
// }
88

89     /**
90      * Gets the help ID
91      */

92     public HelpCtx getHelpCtx() {
93         return new HelpCtx(HELP_ID);
94     }
95     
96     /**
97      * Look up a resource bundle message, if it is not found locally defer to
98      * the super implementation
99      */

100     protected String JavaDoc getString(String JavaDoc key) {
101         try {
102             return NbBundle.getMessage(GsfOptions.class, key);
103         } catch (MissingResourceException JavaDoc e) {
104             return super.getString(key);
105         }
106     }
107 }
108
Popular Tags