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