1 19 20 package org.netbeans.modules.derby; 21 22 import java.awt.Image ; 23 import java.beans.BeanDescriptor ; 24 import java.beans.BeanInfo ; 25 import java.beans.IntrospectionException ; 26 import java.beans.PropertyDescriptor ; 27 import java.beans.SimpleBeanInfo ; 28 import org.openide.ErrorManager; 29 import org.openide.util.NbBundle; 30 import org.openide.util.Utilities; 31 32 36 public class DerbyOptionsBeanInfo extends SimpleBeanInfo { 37 38 public DerbyOptionsBeanInfo() { 39 } 40 41 public PropertyDescriptor [] getPropertyDescriptors() { 42 try { 43 PropertyDescriptor [] descriptors = new PropertyDescriptor [2]; 44 descriptors[0] = new PropertyDescriptor (DerbyOptions.PROP_DERBY_LOCATION, DerbyOptions.class); 45 descriptors[0].setDisplayName(NbBundle.getMessage(DerbyOptionsBeanInfo.class, "LBL_DerbyLocation")); 46 descriptors[0].setShortDescription(NbBundle.getMessage(DerbyOptionsBeanInfo.class, "HINT_DerbyLocation")); 47 descriptors[1] = new PropertyDescriptor (DerbyOptions.PROP_DERBY_SYSTEM_HOME, DerbyOptions.class); 48 descriptors[1].setDisplayName(NbBundle.getMessage(DerbyOptionsBeanInfo.class, "LBL_DatabaseLocation")); 49 descriptors[1].setShortDescription(NbBundle.getMessage(DerbyOptionsBeanInfo.class, "HINT_DatabaseLocation")); 50 return descriptors; 51 } catch (IntrospectionException ex) { 52 ErrorManager.getDefault().notify(ex); 53 return new PropertyDescriptor [0]; 54 } 55 } 56 57 public Image getIcon(int type) 58 { 59 Image image = null; 60 61 if (type == BeanInfo.ICON_COLOR_16x16) { 62 image = Utilities.loadImage("org/netbeans/modules/derby/resources/optionsIcon16.png"); } else if (type == BeanInfo.ICON_COLOR_32x32) { 64 image = Utilities.loadImage("org/netbeans/modules/derby/resources/optionsIcon32.png"); } 66 67 return image != null ? image : super.getIcon(type); 68 } 69 70 public BeanDescriptor getBeanDescriptor() { 71 BeanDescriptor descriptor = new BeanDescriptor (DerbyOptions.class); 72 descriptor.setName(NbBundle.getMessage(DerbyOptionsBeanInfo.class, "LBL_DerbyOptions")); 73 return descriptor; 74 } 75 } 76 | Popular Tags |