1 19 20 package org.netbeans.modules.xml.schema.abe.nodes.properties; 21 22 import java.lang.reflect.InvocationTargetException ; 23 import org.netbeans.modules.xml.axi.Element; 24 import org.netbeans.modules.xml.axi.Attribute; 25 import org.netbeans.modules.xml.axi.AXIComponent; 26 import org.netbeans.modules.xml.schema.abe.nodes.ABEAbstractNode; 27 import org.openide.ErrorManager; 28 import org.openide.util.NbBundle; 29 30 31 35 public class DefaultProperty extends BaseABENodeProperty { 36 37 38 public DefaultProperty(AXIComponent component, String propName, 39 String propDesc) throws NoSuchMethodException { 40 super(component,String .class,Element.PROP_DEFAULT, 41 propName,propDesc,StringEditor.class); 42 } 43 44 public void setValue(Object o) throws 45 IllegalAccessException , InvocationTargetException { 46 if(getComponent() instanceof Attribute) { 47 if (((Attribute)getComponent()).getFixed()==null) { 48 super.setValue(o); 49 } else { 50 throwError(); 51 } 52 } else if(getComponent() instanceof Element) { 53 if (((Element)getComponent()).getFixed()==null) { 54 super.setValue(o); 55 } else { 56 throwError(); 57 } 58 } 59 } 60 61 private void throwError(){ 62 String msg = NbBundle.getMessage(ABEAbstractNode.class, "MSG_Default_FixedAlreadySet"); IllegalArgumentException iae = new IllegalArgumentException (msg); 64 ErrorManager.getDefault().annotate(iae, ErrorManager.USER, 65 msg, msg, null, new java.util.Date ()); 66 throw iae; 67 68 } 69 70 } 71 | Popular Tags |