Source File Visualizers
By Geertjan-Oracle on Jan 15, 2008
Of them all, I've looked most closely at the latter of the three, recently. The basic framework of a visualizer can be extracted from that blog entry. Then one needs to incorporate some way of parsing the source in question. For HTML, you'd need some kind of HTML parser, etc. (By the way, the NetBeans APIs provide an HTML parser too, did you know that? See the HTML Lexer API, and the isHyperlinkPoint class in the NetBeans Hyperlink Navigation Tutorial.) If you want to parse XML files, see the NetBeans XML Editor Extension Module Tutorial, because that tutorial includes complete code for an XML parser. For parsing Java source files, the NetBeans Java Language Infrastructure Tutorial is incredibly useful. By combining the code from that tutorial with the information from Damir Tesanovic's blog entry, I made a visualizer for Java source files:
The visual scene shows information about the constructor, methods, and fields of a class. The scene is created when you right-click inside a Java source file and choose "Visualize". Then a new TopComponent opens, with a Visual Library API scene created within it, and then the nodes are added to the scene, with the pins added to the nodes.
If you are creating a visualizer, I recommend working backwards through the three blog entries listed above. Start with the one by Damir Tesanovic, then the one by Toni Epple, and then look through the one by Vadiraj Deshpande.