Prevent Eclipse Java Builder from Compiling Java-Like Source

Posted by redjamjar on Programmers See other posts from Programmers or by redjamjar
Published on 2011-12-01T00:30:29Z Indexed on 2011/12/01 2:17 UTC
Read the original article Hit count: 375

Filed under:
|
|

I'm in the process of writing an eclipse plugin for my programming language Whiley (see http://whiley.org). The plugin is working reasonably well, although there's lots to do. Two pieces of the jigsaw are:

  • I've created a "Whiley Builder" by subclassing incremental project builder. This handles building and cleaning of "*.whiley" files.

  • I've created a content-type called "Whiley Source Files" for "*.whiley" files, which extends "org.eclipse.jdt.core.javaSource" (this follows Andrew Eisenberg suggestion).

The advantage of having the content-type extend javaSource is that it immediately fits into the package explorer, etc. In principle, I could fleshout ICompilationUnit to provide more useful info, although I haven't done that yet.

The disadvantage is that the Java builder is trying to compile my whiley files ... and it obviously can't. Originally, I had the Java Builder run first, then the Whiley builder. Superficially, this actually worked out quite well since all of the errors from the Java Builder were discarded by the Whiley Builder (for whiley files). However, I actually want the Whiley Builder to run first, as this is the best way for me to resolve dependencies between Java and Whiley files.

Which leads me to my question: can I stop the Java builder from trying to compile certain java-like resources? Specifically, in my case, those with the "*.whiley" extension. As an alternative, I was wondering whether my Whiley Builder could somehow update the resource delta to remove those files which it has dealt with.

Thoughts?

© Programmers or respective owner

Related posts about java

Related posts about eclipse