More Java posts
February 16, 2003
My First IntelliJ Plugin

I spend some time this weekend trying my hand at building an IntelliJ plugin. It's not ready for posting to the IntelliJ wiki yet but I'll link to it here. All it does is reproduce some functionality I previously built in emacs, the ability to insert a log4j logging statement that logs all of the parameter values passed to a method. It even inserts a field with a log4j Logger instance and the appropriate import statement if needed.

It was an interesting way to explore some of the IntelliJ plugin architecture, especially the program structure interface. This is a sort of abstract syntax tree, but including whitepace and comments, for the code being edited. It lets you pretty easily navigate the program structure and modify it. The downside it that it's completely undocumented and subject to change. The one thing I couldn't easily do was invoke the auto indent/reformat functions of the IDE. Theres a method called reformat on the CodeStyleManager instance but I couldn't get it to do anything. Any help greatfully received :)

Anyway, here's the plugin jar file and the source code. Enjoy.

Posted by Alex at February 16, 2003 09:29 PM
Comments
Thanks for publishing your plugin. Now I know how to use the logger. Greetz Thilo Posted by: Thilo on June 11, 2003 05:08 AM
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?