1 19 20 package org.netbeans.modules.xml.schema.ui.nodes.schema; 21 22 import org.openide.nodes.Children; 23 import org.openide.nodes.Node.Property; 24 import org.openide.nodes.Sheet; 25 import org.openide.util.NbBundle; 26 27 import org.netbeans.modules.xml.schema.model.Enumeration; 28 import org.netbeans.modules.xml.schema.model.SchemaComponentReference; 29 import org.netbeans.modules.xml.schema.ui.nodes.SchemaComponentNode; 30 import org.netbeans.modules.xml.schema.ui.nodes.SchemaModelFlushWrapper; 31 import org.netbeans.modules.xml.schema.ui.nodes.SchemaUIContext; 32 import org.netbeans.modules.xml.schema.ui.nodes.schema.properties.BaseSchemaProperty; 33 34 39 public class EnumerationNode extends SchemaComponentNode<Enumeration> 40 { 41 45 public EnumerationNode(SchemaUIContext context, 46 SchemaComponentReference<Enumeration> reference, 47 Children children) { 48 super(context,reference,children); 49 setIconBaseWithExtension( 50 "org/netbeans/modules/xml/schema/ui/nodes/resources/enumeration.png"); 51 } 52 53 54 58 protected void updateDisplayName() { 59 setDisplayName("\""+getReference().get().getValue()+"\""); 60 } 61 62 63 67 @Override 68 public String getTypeDisplayName() { 69 return NbBundle.getMessage(EnumerationNode.class, 70 "LBL_EnumerationNode_TypeDisplayName"); } 72 73 @Override 74 protected Sheet createSheet() { 75 Sheet sheet = super.createSheet(); 76 Sheet.Set props = sheet.get(Sheet.PROPERTIES); 77 if (props == null) { 78 props = Sheet.createPropertiesSet(); 79 sheet.put(props); 80 } 81 try { 82 Property fixedProp = new BaseSchemaProperty( 84 getReference().get(), String .class, Enumeration.VALUE_PROPERTY, NbBundle.getMessage(EnumerationNode.class,"PROP_Facet_Value_DisplayName"), NbBundle.getMessage(EnumerationNode.class,"PROP_Enumeration_Value_ShortDescription"), null 90 ); 91 props.put(new SchemaModelFlushWrapper(getReference().get(), fixedProp)); 92 } catch (NoSuchMethodException nsme) { 93 assert false : "properties should be defined"; 94 } 95 96 return sheet; 97 } 98 } 99 | Popular Tags |