Eclipse PDE: Custom QuickFix only available in Problems View?

心已入冬 提交于 2019-12-06 01:33:22

I have the same problem and I'm not sure, if this is the right way, but at least it works:

If you want to see your quick fixes in the source viewer you have to set an QuickAssistAssistant for it. In your class implementing SourceViewerConfiguration override getQuickAssistAssistant. You can instantiate org.eclipse.jface.text.quickassist.QuickAssistAssistant, but you have to set a QuickAssistProcessor, so implement the org.eclipse.jface.text.quickassist.IQuickAssistProcessor interface, especially computeQuickAssistProposals to return your quick fix proposals.

public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
  IQuickAssistAssistant quickAssist = new QuickAssistAssistant();
  quickAssist.setQuickAssistProcessor(new MyQuickAssistProcessor());
  quickAssist.setInformationControlCreator(getInformationControlCreator(sourceViewer));
  return quickAssist; 
}

Also have a look at the code in the last post here, it is a bit messy, but you will get it. And look at this code here for an example implementation of ICompletionProposal, which you will have to return in your QuickAssistProcessor.

If you simply add one line to the marker extension point:

<super type="org.eclipse.core.resources.textmarker"/>

and add attributes to the marker marker.setAttribute(IMarker.CHAR_START, ...); marker.setAttribute(IMarker.CHAR_END, ...);

You will be able get this:

But I still can't found how to change marker icon (to variant with bulb) a show possible quick fix also after click on the annotation icon.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!