开发者

auto-import of packages across project in eclipse

开发者 https://www.devze.com 2023-01-01 10:37 出处:网络
I have used file search functionality in eclipse to replace a specific occurrence of text with a replace text which contains a java method name in all files across the workspace.

I have used file search functionality in eclipse to replace a specific occurrence of text with a replace text which contains a java method name in all files across the workspace.

But now in all those files I have to add the import statement (for the method name to resolve).

Is there an automatic way of doing this instead of manually searching and importing the package myself in all files?

P.S.: I can't use java refactoring since the text I have changed is not 开发者_StackOverflowa java element and Organize import option will make changes to lot of files (re-ordering imports) which will be problematic when I need to commit, I again have to manually check differences to see which files have actual changes instead of just organize import statements.


Instead of doing this with search and replace, try to use Refactor->rename which will do it correctly. another options is to use organize imports, you can do it for an entire project as well (source -> organize imports).

0

精彩评论

暂无评论...
验证码 换一张
取 消