Reputation: 1070
In my eclipse project I have dependencies that are imported like this:
import org.uimafit.util.JCasUtil;
However, there has been a namespace change in my dependent project (it moved to apache) such that I need to refactor these imports to look more like this:
import org.apache.uima.fit.JCasUtil;
I am using:
Eclipse Java EE IDE for Web Developers. Version: Mars.2 Release (4.5.2) Build id: 20160218-0600
Is there any way to automatically refactor all instances of imports of this type in Eclipse? Answers that include plugins, upgrading/changing my version of Eclipse are all acceptable.
Upvotes: 1
Views: 2820
Reputation: 787
In your project, you can create a package named org.uimafit.util
and then you create all the classes referred to by your imports: JCasUtil
, etc.
Then open the package explorer view > right-click on the package org.uimafit.util
> Refactor > Rename > enter org.apache.uima.fit
> and press the "OK" button.
Removed the org.apache.uima.fit
package from your project and you are done.
Upvotes: 0
Reputation: 1938
Go to Search --> File
, the search dialog will pop up.
In the containing text
text-field type the string you want to replace: import org.uimafit.util.JCasUtil;
In the File name patterns
type *.java
(the files you want to look into).
Then hit the Replace
button. It will find the text and another dialog will pop up, titled Replace text matches
. In the With
text field, type the new text: import org.apache.uima.fit.JCasUtil;
and hit the OK
button. It will replace all the matches.
Upvotes: 2