Re: Any simple way to deal with Exception(s)? / "quick-fixes"
Len Trigg <[email protected]> Fri, 30 Nov 2007 12:05:38 +1300
| Newsgroups | gmane.emacs.jdee |
|---|---|
| Organization | NetValue Ltd. |
| Message-ID | <hbbq9c4pq5.wl%[email protected]> |
At Thu, 29 Nov 2007 14:47:58 +0000, poppyer wrote: > When compiling, I often have some Exceptions which I forget to "catch". > Then for each one, I have to > 1) import the Exception class first If there are many of these, I usually import them all in one go (jde-import-all). > 2) a) adding a throws statement in the method declaration. > or b1) select the code block > b2) use C-c C-v t to add a try-catch block > b3) move the cursor to the catch block, and add the XXXException > manually. > > Since this procedure is quite repetitive, is there any simple way to do it? > > P.S. I also think about write my own elisp defun to do this, but I don't > know how to pick the XXXException from the compiling output. It would be really nice if there was a way to have a general "quick-fix" mechanism in jdee. Perhaps something where each quick fix defined a regexp to match on the current compilation error line to determine whether it should be active, plus an action to take if the user opts for that quick fix. Jdee would evaluate the set of active quick fixes whenever the currently selected error changes (updating a quick-fix menu). We could add to the suite of quick-fixes over time, and users could define their own. E.g: add throws to current method add catch block to existing try add try-catch block to selected region (Presumably the regexps would be dependent on whichever compiler the user is currently using, so there may need to be different lists for ecb vs javac vs jikes etc) Actually, searching through the archives, it seems Kai Grossjohann had started an initial version of this in 2004... (/me fervently waits for when jdee gets moved to sourceforge so we can make some progress on this) Cheers, Len.