Re: [nbusers] pmd-netbeans 0.6 released
Tor Norbye <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.tasklist.devel |
|---|---|
| Message-ID | <[email protected]> |
andrew wrote: > Hello Ole-Martin, > > I'm using PMD since it was created as NB-module. Indeed very useful > tool, thanks! > > If you have a moment to answer (if you have not... well, it is nice > too - you spend this time to improve the PMD :-), questions are: > > 1. Is it possible to _not_ open NB output window when "Everything ok" > (may be show this message in NB's status string instead)? > > 2. Have you plans to direct PMD's output to tasklist/SuggestionsView? > It may be excellent cooperation between two excellent modules. > > And thanks again, > Andrew Funny you should ask :) I was just working on this last weekend! I haven't contributed anything back to the PMD module yet since I'm still stabilizing the tasklist APIs, but I hope to get that done soon; I think I have a pretty good picture of what I need and what I don't need now. Here's how the PMD suggestions integration works: - it lists rule violations for the current file. When you switch files, it shows the suggestions for the new file. - it updates the suggestions a couple of seconds after editing a document. - for very simple cases, the suggestions have an associated "fix" action (double click) which will (you guessed it) fix the problem. This is done for duplicate imports, unused imports, unused fields and unused variables. It simply deletes the line reported in the rule. (This is a bit scary for unused fields and variables since you could have "int x, y" where only x is unused, and I'm deleting both. I'm thinking of ways to make it more robust; probably using the java-source elements API. I'm using that in my java-module integration which imports classes.) Suggestions which have an associated "fix" action have a little lightbulb next to the PMD icon - see screenshot. - let's you handle multiple suggestions in one run. So you can shift-select all N "unused import" warnings, right click and select "Fix", and they are all removed. For a screenshot of what this looks like, check out http://tasklist.netbeans.org/suggestions_v2.gif http://tasklist.netbeans.org/suggestions_v2_popup.gif (this is on OS X in case you're wondering about the fonts etc.) P.S. This isn't all in CVS yet. And it doesn't work on 3.4; I haven't had time to investigate why. I'll make an announcement when it's ready. -- Tor