| 1 2 25 26 package org.aspectj.ajde.ui.swing; 27 28 import java.awt.*; 29 import java.util.*; 30 import javax.swing.*; 31 import javax.swing.tree.*; 32 import org.aspectj.asm.*; 33 import org.aspectj.ajde.*; 34 import org.aspectj.ajde.ui.*; 35 36 39 class SwingTreeViewNodeRenderer extends DefaultTreeCellRenderer { 40 41 public Component getTreeCellRendererComponent(JTree tree, 42 Object treeNode, 43 boolean sel, 44 boolean expanded, 45 boolean leaf, 46 int row, 47 boolean hasFocus) { 48 if (treeNode == null) return null; 49 SwingTreeViewNode viewNode = (SwingTreeViewNode)treeNode; 50 StructureNode node = viewNode.getStructureNode(); 51 52 if (node instanceof LinkNode) { 53 if (((LinkNode)node).getProgramElementNode().getSourceLocation().getSourceFilePath() == null) { 54 setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_NO_SOURCE_COLOR); 55 } else { 56 setTextNonSelectionColor(AjdeWidgetStyles.LINK_NODE_COLOR); 57 } 58 } else { 59 setTextNonSelectionColor(new Color(0, 0, 0)); 60 } 61 62 super.getTreeCellRendererComponent(tree, treeNode, sel, expanded, leaf, row, hasFocus); 63 this.setFont(StructureTree.DEFAULT_FONT); 64 65 if (viewNode.getIcon() != null && viewNode.getIcon().getIconResource() != null) { 66 setIcon((Icon)viewNode.getIcon().getIconResource()); 67 } else { 68 setIcon(null); 69 } 70 71 if (node instanceof ProgramElementNode) { 72 ProgramElementNode pNode = (ProgramElementNode)node; 73 if (pNode.isRunnable()) { 74 } 76 if (pNode.isImplementor()) { 77 } 79 if (pNode.isOverrider()) { 80 } 82 } else if (node instanceof RelationNode) { 83 this.setFont(new Font(this.getFont().getName(), Font.ITALIC, this.getFont().getSize())); 84 } 85 86 if (node.getMessage() != null) { 87 if (node.getMessage().getKind().equals(StructureMessage.Kind.WARNING)) { 88 setIcon(AjdeUIManager.getDefault().getIconRegistry().getWarningIcon()); 89 } else if (node.getMessage().getKind().equals(StructureMessage.Kind.ERROR)) { 90 setIcon(AjdeUIManager.getDefault().getIconRegistry().getErrorIcon()); 91 } else { 92 setIcon(AjdeUIManager.getDefault().getIconRegistry().getInfoIcon()); 93 } 94 } 95 96 return this; 97 } 98 } 99 100 | Popular Tags |