通过插件在 Eclipse 默认 Java 编辑器中自定义 UI 元素
我正在尝试为 Eclipse 开发一个插件,它允许我修改默认 java 文本编辑器中的各种元素。我找到了很多关于为不同语言创建自己的文本编辑器的教程,但没有找到用于编辑默认 java 编辑器的教程。具体来说,我希望能够运行命令并根据不同的程序突出显示代码的某些区域。我该如何开发这个?
谢谢
I'm trying to develop a plugin for Eclipse that will allow me to modify various elements within the default java text editor. I've found lots of tutorials for creating my own text editor for a different language, but nothing for editing the default java editor. Specifically, I want to be able to run a command and highlight certain areas of the code based on a different program. How do I develop this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将需要实现自己类型的标记,并可能将注释与它们相关联。然后您可以将java编辑器与注释关联起来以显示它们。您的应用程序将生成标记。
具体来说,您可能需要开始阅读
org.eclipse.core.resources.marker
扩展点和IResource.createMarker()
来创建标记。You will need to implement your own type of markers and maybe associate annotations with them. Then you can associate the java editor with the annotations to show them. Your application will generate the markers.
Specifically you might want to start to read about
org.eclipse.core.resources.marker
extension point andIResource.createMarker()
to create the markers.这是可行的。您需要找到合适的扩展点来向 java 编辑器添加功能。
请参阅 IBM 教程。标题为“如何分析 Java 代码以应用修改”的示例似乎就是您想要做的。
Its doable. You need to find the right extension point that allows you to add functionality to the java editor.
See IBM tutorial. The example with the heading "How do you analyze Java code to apply modifications" seems to be what you want to do.