Search code examples
eclipse-plugineclipse-jdt

Eclipse Plugin - How can I call it from my Source code?


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?


Solution

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