eclipse重构功能:扩展点的使用

eclipse重构功能:扩展点的使用

ID:8813349

大小:76.50 KB

页数:5页

时间:2018-04-08

eclipse重构功能:扩展点的使用_第1页
eclipse重构功能:扩展点的使用_第2页
eclipse重构功能:扩展点的使用_第3页
eclipse重构功能:扩展点的使用_第4页
eclipse重构功能:扩展点的使用_第5页
资源描述:

《eclipse重构功能:扩展点的使用》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、Eclipse重构功能:扩展点的使用 Eclipse中提供了几个扩展点,方便扩展重构功能。   基本的重构功能有,   Rename,Move,Create,Delete,Copy.对应扩展点即为:org.eclipse.ltk.core.refactoring.renameParticipantsorg.eclipse.ltk.core.refactoring.moveParticipantsorg.eclipse.ltk.core.refactoring.createParticipantsorg.eclipse.ltk.core.refactoring.delet

2、eParticipantsorg.eclipse.ltk.core.refactoring.copyParticipants   以ReName为例,其余4项与ReName大同小异。   实现这个扩展点的基本语法:

3、TypeParticipant"   class="jp.co.intramart.app.producer.refactoring.TypeRenameParticipant">         这里默认对响应所有改名事件,如果需要过滤可以在元素中加以定义。不赘述。实现改名扩展的关键在实现类,必须是org.eclipse.ltk.core.refactoring.participants.RenameParticipant;的子类

4、   下面代码进行了简单的Eclipse重构功能实现。importorg.eclipse.core.resources.IFile;importorg.eclipse.core.resources.ResourcesPlugin;importorg.eclipse.core.runtime.CoreException;importorg.eclipse.core.runtime.IProgressMonitor;importorg.eclipse.core.runtime.OperationCanceledException;importorg.eclipse.ltk.

5、core.refactoring.Change;importorg.eclipse.ltk.core.refactoring.RefactoringStatus;importorg.eclipse.ltk.core.refactoring.TextFileChange;importorg.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;importorg.eclipse.ltk.core.refactoring.participants.RenameParticipant;importor

6、g.eclipse.text.edits.ReplaceEdit;publicclassTypeRenameParticipantextendsRenameParticipant{   publicTypeRenameParticipant(){   }   @Override   publicRefactoringStatuscheckConditions(IProgressMonitorpm,           CheckConditionsContextcontext)throwsOperationCanceledException{       returnn

7、ewRefactoringStatus();   }   @Override   publicChangecreateChange(IProgressMonitorpm)throwsCoreException,           OperationCanceledException{       IFilefile=ResourcesPlugin.getWorkspace().getRoot().getProject("a")               .getFile("a");       TextFileChangetextFi

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。