1 19 20 21 package org.netbeans.modules.i18n; 22 23 24 import java.awt.Image ; 25 import java.beans.BeanDescriptor ; 26 import java.beans.BeanInfo ; 27 import java.beans.IntrospectionException ; 28 import java.beans.SimpleBeanInfo ; 29 import java.beans.PropertyDescriptor ; 30 import java.util.ResourceBundle ; 31 32 import org.openide.util.NbBundle; 33 import org.openide.util.Utilities; 34 35 36 41 public class I18nOptionsBeanInfo extends SimpleBeanInfo { 42 43 45 public BeanDescriptor getBeanDescriptor() { 46 BeanDescriptor descr = new BeanDescriptor (I18nOptions.class); 47 descr.setDisplayName( 48 NbBundle.getMessage(I18nOptions.class, 49 "LBL_Internationalization")); return descr; 51 } 52 53 54 public PropertyDescriptor [] getPropertyDescriptors() { 55 try { 56 PropertyDescriptor advWizardPD = new PropertyDescriptor (I18nOptions.PROP_ADVANCED_WIZARD, I18nOptions.class); 57 PropertyDescriptor initCodePD = new PropertyDescriptor (I18nOptions.PROP_INIT_JAVA_CODE, I18nOptions.class); 58 PropertyDescriptor replaceCodePD = new PropertyDescriptor (I18nOptions.PROP_REPLACE_JAVA_CODE, I18nOptions.class); 59 PropertyDescriptor regExpPD = new PropertyDescriptor (I18nOptions.PROP_REGULAR_EXPRESSION, I18nOptions.class); 60 PropertyDescriptor i18nRegExpPD = new PropertyDescriptor (I18nOptions.PROP_I18N_REGULAR_EXPRESSION, I18nOptions.class); 61 PropertyDescriptor replaceValuePD = new PropertyDescriptor (I18nOptions.PROP_REPLACE_RESOURCE_VALUE, I18nOptions.class); 62 PropertyDescriptor lastResPD = new PropertyDescriptor (I18nOptions.PROP_LAST_RESOURCE2, I18nOptions.class); 63 64 initCodePD.setExpert(true); 66 replaceCodePD.setExpert(true); 67 regExpPD.setExpert(true); 68 i18nRegExpPD.setExpert(true); 69 70 lastResPD.setHidden(true); 72 73 ResourceBundle bundle = NbBundle.getBundle(I18nOptionsBeanInfo.class); 74 75 advWizardPD.setDisplayName(bundle.getString("TXT_AdvancedWizard")); 77 initCodePD.setDisplayName(bundle.getString("TXT_InitCodeFormat")); 78 replaceCodePD.setDisplayName(bundle.getString("TXT_ReplaceCodeFormat")); 79 regExpPD.setDisplayName(bundle.getString("TXT_RegularExpression")); 80 replaceValuePD.setDisplayName(bundle.getString("TXT_ReplaceResourceValue")); 81 i18nRegExpPD.setDisplayName(bundle.getString("TXT_I18nRegularExpression")); 82 83 advWizardPD.setShortDescription(bundle.getString("TXT_AdvancedWizardDesc")); 85 initCodePD.setShortDescription(bundle.getString("TXT_InitCodeFormatDesc")); 86 replaceCodePD.setShortDescription(bundle.getString("TXT_ReplaceCodeFormatDesc")); 87 regExpPD.setShortDescription(bundle.getString("TXT_RegularExpressionDesc")); 88 replaceValuePD.setShortDescription(bundle.getString("TXT_ReplaceResourceValueDesc")); 89 i18nRegExpPD.setShortDescription(bundle.getString("TXT_I18nRegularExpressionDesc")); 90 91 initCodePD.setPropertyEditorClass(HelpStringCustomEditor.InitCodeEditor.class); 93 replaceCodePD.setPropertyEditorClass(HelpStringCustomEditor.ReplaceCodeEditor.class); 94 regExpPD.setPropertyEditorClass(HelpStringCustomEditor.RegExpEditor.class); 95 i18nRegExpPD.setPropertyEditorClass(HelpStringCustomEditor.I18nRegExpEditor.class); 96 97 return new PropertyDescriptor [] { 98 advWizardPD, initCodePD, replaceCodePD, regExpPD, i18nRegExpPD, replaceValuePD, lastResPD 99 }; 100 } catch(IntrospectionException ie) { 101 return null; 102 } 103 } 104 105 106 public Image getIcon(int type) { 107 if ((type == BeanInfo.ICON_COLOR_16x16) || (type == BeanInfo.ICON_MONO_16x16)) { 108 return Utilities.loadImage("org/netbeans/modules/i18n/i18nAction.gif"); } else { return Utilities.loadImage("org/netbeans/modules/properties/propertiesKey32.gif"); } 112 } 113 114 } 115 | Popular Tags |