开发者

Namespace refactoring tool for Eclipse?

开发者 https://www.devze.com 2023-01-19 06:40 出处:网络
I\'m doing some housekeeping on some files, and I need to move some classes to a new namespace.Currently I have to manually edit the files, but I was wondering i开发者_开发问答f there\'s a more effici

I'm doing some housekeeping on some files, and I need to move some classes to a new namespace. Currently I have to manually edit the files, but I was wondering i开发者_开发问答f there's a more efficient way of doing this?

I heard about ReSharper for Visual Studio does what I need, but is there a similar tool for Eclipse?


is there a similar tool for Eclipse?

Nope.


The is no such capability in eclipse until today MARS 8.1 . However, what on can do is to manually search for occurrences of the classes.

  1. Select the class name that you want to refactor and to a File Search within the enclosing project.
  2. From the tabs select "File Search" and then press "Replace ..." , it will find all occurences and let you fill in the replacement text.
  3. Click "Preview" to see what is going to be applied and remove those actions that you do not wish that they be applied by unchecking them.

This should be sufficient. If you are using git you can always do git checkout -b _refactorme to feel safe and then merge your changes. In that manner if something went wrong you can always track the problem e.g. using git blame.


I'm not really sure if Eclipse does that but IntelliJ IDEA (from the same vendor as ReSharper) does have a refactoring to move classes between packages. It is available from Refactor > Migrate menu if I remember correctly.

0

精彩评论

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

关注公众号