问题
I need to insert @Override / @Deprecated annotations and static modifiers automatically where necessary to all Java files of concrete project is opened in Eclipse IDE.
Eclipse has a great ability to insert @Override
/@Deprecate
annotations and add static modifiers on Java files saving (Preferences -> Java -> Editor -> Save actions -> Additional actions
). But Eclipse can apply these actions only on edited java file and only when saving it.
Sure, I can insert a tab or space into the each file using Eclipse as editor and save it to activate Eclipse refactoring tools on save action, but I have a very big code amount to process, so this is very nasty.
Maybe there is an Eclipse plugin which supports such type of code refactoring?
If there are no solutions, I`ll try to write my own Eclipse RCP plugin for that.
回答1:
- Right-click the project in the package explorer view -> a context menu appears
- In that menu, choose "Source" and then "Clean Up ..." -> the clean up dialog appears
- pick the desired actions, and click "Finish"
来源:https://stackoverflow.com/questions/14348385/how-to-add-override-deprecate-and-static-modifiers-to-methods-automatically-f