KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > settings > JavaSettingsBeanInfo


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.java.settings;
21
22 import java.awt.Image JavaDoc;
23 import java.awt.Toolkit JavaDoc;
24 import java.beans.SimpleBeanInfo JavaDoc;
25 import java.beans.PropertyDescriptor JavaDoc;
26 import java.beans.IntrospectionException JavaDoc;
27 import java.beans.BeanDescriptor JavaDoc;
28
29 import org.openide.ErrorManager;
30 /**
31 *
32 * @author Ales Novak
33 */

34 public class JavaSettingsBeanInfo extends SimpleBeanInfo JavaDoc {
35
36     public BeanDescriptor JavaDoc getBeanDescriptor() {
37         BeanDescriptor JavaDoc desc = new BeanDescriptor JavaDoc(JavaSettings.class);
38         desc.setDisplayName(JavaSettings.getString("CTL_Java_option"));
39         /* for POST-FCS desc.setShortDescription(JavaSettings.getString("HINT_Java_option")); */
40         return desc;
41     }
42
43
44     /** Descriptor of valid properties
45     * @return array of properties
46     */

47     public PropertyDescriptor JavaDoc[] getPropertyDescriptors () {
48         try {
49             PropertyDescriptor JavaDoc[] desc = new PropertyDescriptor JavaDoc[] {
50                        new PropertyDescriptor JavaDoc (JavaSettings.PROP_REPLACEABLE_STRINGS_TABLE, JavaSettings.class),
51                        new PropertyDescriptor JavaDoc (JavaSettings.PROP_AUTO_PARSING_DELAY, JavaSettings.class),
52                        new PropertyDescriptor JavaDoc (JavaSettings.PROP_PARSING_ERRORS, JavaSettings.class),
53                        new PropertyDescriptor JavaDoc (JavaSettings.PROP_SHOW_COMPILE_STATUS, JavaSettings.class, "isCompileStatusEnabled", "enableCompileStatus"), // NOI18N
54
new PropertyDescriptor JavaDoc (JavaSettings.PROP_DEFAULT_ENCODING, JavaSettings.class),
55                        new PropertyDescriptor JavaDoc (JavaSettings.PROP_SHOW_OVERRIDING, JavaSettings.class)
56                    };
57
58             int index = 0;
59             
60             desc[index].setDisplayName (JavaSettings.getString("PROP_REPLACEABLE_STRINGS"));
61             desc[index].setShortDescription (JavaSettings.getString("HINT_REPLACEABLE_STRINGS"));
62             index++;
63             desc[index].setDisplayName (JavaSettings.getString("PROP_AUTO_PARSING_DELAY"));
64             desc[index].setShortDescription (JavaSettings.getString("HINT_AUTO_PARSING_DELAY"));
65             index++;
66             desc[index].setDisplayName (JavaSettings.getString("PROP_PARSING_ERRORS"));
67             desc[index].setShortDescription (JavaSettings.getString("HINT_PARSING_ERRORS"));
68             index++;
69             desc[index].setDisplayName(JavaSettings.getString("PROP_SHOW_COMPILE_STATUS"));
70             desc[index].setShortDescription(JavaSettings.getString("HINT_SHOW_COMPILE_STATUS"));
71             index++;
72             desc[index].setExpert(true);
73             desc[index].setDisplayName(JavaSettings.getString("PROP_DEFAULT_ENCODING"));
74             desc[index].setShortDescription(JavaSettings.getString("HINT_DEFAULT_ENCODING"));
75             index++;
76             desc[index].setDisplayName(JavaSettings.getString("PROP_SHOW_OVERRIDING"));
77             desc[index].setShortDescription(JavaSettings.getString("HINT_SHOW_OVERRIDING"));
78             return desc;
79         } catch (IntrospectionException JavaDoc ex) {
80         ErrorManager.getDefault().notify(ex);
81             return null;
82         }
83     }
84
85     /**
86     * Claim there are no icons available. You can override
87     * this if you want to provide icons for your bean.
88     */

89     public Image JavaDoc getIcon(int type) {
90         if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16)) {
91             return org.openide.util.Utilities.loadImage("org/netbeans/modules/java/resources/class.gif"); // NOI18N
92
} else { // 32
93
return org.openide.util.Utilities.loadImage("org/netbeans/modules/java/resources/class32.gif"); // NOI18N
94
}
95     }
96 }
97
Popular Tags