Refactor method programatically fails in subclass [message #1698218] |
Fri, 12 June 2015 05:22  |
Eclipse User |
|
|
|
I am using IMethod method
and calling method.rename(newName, true, new NullProgressMonitor());
It refactors interface method, but fails to refactor its implementation methods.
For example,
interface Animal {
void eat() ; // refactors here
}
class Dog implements Animal {
// fails to refactor this
void eat() {
}
}
Kindly help!
|
|
|
|
Re: Refactor method programatically fails in subclass [message #1698276 is a reply to message #1698245] |
Fri, 12 June 2015 13:57  |
Eclipse User |
|
|
|
Thanks for the immediate reply.
Java ver 1.7
Eclipse ver Luna 4.4.1
Actually IMethod.rename works & compiles fine with interface or class, but enables save button.
Funny it used to work earlier for sub classes also, not sure why its not working now.
If you can provide clean refactoring through other api's such as below
org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor
tried this also,
IntroduceIndirectionRefactoring refactoring = new IntroduceIndirectionRefactoring();
refactoring.setMethod(method);
refactoring.setUpdateReferences(true);
refactoring.setMethodName("shrikanth");
run(new IntroduceIndirectionWizard(refactoring , "Introduce Indirection"),
new Shell(), "Introduce Indirection");
//
Thanks,
Shrikanth N C
|
|
|
Powered by
FUDForum. Page generated in 0.03891 seconds