Part 2 of this series was... November 12, 2014, i.e., Devoxx in Belgium in 2014, during which time I worked with Manfred Riem to create a plugin for NetBeans IDE to support his Devoxx presentation on MVC. Fast forward to today and here I am at Devoxx UK with Ivar Grimstad, working on the same plugin, though the MVC spec has changed quite a bit, requiring some new work on the plugin.
Ivar has a set of MVC samples here:
The simplest one looks like this in NetBeans IDE:
After some discussion at the Devoxx UK hackergarden run by Heather VanCura, Ivar and I have scoped out what the plugin should do. (And in the meantime there's also Gaurav Gupta's great JPA Modeler, which provides a bunch of related features too.)
Take a look at the "RESTful Web Services" node in the screenshot above. Right below that node, we want to create a "MVC Controllers" node. Within that node, we'd like to list all Java source files that have a class-level or at least one method-level annotation of type "javax.mvc.annotation.Controller". Within each of the Controller nodes, we want to list all the MVC methods, which are either (1) all the public methods in the class if @Controller is used at class-level or (2) the specific methods within the class annotated with @Controller, if the class does not have the @Controller annotation.
Also, as a secondary feature, a further simplified application based on the above shown application will be in the New Project wizard, instead of the old one that is currently there.
Here's the code from the original plugin, created with Manfred Riem, which will be the basis of the features described above:
A quick first attempt, simply tweaking a little bit without going into things too deeply, gives us the following:
As you can see, while the MVC Controller methods are shown, correctly, for "HelloController" (and can be double-clicked to get to the related source code), the other two Java source files shouldn't be there since they don't contain a @Controller annotation at all. So, right now (1) all the Java source files are shown regardless of whether they have the required annotation, while (2) methods are shown only if they have the annotation on them, not if the annotation is set on class-level.
So, it's a work in progress, though some way along already.
Update 1: As you can see below, the two other Java source files are now not shown anymore, because the plugin parses the Java source file and determines whether methods have a @Controller annotation and, if a Java source file has one such method, it is included in the "MVC Controllers" node, otherwise it is excluded.
The next step will be to add functionality to not only work with method-level @Controller annotations, but class-level @Controller annotations as well.
Update 2: Next, I can now display all the class members within a Java source file that has a class-level @Controller annotation:
The final step will be to only display public methods, not all class members, within a Java source file that has a @Controller annotation.
Update 3: Now it's working and here you can see the controllers within the class that contains them and nothing else:
Here's the plugin, install it into NetBeans IDE 8.1 to get the feature above:
Here it is in action on Ivar's system with a more complex sample app: