在eclipse插件中:我如何以编程方式突出显示java编辑器中的代码行? [英] In an eclipse plugin: How can I programmatically highlight lines of codes in the java editor?

查看:448
本文介绍了在eclipse插件中:我如何以编程方式突出显示java编辑器中的代码行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



为了实现我的目标,我正在尝试开发一个eclipse插件,它会对编译器中的代码进行一些文档检查。不要在eclipse中创建一个新的编辑器,我只想扩展默认的java编辑器,在(或突出显示)不满足某些预定要求的方法下绘制一行。



我需要创建一个PresentationReconciler吗?如果是,我如何使JDT或工作台使用我的协调员。



我从来没有做过插件开发,这是我的第一次尝试。

解决方案

您的几个起点:




  • 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.

这篇关于在eclipse插件中:我如何以编程方式突出显示java编辑器中的代码行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆