ExtractMethodRefactoring refactoring = new ExtractMethodRefactoring(
SelectionConverter.getInputAsCompilationUnit(editor),
((ITextSelection) selection).getOffset(),
((ITextSelection) selection).getLength());
try {
new RefactoringStarter().activate(refactoring,
new ExtractMethodWizard(refactoring), getShell(),
RefactoringMessages.ExtractMethod_name, false);
} catch (ModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.ExtractMethod_name,
RefactoringMessages.RenamePHPElementAction_exception);