1 2 25 26 package org.aspectj.ajde.ui; 27 28 import org.aspectj.asm.*; 29 import java.util.List ; 30 31 34 public abstract class StructureViewNodeFactory { 35 36 private AbstractIconRegistry iconRegistry; 37 38 public StructureViewNodeFactory(AbstractIconRegistry iconRegistry) { 39 this.iconRegistry = iconRegistry; 40 } 41 42 public StructureViewNode createNode(StructureNode node) { 43 return createNode(node, null); 44 } 45 46 public StructureViewNode createNode(StructureNode node, List children) { 47 AbstractIcon icon; 48 if (node instanceof ProgramElementNode) { 49 ProgramElementNode pNode = (ProgramElementNode)node; 50 icon = iconRegistry.getStructureIcon(pNode.getProgramElementKind(), pNode.getAccessibility()); 51 } else if (node instanceof RelationNode) { 52 RelationNode relationNode = (RelationNode)node; 53 icon = iconRegistry.getRelationIcon(relationNode.getRelation()); 54 } else if (node instanceof LinkNode) { 55 LinkNode linkNode = (LinkNode)node; 56 icon = iconRegistry.getStructureIcon( 57 linkNode.getProgramElementNode().getProgramElementKind(), 58 linkNode.getProgramElementNode().getAccessibility()); 59 } else { 60 icon = new AbstractIcon(null); 61 } 62 return createConcreteNode(node, icon, children); 63 } 64 65 68 protected abstract StructureViewNode createConcreteNode(StructureNode node, AbstractIcon icon, List children); 69 } 70 | Popular Tags |