views:

22

answers:

1

It is possible to implement the refactoring by using Eclipse library (JDT,LTK) without involving of the wizards. I would like to get benefit from refactoring feature of eclipse but I wan't to provide input for refactoring by other ways (that is not entering in the wizard) such as reading from file, etc.

If possible , Please suggest me how

A: 

You can find a sample in the JDT's SurroundWithTryCatchAction (eliding a lot of detail):

SurroundWithTryCatchRefactoring refactoring= SurroundWithTryCatchRefactoring.create(cu, selection);
Change change= refactoring.createChange(new NullProgressMonitor());
PerformChangeOperation op= new PerformChangeOperation(change);
WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(op);
PlatformUI.getWorkbench().getProgressService().runInUI(
  new BusyIndicatorRunnableContext(), adapter, adapter.getSchedulingRule());

The refactoring is set up entirely non-interactively through the create-helper.

ShiDoiSi