1 19 package org.netbeans.modules.xml.core.settings; 20 21 import java.beans.*; 22 import java.awt.Image ; 23 import org.openide.util.Exceptions; 24 import org.openide.util.Utilities; 25 26 32 public class CoreSettingsBeanInfo extends SimpleBeanInfo { 33 34 private static final String ICON_DIR_BASE = "org/netbeans/modules/xml/core/resources/"; 36 37 44 public BeanDescriptor getBeanDescriptor() { 45 return new BeanDescriptor ( CoreSettings.class , null ); 46 } 47 48 60 public PropertyDescriptor[] getPropertyDescriptors() { 61 int PROPERTY_preferedShortEmptyElement = 0; 62 int PROPERTY_defaultAction = 1; 63 int PROPERTY_autoParsingDelay = 2; 64 PropertyDescriptor[] properties = new PropertyDescriptor[3]; 65 66 try { 67 properties[PROPERTY_preferedShortEmptyElement] = new PropertyDescriptor ( "preferedShortEmptyElement", CoreSettings.class, "isPreferedShortEmptyElement", "setPreferedShortEmptyElement" ); 68 properties[PROPERTY_preferedShortEmptyElement].setExpert ( true ); 69 properties[PROPERTY_preferedShortEmptyElement].setDisplayName ( Util.THIS.getString("PROP_preferedShortEmptyElement") ); 70 properties[PROPERTY_preferedShortEmptyElement].setShortDescription ( Util.THIS.getString("PROP_preferedShortEmptyElement_desc") ); 71 properties[PROPERTY_defaultAction] = new PropertyDescriptor ( "defaultAction", CoreSettings.class, "getDefaultAction", "setDefaultAction" ); 72 properties[PROPERTY_defaultAction].setExpert ( true ); 73 properties[PROPERTY_defaultAction].setDisplayName ( Util.THIS.getString("PROP_default_action") ); 74 properties[PROPERTY_defaultAction].setShortDescription ( Util.THIS.getString("PROP_default_action_hint") ); 75 properties[PROPERTY_defaultAction].setBound ( true ); 76 properties[PROPERTY_defaultAction].setPropertyEditorClass ( DefaultActionPropertyEditor.class ); 77 properties[PROPERTY_autoParsingDelay] = new PropertyDescriptor ( "autoParsingDelay", CoreSettings.class, "getAutoParsingDelay", "setAutoParsingDelay" ); 78 properties[PROPERTY_autoParsingDelay].setDisplayName ( Util.THIS.getString("PROP_AUTO_PARSING_DELAY") ); 79 properties[PROPERTY_autoParsingDelay].setShortDescription ( Util.THIS.getString("HINT_AUTO_PARSING_DELAY") ); 80 } 81 catch( IntrospectionException e) { 82 Exceptions.printStackTrace(e); 83 } 84 return properties; 85 } 86 87 94 public EventSetDescriptor[] getEventSetDescriptors() { 95 return new EventSetDescriptor[0]; 96 } 97 98 105 public MethodDescriptor[] getMethodDescriptors() { 106 return new MethodDescriptor[0]; 107 } 108 109 public Image getIcon (int type) { 110 if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || 111 (type == java.beans.BeanInfo.ICON_MONO_16x16)) { 112 113 return Utilities.loadImage (ICON_DIR_BASE + "coreSettings.gif"); } else { 115 return Utilities.loadImage (ICON_DIR_BASE + "coreSettings32.gif"); } 117 } 118 119 } 120 | Popular Tags |