1 19 20 package org.netbeans.modules.xml.wsdl.ui.api.property; 21 22 import java.lang.reflect.InvocationTargetException ; 23 24 import org.netbeans.modules.xml.xam.ui.XAMUtils; 25 import org.openide.ErrorManager; 26 import org.openide.nodes.PropertySupport; 27 28 35 public class StringAttributeProperty extends PropertySupport.Reflection { 36 37 ExtensibilityElementPropertyAdapter adapter; 38 39 public StringAttributeProperty(ExtensibilityElementPropertyAdapter adapter, Class type, String getter, String setter) throws NoSuchMethodException { 40 super(adapter, type, getter, setter); 41 this.adapter = adapter; 42 } 43 44 45 @Override 46 public boolean isDefaultValue() { 47 try { 48 return getValue().equals(adapter.getDefaultValue()); 49 } catch (IllegalArgumentException e) { 50 ErrorManager.getDefault().notify(e); 51 } catch (IllegalAccessException e) { 52 ErrorManager.getDefault().notify(e); 53 } catch (InvocationTargetException e) { 54 ErrorManager.getDefault().notify(e); 55 } 56 return false; 57 } 58 59 @Override 60 public void restoreDefaultValue() throws IllegalAccessException , InvocationTargetException { 61 setValue(adapter.getDefaultValue()); 62 } 63 64 @Override 65 public boolean supportsDefaultValue() { 66 return adapter.supportsDefaultValue(); 67 } 68 69 @Override 70 public boolean canWrite() { 71 return XAMUtils.isWritable(adapter.getExtensibilityElement().getModel()); 72 } 73 74 75 76 77 } | Popular Tags |