1 19 20 package org.netbeans.modules.java.ui.nodes.elements; 21 22 import org.openide.nodes.Children; 23 import org.openide.nodes.Sheet; 24 import org.openide.src.ElementProperties; 25 import org.netbeans.jmi.javamodel.EnumConstant; 26 27 import java.util.Map ; 28 import java.util.HashMap ; 29 30 34 public final class EnumConstantNode extends ElementNode { 35 36 private static final Map mapAttributeName; 37 38 static { 39 mapAttributeName = new HashMap (1); 40 mapAttributeName.put(ElementProperties.PROP_NAME, ElementProperties.PROP_NAME); 41 } 42 43 public EnumConstantNode(EnumConstant element, Children children, boolean writeable) { 44 super(element, children, writeable); 45 setElementFormat0(getElementFormatProperty()); 46 } 47 48 protected String resolveIconBase() { 49 return IconStrings.ENUM_CONSTANT; 50 } 51 52 protected ElementFormat getHintElementFormat() { 53 return getSourceOptions().getConstantElementLongFormat(); 54 } 55 56 protected Map getAttributeNameMap() { 57 return mapAttributeName; 58 } 59 60 protected Sheet createSheet() { 61 Sheet s = Sheet.createDefault(); 62 Sheet.Set ps = s.get(Sheet.PROPERTIES); 63 ps.put(createNameProperty(getEnumConstant())); 64 return s; 65 } 66 67 private EnumConstant getEnumConstant() { 68 return (EnumConstant) this.element; 69 } 70 71 protected String [] getIconAffectingProperties() { 72 return new String [0]; 73 } 74 75 protected ElementFormat getElementFormatProperty() { 76 return getSourceOptions().getConstantElementFormat(); 77 } 78 } 79 | Popular Tags |