简体   繁体   English

Eclipse重构

[英]Eclipse Refactoring

I am trying to change my code from Java Utility Logging to Log4J2. 我试图将我的代码从Java Utility Logging更改为Log4J2。 To change the code I want to use code refactoring in Eclipse. 要更改代码,我想在Eclipse中使用代码重构。 For example change : import java.util.logging.Logger; 例如更改:import java.util.logging.Logger; to import org.apache.logging.log4j.LogManager; 导入org.apache.logging.log4j.LogManager; Logger to LogManager. 记录到LogManager。 I am new to code refactoring in eclipse have not done so in large project with more than 1000 Classes. 我对eclipse中的代码重构是陌生的,在具有1000个以上类的大型项目中还没有这样做。 Can you please guide me how to go about it. 你能指导我如何去做吗?

That is beyond Eclipse's "Refactor" capabilities. 这超出了Eclipse的“重构”功能。 What can do is use the Search > File capabilities, which allows you to search and replace in your entire workspace or in selected packages. 可以使用“搜索”>“文件”功能,该功能使您可以在整个工作空间或选定的程序包中进行搜索和替换。 Look for an example in your code and use that as a pattern for your search. 在代码中查找示例,并将其用作搜索的模式。 Make sure the search pattern is as specific as possible, to avoid unwanted changes. 确保搜索模式尽可能具体,以避免不必要的更改。

Bottom line, it's still a manual process. 最重要的是,这仍然是手动过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM