Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » need to programmatically invoke default eclipse refactoring actions
need to programmatically invoke default eclipse refactoring actions [message #911288] Tue, 11 September 2012 09:53
Senthil Kumar is currently offline Senthil KumarFriend
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
Previous Topic:Need help with .jar usage
Next Topic:I need help with recursive method calls
Goto Forum:
  


Current Time: Fri Dec 19 06:36:38 GMT 2014

Powered by FUDForum. Page generated in 0.04022 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software