## com.ibm.lab.soln.resources.nature_builder
Class ReadmeBuilder

    java.lang.Object
      |
      +--org.eclipse.core.internal.events.InternalBuilder
            |
            +--org.eclipse.core.resources.IncrementalProjectBuilder
                  |
                  +--com.ibm.lab.soln.resources.nature_builder.ReadmeBuilder

All Implemented Interfaces:
  org.eclipse.core.runtime.IExecutableExtension

public class ReadmeBuilder
extends org.eclipse.core.resources.IncrementalProjectBuilder

Builder for .readme files. Creates and HTML stub file for each readme file in a project's readme folder to demonstrate the structure of a builder and how an `IResourceDelta` can be processed to find changes of interest to a builder.

The builder will proecess files in the current project, and register its intent to process files in any referenced project. This means that even though the builder is not associated to a project, the fact that a project with this builder has a project reference means that the target project will also be processed.

Source includes trace logic that can be enabled or disabled based on the setting of the `traceEnabled` field. The trace logic uses `System.out.println()` statements to create trace entries. If you want to visualize the flow of build processing, uncomment these statements before starting a test cycle.

See Also:
  `IncrementalProjectBuilder`, `IResourceDelta`

Fields inherited from class org.eclipse.core.resources.IncrementalProjectBuilder
`AUTO_BUILD, FULL_BUILD, INCREMENTAL_BUILD`

Constructor Summary
`ReadmeBuilder()` The required public no-argument constructor.

Method Summary
`protected org.eclipse.core.resources.IProject[]` | `build(int kind, java.util.Map args, org.eclipse.core.runtime.IProgressMonitor monitor)` The build method implementation required for any incremental builder.
`void` | `checkBuildType(int kind)` Prints builder kind trace messages to the console
`void` | `processDelta(org.eclipse.core.resources.IResourceDelta delta)` The `IResourceDelta` passed is processed by a `IResourceDeltaVisitor` when the delta contains information about changes in the readme folder.
`void` | `processDelta4ReferencedProjects(org.eclipse.core.resources.IProject[] refedProjects)` Attempts to process readme changes in another project where the builder is not registered.
`void` | `processFull(org.eclipse.core.resources.IProject iProject)` Performs a `FULL_BUILD` by visiting all nodes in the resource tree under readme folder for the specified project.
`void` | `processFull4ReferencedProjects(org.eclipse.core.resources.IProject[] refedProjects)` Performs a full buils on any referenced projects.
`void` | `setInitializationData(org.eclipse.core.runtime.IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)` Finds builder parameters defined in the plugin.xml.
`protected void` | `startupOnInitialize()` This method allows a builder to get ready.
`org.eclipse.core.resources.IProject[]` | `watchReferecedProjects()` Returns an array of projects that are of interest for the next build.

Methods inherited from class org.eclipse.core.resources.IncrementalProjectBuilder
`forgetLastBuiltState, getDelta, getProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReadmeBuilder

    public ReadmeBuilder()

  The required public no-argument constructor.

Method Detail

### build

    protected org.eclipse.core.resources.IProject[] build(int kind,
                                                          java.util.Map args,
                                                          org.eclipse.core.runtime.IProgressMonitor monitor)
                                                   throws org.eclipse.core.runtime.CoreException

  The build method implementation required for any incremental builder. This demonstration of build processing reacts to a `FULL_BUILD`, `AUTO_BUILD`, or `INCREMENTAL_BUILD` build request. The processing logic to "build" the .readme files is kept in the `ReadmeVisitor` class and is used for all build types.
  Overrides:
    `build` in class `org.eclipse.core.resources.IncrementalProjectBuilder`

### checkBuildType

    public void checkBuildType(int kind)

  Prints builder kind trace messages to the console

### processDelta

    public void processDelta(org.eclipse.core.resources.IResourceDelta delta)
                      throws org.eclipse.core.runtime.CoreException

  The `IResourceDelta` passed is processed by a `IResourceDeltaVisitor` when the delta contains information about changes in the readme folder. A null delta exists when the project is created.

  Multiple visit invocation statements are included for the different resource visitors provided in this resource programming demonstration package. You may wish to invoke other visitors to further explore the `IResourceDelta`.

  See Also:
    `IResourceDelta`

### processDelta4ReferencedProjects

    public void processDelta4ReferencedProjects(org.eclipse.core.resources.IProject[] refedProjects)
                                         throws org.eclipse.core.runtime.CoreException

  Attempts to process readme changes in another project where the builder is not registered. Other projects are those referenced by the current project.
  Throws:
    `org.eclipse.core.runtime.CoreException` -

### processFull

    public void processFull(org.eclipse.core.resources.IProject iProject)

  Performs a `FULL_BUILD` by visiting all nodes in the resource tree under readme folder for the specified project. The readme folder must exist. The `ReadmeVisitor` class is used to process the .readme files when found in the project tree.
  Parameters:
    `iProject` -

### processFull4ReferencedProjects

    public void processFull4ReferencedProjects(org.eclipse.core.resources.IProject[] refedProjects)

  Performs a full buils on any referenced projects.

### setInitializationData

    public void setInitializationData(org.eclipse.core.runtime.IConfigurationElement config,
                                      java.lang.String propertyName,
                                      java.lang.Object data)
                               throws org.eclipse.core.runtime.CoreException

  Finds builder parameters defined in the plugin.xml. Parameters are printed to the console if the `System.out.println()` statements are uncommented.
  Overrides:
    `setInitializationData` in class `org.eclipse.core.resources.IncrementalProjectBuilder`
  See Also:
    `IExecutableExtension.setInitializationData(IConfigurationElement, String, Object)`

### startupOnInitialize

    protected void startupOnInitialize()

  This method allows a builder to get ready. Called early in the build cycle.
  Overrides:
    `startupOnInitialize` in class `org.eclipse.core.resources.IncrementalProjectBuilder`
  See Also:
    `IncrementalProjectBuilder.startupOnInitialize()`

### watchReferecedProjects

    public org.eclipse.core.resources.IProject[] watchReferecedProjects()

  Returns an array of projects that are of interest for the next build. If this array is returned by the build method, the build can get a delta for these projects during the next build cycle. The projects returned are those referenced by the current project, if none are referenced a null is returned.