1 19 20 26 27 package org.netbeans.modules.xml.schema.abe.nodes.properties; 28 29 import java.lang.reflect.InvocationTargetException ; 30 import java.net.URI ; 31 import java.net.URISyntaxException ; 32 import org.netbeans.modules.xml.axi.AXIComponent; 33 import org.netbeans.modules.xml.schema.ui.nodes.schema.SchemaNode; 34 import org.openide.ErrorManager; 35 import org.openide.util.NbBundle; 36 37 41 public class NamespaceProperty extends BaseABENodeProperty { 42 43 private String typeDisplayName; 44 54 public NamespaceProperty(AXIComponent component, 55 String property, String dispName, String desc, String typeDisplayName) 56 throws NoSuchMethodException { 57 super(component,String .class,property,dispName,desc,null); 58 this.typeDisplayName = typeDisplayName; 59 } 60 61 public void setValue(Object o) throws IllegalAccessException , InvocationTargetException { 62 if(o==null) { 63 super.setValue(null); 64 } else if(o instanceof String ) { 65 try { 66 new URI ((String ) o); 67 super.setValue(o); 68 } catch (URISyntaxException urse) { 69 String msg = NbBundle.getMessage(SchemaNode.class, "MSG_Invalid_URI",o); IllegalArgumentException iae = new IllegalArgumentException (msg); 71 ErrorManager.getDefault().annotate(iae, ErrorManager.USER, 72 msg, msg, urse, new java.util.Date ()); 73 throw iae; 74 } 75 } 76 } 77 81 @Override 82 public java.beans.PropertyEditor getPropertyEditor() { 83 return new NamespaceEditor((AXIComponent) super.getComponent(), typeDisplayName, 84 getDisplayName()); 85 } 86 87 } 88 | Popular Tags |