站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Eclipse 专题Eclipse Extract Method 方法实现(二)

Eclipse Extract Method 方法实现(二)

摘要: Eclipse Extract Method 方法实现(二)
Eclipse Extract Method 方法实现(二)

摘要:
前面的一篇文章本是抱着“分析Eclipse Extract Method的实现,为我所用。”的目的去看的。然后发现的Invoke部分好像是没戏了。看看代码分析的部分是否可以借鉴。
上一次我找到了实现Extract Method这个Function的是一个 ExtractMethodAction类。构造函数就不想多看了。直接跳到他的run函数里面看看。这个Action到底是如何工作的。 <table width="650" cellspacing="1" cellpadding="1" border="1" align="" style=""><tr><td bgcolor="#999999">

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>


↑返回目录
前一篇: Eclipse3.1中的serialVersionUID警告
后一篇: Eclipse Extract Method 方法实现 (一)