KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > j2ee > PluginOptionsBeanInfo


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  * PluginOptionsBeanInfo.java
21  *
22  * Created on December 13, 2004, 3:17 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.ide.j2ee;
26
27
28 import java.awt.Image JavaDoc;
29 import java.beans.BeanDescriptor JavaDoc;
30 import java.beans.BeanInfo JavaDoc;
31 import java.beans.IntrospectionException JavaDoc;
32 import java.beans.PropertyDescriptor JavaDoc;
33 import java.beans.SimpleBeanInfo JavaDoc;
34 import java.lang.Class JavaDoc;
35 import org.openide.util.NbBundle;
36 import org.netbeans.modules.j2ee.sun.ide.editors.CharsetDisplayPreferenceEditor;
37 import org.netbeans.modules.j2ee.sun.ide.editors.LoggingLevelEditor;
38 import org.openide.util.Utilities;
39
40 /**
41  *
42  * @author Andrei Badea
43  */

44 public class PluginOptionsBeanInfo extends SimpleBeanInfo JavaDoc {
45     public PropertyDescriptor JavaDoc[] getPropertyDescriptors() {
46 // PropertyDescriptor proot = createPropertyDescriptor("installRoot", "LBL_InstallRoot", "DSC_InstallRoot");//NOI18N
47
// proot.setValue("files", Boolean.FALSE); // only directories...
48
// proot.setValue("changeImmediate", Boolean.FALSE); // change on ok only...
49

50         PropertyDescriptor JavaDoc[] retValue = new PropertyDescriptor JavaDoc[] {
51             // TODO: from bundle
52
// createPropertyDescriptor("userList", "LBL_UserList", "DSC_UserList"), //NOI18N
53
// createPropertyDescriptor("groupList", "LBL_GroupList", "DSC_GroupList"),//NOI18N
54
createPropertyDescriptor("charsetDisplayPreference", "LBL_CharsetDispPref", "DSC_CharsetDispPref", CharsetDisplayPreferenceEditor.class),//NOI18N
55
createPropertyDescriptor("logLevel", "LBL_PluginLogLevel", "DSC_PluginLogLevel", LoggingLevelEditor.class),//NOI18N
56
createPropertyDescriptor("incrementalDeploy", "LBL_INCREMENTAL", "DSC_INCREMENTAL")//NOI18N
57
// proot
58

59         };
60         return retValue;
61     }
62     
63     private PropertyDescriptor JavaDoc createPropertyDescriptor(String JavaDoc name, String JavaDoc displayName, String JavaDoc shortDescription) {
64         return createPropertyDescriptor(name, displayName, shortDescription, null);
65     }
66     
67     private PropertyDescriptor JavaDoc createPropertyDescriptor(String JavaDoc name, String JavaDoc displayName, String JavaDoc shortDescription, Class JavaDoc editor) {
68         try {
69             PropertyDescriptor JavaDoc result = new PropertyDescriptor JavaDoc(name, PluginOptions.class);
70             result.setDisplayName(NbBundle.getMessage(PluginOptionsBeanInfo.class, displayName));
71             result.setShortDescription(NbBundle.getMessage(PluginOptionsBeanInfo.class, shortDescription));
72             if (editor != null)
73                 result.setPropertyEditorClass(editor);
74             return result;
75         }
76         catch (IntrospectionException JavaDoc e) {
77             return null;
78         }
79     }
80     
81     public BeanDescriptor JavaDoc getBeanDescriptor() {
82         BeanDescriptor JavaDoc retval = new BeanDescriptor JavaDoc(PluginOptions.class , null );
83         retval.setDisplayName(NbBundle.getMessage(PluginOptionsBeanInfo.class, "OpenIDE-Module-Name"));//NOI18N
84
return retval;
85     }
86     
87     public Image JavaDoc getIcon(int type) {
88         return Utilities.loadImage("org/netbeans/modules/j2ee/sun/ide/resources/sun-cluster_16_pad.gif"); // NOI18N
89
}
90 }
91
Popular Tags