我按照这个优秀教程构建了一个 JDT eclipse 插件,其中包含一个 AbstractHandler 。该插件通过单击按钮启动。但是,我希望有一个类可以在构建时通过注释处理器调用此插件。然而,如果可能的话,我如何以编程方式调用这个插件?
I have built out a JDT eclipse plugin that contains an AbstractHandler following this excellent tutorial. This plugin is launched by clicking a button. However, I wish to have a class that will invoke this plugin at build time via an annotation processor. Nevertheless, how can I programatically invoke this plugin, if at all possible?
发布评论
评论(1)
我认为您正在寻找 Compilation Participant 扩展点:
http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/compiler/CompilationParticipant .html
这个扩展点允许您插入到编译过程中。这就是 APT 与 JDT 挂钩的方式,但您可以使用编译参与者来获取构建开始的通知、获取正在构建的文件列表以及构建完成时的通知。您还可以将自己的问题标记添加到构建的文件中,以及执行许多其他操作。
I think you are looking for the Compilation Participant extension point:
http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/compiler/CompilationParticipant.html
This extension point allows you to plugin into the compilation process. It is how APT hooks into JDT, but you can use compilation participants to be notified of a build starting, get the list of files being built as well as be notified when a built is complete. You can also add your own problem markers to the built files, as well as do a number of other things.