且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在eclipse插件中:我如何以编程方式突出显示java编辑器中的代码行?

更新时间:2023-09-23 18:26:58

您的几个起点:




  • a href =http://help.eclipse.org/juno/topic/org.eclipse.platform.doc.isv/guide/editors_annotations.htm?cp=2_0_13_3 =nofollow> 注释 JFace文本编辑器的UI功能,允许您在打开的编辑器中直观地标记某些地方。


  • 标记 是一个 Workbench 功能,更高级。它们是可能与Workbench资源相关联的通用对象,它们可以在多个位置显示:在文本编辑器(作为注释)中或在问题视图中显示。




根据您要做的事情,您可以将插件插入与其中任何一个相关的扩展点。


I am trying to develop an eclipse plugin that does some documentation check on java code and highlights some lines of code in the editor.

To achieve my goal, I DON'T want to create a new editor in eclipse, I simply want to extend the default java editor to draw a line under (or highlight) the methods that do not satisfy some set of predetermined requirements.

Do I need to create a PresentationReconciler? If yes, how do I make the JDT or workbench use my reconciler.

I have never done plugin development and this is my first attempt.

Several starting points for you:

  • Annotations are an UI feature of JFace's text editor that allows you to visually mark some places in an open editor.

  • Markers are a Workbench feature, more high-level. They are generic "objects that may be associated with Workbench resources", and they can display in several places: in text editors (as annotations) or in the Problems view, for example.

Depending on what you want to do, you would plug in your plug-in into extension points related to either of those.