Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search

FAQ How do I implement an incremental project builder?

Revision as of 03:44, 2 May 2012 by (Talk | contribs) (Minor indention correction)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To implement an incremental project builder, you first have to create an extension for

         name="eScript Builder" 
         <run class="org.eclipse.escript.builder.Builder">
            <parameter name="optimize" value="true"/>
            <parameter name="comment" value="escript Builder"/>

The second step is to create a builder class that must extend the abstract IncrementalProjectBuilder superclass:

   public class Builder extends IncrementalProjectBuilder {   
      protected IProject[] build(int kind, Map args, 
       IProgressMonitor monitor) {
         if (kind == IncrementalProjectBuilder.FULL_BUILD) {
         } else {
            IResourceDelta delta = getDelta(getProject());
            if (delta == null) {
            } else {
               incrementalBuild(delta, monitor);
         return null;
      private void incrementalBuild(IResourceDelta delta, 
       IProgressMonitor monitor) {
         System.out.println("incremental build on "+delta);
         try {
            delta.accept(new IResourceDeltaVisitor() {
               public boolean visit(IResourceDelta delta) {
                  System.out.println("changed: "+
                  return true; // visit children too
         } catch (CoreException e) {
      private void fullBuild(IProgressMonitor monitor) {
         System.out.println("full build");

It is important to return true in the visit method for those folders that contain the resources of interest. If you return false, the children of the resource delta are not visited.

See Also:

FAQ How do I handle setup problems for a given builder?

This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top