need to programmatically invoke default eclipse refactoring actions [message #911288] |
Tue, 11 September 2012 09:53 |
Senthil Kumar Messages: 1 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am writing a plugin, where I identify certain code areas that are the candidates for refactoring. The particular lines are marked, and I am trying to provide marker resolutions, where I trigger particular refactoring (inline temp, extract constant, introduce parameter object etc.)
Currently I am using the internal API
import org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter;
import org.eclipse.jdt.internal.ui.actions.SelectionConverter;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
IMethod method = getSingleSelectedMethod(sel, editor);
System.out.println("method is " + method);
if (method != null) {
RefactoringExecutionStarter.startIntroduceParameterObject(method, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
}
Instead if I am able to use those action classes directly, it will be better. How do I can get those action objects, and call those run methods by passing the text selections.
Say I want to use InlineAction.run(ITextSelection). First I need to get the instance of InlineAction, then call the run method. From where can I get those action objects?
Any help is appreciated. Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.02523 seconds