Skip to main content
Jump to: navigation, search

FAQ How do I add a builder to a given project?

Revision as of 09:52, 19 February 2007 by (Talk | contribs) (Remove unnecessary underscores)

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

To register the eScript builder for a given project, add the builder to the project’s build specification as follows:

   private void addBuilder(IProject project, String id) {
      IProjectDescription desc = project.getDescription();
      ICommand[] commands = desc.getBuildSpec();
      for (int i = 0; i < commands.length; ++i)
         if (commands[i].getBuilderName().equals(id))
      //add builder to project
      ICommand command = desc.newCommand();
      ICommand[] nc = new ICommand[commands.length + 1];
      // Add it before other builders.
      System.arraycopy(commands, 0, nc, 1, commands.length);
      nc[0] = command;
      project.setDescription(desc, null);

Alternatively, you could edit the project description directly on disk by modifying the .project file:

      <arguments> </arguments>

A builder is normally added to a project in the project creation wizard but can be added later on.

See Also:

FAQ How do I implement an incremental project 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