posts - 1,  comments - 25,  trackbacks - 0

For eclipse quick fix. There are lots of articles introduce how to add a marker but no reference to how to implement the Proposal .
Now i will give the solution:
First. Add the marker. It's the sample one:
1. Declare the marker extension point : org.eclipse.core.resources.markers, //Here should be clear: there are some args should be declared in pulg.in. xml file. which will be used in your code.
     and implement the IMarkerResolutionGenerator2 interface. //Generate the generator.
2. User IResource.createMarker(....) API to create the marker. // Here will give your delcared marker type.
3. Your editor must have a configure file which extends from SourceViewerConfiguration. There is a important API for our quick fix function is: getQuickAssistAssistant();
4. So you should implement the IQuickAssistAssistant, ( I extends from JavaCorrectionAssistant the in my code) and regesit it at step 4.
5. The class implement the IQuickAssistAssistant which will set a IQuickAssistProcessor instance for execute qiuck fix. API is setQuickAssistProcessor();
6. in IQuickAssistAssistant  interface the most important API is computeQuickAssistProposals(IQuickAssistInvocationContext). which will be return ICompletionProposal[]  this API is used to finish your business.
7. So some body will ask that when we will use the eclipse extension point : org.eclipse.ui.ide.markerResolution
   Now. see the  ICompletionProposal[]  return type at step 6? There have a implement class called MarkerResolutionProposal(), Let 's say it's constructor
 public MarkerResolutionProposal(IMarkerResolution resolution, IMarker marker)
 See here the org.eclipse.ui.ide.markerResolution extension point is used here. but the MarkerResolutionProposal seems only used in java syntax.
So if your have another grammer. please new a interface to extends from ICompletionProposal.
8. The details implement will be finished in class which implement IMarkerResolution. at run() API

If i have some time i will update some class diagram for this function.

posted on 2009-06-09 20:46 Daniel 阅读(434) 评论(0)  编辑  收藏 所属分类: Eclipse的相关

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(3)

随笔档案

文章分类

文章档案

相册

搜索

  •  

最新评论