简体   繁体   English

在Eclipse中自定义Java编辑器

[英]Customize Java editor in Eclipse

I was wondering if there was a simple way to extend the features of the Java Editor in Eclipse for some custom project. 我想知道是否有一种简单的方法可以在Eclipse中为某些自定义项目扩展Java编辑器的功能。

Example : When I write in eclipse : 示例:当我在eclipse中写道时:

@Deprecated
public void foo();

foo will be automatically crossed-out and thus easy to notice. foo将自动划掉,因此很容易被注意到。 In some projects I would like to do the same with custom annotations like @Untested or @Verified to have a better dev environment (but of course, there are plenty of examples like this (special class colours, etc...). 在某些项目中,我想对自定义注释(如@Untested或@Verified)执行相同操作以获得更好的开发环境(但当然,有很多这样的示例(特殊类颜色等等)。

I wanted to create a simple eclipse bundle that extend this kinds of rules but I am unable to find an adequate extension point for this. 我想创建一个简单的eclipse包来扩展这种规则,但我无法为此找到足够的扩展点。 Do I have to create a new text editor from scratch ? 我是否必须从头开始创建新的文本编辑器?

Thanks for any help or comments, 感谢您的帮助或评论,

You will likely need to subclass and modify the JDT editor. 您可能需要子类化和修改JDT编辑器。 Have a look at the JDT source (org.eclipse.jdt.ui.* packages). 看一下JDT源代码(org.eclipse.jdt.ui。* packages)。 You can easily work in these with the classic Eclipse SDK as the JDT sources are provided. 随着JDT源代码的提供,您可以使用经典的Eclipse SDK轻松使用它们。 Use the Plugins view to pull these projects into your workspace so that you can edit them. 使用“插件”视图将这些项目拉入工作区,以便您可以编辑它们。 I don't think there is much documentation on working on the JDT source. 我认为有关JDT源的工作文档不多。 Do have a look at the parts of the Eclipse Help related to JDT though. 但是,请查看与JDT相关的Eclipse帮助部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM