当前页面: 开发资料首页 → Eclipse 专题 → Eclipse Extract Method 方法实现(二)
摘要: Eclipse Extract Method 方法实现(二)
if (!ActionUtil.isProcessable(getShell(),
fEditor))
return;
try{
ExtractMethodRefactoring
refactoring=
ExtractMethodRefactoring.create(SelectionConverter.getInputAsCompilationUnit(fEditor),
selection.getOffset(), selection.getLength());
if
(refactoring == null)
return;
new
RefactoringStarter().activate(refactoring, new ExtractMethodWizard(refactoring),
getShell(), DIALOG_MESSAGE_TITLE, false);
}
catch (CoreException e){
ExceptionHandler.handle(e,
DIALOG_MESSAGE_TITLE, RefactoringMessages.NewTextRefactoringAction_exception);
}
</td></tr></table>