When refactoring classes and methods JDT doesn’t change referenced resources, while it does when refactoring packages. I use the following code:
RefactoringContribution contrib = RefactoringCore.getRefactoringContribution(IJavaRefactorings.RENAME_COMPILATION_UNIT);
RenameJavaElementDescriptor desc = (RenameJavaElementDescriptor)contrib.createDescriptor();
desc.setUpdateReferences(true);
desc.setJavaElement(classToRename);
desc.setNewName(newName);
Refactoring ref = desc.createRefactoring(new RefactoringStatus());
IProgressMonitor monitor = new NullProgressMonitor();
Change change = refactoring.createChange(monitor);
change.perform(monitor);
an advice will help:
Well, I investigated JDT thoroughly and came to the following conclusion:
methods
methods because they are not referenced like packages i.e.
my.package.util is easy where MyClass has no reference and can be
present in more than one package.
But it can be done coming out of the known java frameworks like spring, hibernate *iBatis* resource files if JDT developers would give some time to it, but it will be still a whole lot of work and time spending.
The solution is to refactor yourself through IO streams by putting replacement/change conditions, but also it will be a lot of work.