1 19 20 28 29 package org.netbeans.modules.xml.schema.abe.nodes; 30 31 import java.awt.Image ; 32 import org.netbeans.modules.xml.axi.AXIDocument; 33 import org.netbeans.modules.xml.axi.Attribute; 34 import org.netbeans.modules.xml.schema.model.GlobalAttribute; 35 import org.openide.nodes.AbstractNode; 36 import org.openide.nodes.Children; 37 import org.openide.nodes.Node; 38 import org.openide.util.NbBundle; 39 40 44 public class GlobalAttributesNode extends AbstractNode{ 45 46 47 public GlobalAttributesNode(ABEUIContext context, AXIDocument document){ 48 super(new GlobalAttributes(context, document)); 49 setName(NbBundle.getMessage(GlobalContentModelsNode.class, 50 "LBL_CategoryNode_GlobalAttributesNode")); 51 } 52 53 public boolean canRename() { 54 return false; 55 } 56 57 public boolean canDestroy() { 58 return false; 59 } 60 61 public boolean canCut() { 62 return false; 63 } 64 65 public boolean canCopy() { 66 return false; 67 } 68 69 public Image getOpenedIcon(int i) { 70 return org.netbeans.modules.xml.schema.ui.nodes.categorized. 71 CategorizedChildren.getBadgedFolderIcon(i, GlobalAttribute.class); 72 } 73 74 public Image getIcon(int i) { 75 return org.netbeans.modules.xml.schema.ui.nodes.categorized. 76 CategorizedChildren.getOpenedBadgedFolderIcon(i, GlobalAttribute.class); 77 } 78 79 80 81 private static class GlobalAttributes extends Children.Keys { 82 GlobalAttributes(ABEUIContext context, AXIDocument document) { 83 super(); 84 this.context = context; 85 this.document = document; 86 } 87 protected Node[] createNodes(Object key) { 88 if(key instanceof Attribute) { 89 Node node = context.getFactory().createNode(getNode(), (Attribute)key); 90 return new Node[] {node}; 91 } 92 assert false; 93 return new Node[]{}; 94 } 95 96 protected void addNotify() { 97 setKeys(document.getAttributes()); 98 } 99 100 private AXIDocument document; 101 private ABEUIContext context; 102 } 103 104 105 } 106 | Popular Tags |