Eclipse Extract Method 方法实现(二)

王朝java/jsp·作者佚名  2006-01-09
宽屏版  字体: |||超大  

Eclipse Extract Method 方法实现(二)

摘要:

前面的一篇文章本是抱着“分析Eclipse Extract Method的实现,为我所用。”的目的去看的。然后发现的Invoke部分好像是没戏了。看看代码分析的部分是否可以借鉴。

上一次我找到了实现Extract Method这个Function的是一个 ExtractMethodAction类。构造函数就不想多看了。直接跳到他的run函数里面看看。这个Action到底是如何工作的。

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);

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有