001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
011: * Microsystems, Inc. All Rights Reserved.
012:
013: If you wish your version of this file to be governed by only the CDDL
014: or only the GPL Version 2, indicate your decision by adding
015: "[Contributor] elects to include this software in this distribution
016: under the [CDDL or GPL Version 2] license." If you do not indicate a
017: single choice of license, a recipient has the option to distribute
018: your version of this file under either the CDDL, the GPL Version 2 or
019: to extend the choice of license to its licensees as provided above.
020: However, if you add GPL Version 2 code and therefore, elected the GPL
021: Version 2 license, then the option applies only if the new code is
022: made subject to such option by the copyright holder.
023:
024: If you wish your version of this file to be governed by only the CDDL
025: or only the GPL Version 2, indicate your decision by adding
026: "[Contributor] elects to include this software in this distribution
027: under the [CDDL or GPL Version 2] license." If you do not indicate a
028: single choice of license, a recipient has the option to distribute
029: your version of this file under either the CDDL, the GPL Version 2 or
030: to extend the choice of license to its licensees as provided above.
031: However, if you add GPL Version 2 code and therefore, elected the GPL
032: Version 2 license, then the option applies only if the new code is
033: made subject to such option by the copyright holder.
034: */
035:
036: package org.netbeans.modules.etl.ui;
037:
038: import java.awt.Image;
039: import java.beans.BeanInfo;
040: import java.beans.IntrospectionException;
041: import java.beans.Introspector;
042: import java.beans.PropertyDescriptor;
043: import java.beans.SimpleBeanInfo;
044:
045: import net.java.hulp.i18n.Logger;
046: import org.netbeans.modules.etl.logger.Localizer;
047: import org.netbeans.modules.etl.logger.LogUtil;
048: import org.openide.ErrorManager;
049: import org.openide.util.Utilities;
050:
051: /** Description of {@link WSDLDataLoader}.
052: *
053: * @author Jerry Waldorf
054: */
055: public class ETLDataLoaderBeanInfo extends SimpleBeanInfo {
056: private static transient final Logger mLogger = LogUtil
057: .getLogger(ETLDataLoaderBeanInfo.class.getName());
058: private static transient final Localizer mLoc = Localizer.get();
059: /**
060: * copied from Ant Module
061: */
062: String nbBundle1 = mLoc.t("PRSR001: MIME Type");
063: String nbBundle2 = mLoc
064: .t("PRSR001: The MIME type used for ETL files in the IDE. The ETL MIME resolver recognizes this.");
065:
066: public PropertyDescriptor[] getPropertyDescriptors() {
067: // Make extensions into a r/o property.
068: // It will only contain the WSDL MIME type.
069: // Customizations should be done on the resolver object, not on the extension list.
070: // Does not work to just use additional bean info from UniFileLoader and return one extensions
071: // property with no setter--Introspector cleverly (!&#$@&) keeps your display name
072: // and everything and adds back in the setter from the superclass.
073: // So bypass UniFileLoader in the beaninfo search.
074: try {
075: PropertyDescriptor extensions = new PropertyDescriptor(
076: "extensions", ETLDataLoader.class, "getExtensions",
077: null); // NOI18N
078: extensions.setDisplayName(Localizer.parse(nbBundle1));
079: extensions.setShortDescription(Localizer.parse(nbBundle2));
080: extensions.setExpert(true);
081: return new PropertyDescriptor[] { extensions };
082: } catch (IntrospectionException ie) {
083: ErrorManager.getDefault().notify(ie);
084: return null;
085: }
086: }
087:
088: // If you have additional properties:
089: /*
090: public PropertyDescriptor[] getPropertyDescriptors () {
091: try {
092: PropertyDescriptor myProp = new PropertyDescriptor ("myProp", MyDataLoader.class);
093: myProp.setDisplayName (NbBundle.getMessage (MyDataLoaderBeanInfo.class, "PROP_myProp"));
094: myProp.setShortDescription (NbBundle.getMessage (MyDataLoaderBeanInfo.class, "HINT_myProp"));
095: return new PropertyDescriptor[] { myProp };
096: } catch (IntrospectionException ie) {
097: TopManager.getDefault ().getErrorManager ().notify (ie);
098: return null;
099: }
100: }
101: */
102:
103: public BeanInfo[] getAdditionalBeanInfo() {
104: try {
105: // I.e. MultiFileLoader.class or UniFileLoader.class.
106: return new BeanInfo[] { Introspector
107: .getBeanInfo(ETLDataLoader.class.getSuperclass()) };
108: } catch (IntrospectionException ie) {
109: org.openide.ErrorManager.getDefault().notify(ie);
110: return null;
111: }
112: }
113:
114: public Image getIcon(int type) {
115: if (type == BeanInfo.ICON_COLOR_16x16
116: || type == BeanInfo.ICON_MONO_16x16) {
117: return Utilities
118: .loadImage("org/netbeans/modules/etl/ui/resources/images/ETLDefinition.png");
119: } else {
120: return Utilities
121: .loadImage("org/netbeans/modules/etl/ui/resources/images/ETLDefinition.png");
122: }
123: }
124:
125: }
|