Creating the CodeJohnny Code Generator Plugin for Eclipse was much easier than I anticipated thanks to the great out-of-the-box Eclipse support for plugin development. Eclipse includes several fully-functional Plugin example projects as well as a tutorial that walks you step-by-step through the process of creating a simple plugin.
The tutorial is excellent, but if you’ve been writing code for a while and learn primarily through seeing the source code, then the Eclipse Sample Plugin Projects are for you. We get to those from the Welcome Screen, then to Samples.
The samples demonstrate various types of IDE enhancements, so it’s a good bet that if you’ve got an idea for a plugin like I did with CodeJohnny, one of the samples will quickly get you on your way.
The projects will be created in your workbench and appear like any other Java Project.
You’ll run the project as an Eclipse Application. You can debug it as one, too, which is extremely great.
It’s a good idea to read the project’s HTML description before firing it up. The description HTML file is located in the project’s doc-html directory. The project description will list the functionality to expect and how you can activate it.
Here the Properties Example Plugin shows enhanced functionality with .USR files, creating a custom Properties View which works in sync with the Outline View.
Here’s an example of using an Eclipse Preferences form.
For CodeJohnny I used the MultiPage Editor Sample with its multiple editor tabs as the basis for my plugin.
With the plugin’s structure and functionality already in place, adding the Code Generation tie-in to the CodeJohnny Server library was just typing.