-
Notifications
You must be signed in to change notification settings - Fork 145
Browsing Checkstyle AST Tree for Java files visually
There are 2 ways to show Checkstyle AST tree for a Java file:
This is a simple plugin for Eclipse IDE which opens AST tree from right-click menu for selected Java resource.
- GitHub repo: https://github.com/sevntu-checkstyle/checkstyle-ast-eclipse-viewer
- Update site (link will not open in browser, use it in Eclipse):
http://sevntu-checkstyle.github.io/checkstyle-ast-eclipse-viewer/update-site
Supported Eclipse versions: 3.8+ .example of plugin installation
Checkstyle comes with Swing GUI app which shows AST tree for a given resource. To open i, you have to download latest Checkstyle jar file from http://sourceforge.net/projects/checkstyle/files/checkstyle/ (checkstyle-X.X-all.jar) and execute:
$ java -classpath checkstyle-X.X-all.jar com.puppycrawl.tools.checkstyle.gui.Main
Unix users could do all in more simple way: we have a nice shell script which shows AST tree automatically:
- Script source: https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/sh/ast.sh
Usage:
sevntu-checks/src/main/sh/ast.sh [<path_to_Java_file>]
Notes: when launched first time, this script downloads checkstyle-X.X-all.jar into your $TEMP dir and so, first script execution could be a bit longer then others =)
To simplify it even more, you could alias this script by adding line alias ast='< path_to_sh >'
to the end of your ~/.bashrc
file to let 'Show AST tree' command on your system look like ast <path_to_java_file>
or just ast
(which opens an empty Ast viewer window).