Is there a feature in netbeans that’ll let me easily config and replace all occurrences of “system.out” and “e.printstacktrace” to “logger.info/error/log” ?
I used find/replace to get rid of all the “system.out”s, and now i need to get rid of all the “printstacktraces”, I can probably write a parser and read all my java files. But before I do that I just want to know if something like this is already implemented in netbeans, currently in netbeans 7.1 hints, they only show you where these things are, but I couldn’t find an option for code refactoring.
Thanks
The following will open each .java file that contains
printStackTracein vim.Of course you can substitute vim with your text editor of choice:
The first command creates an alias that returns all java files (starting in the current directory) that contain the first argument.
The second command says: open each file that contains the term
printStackTracewith vim.An even better solution would be to use sed to intelligently search/replace with a regex.