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

    java.lang.Object
      |
      +--com.ibm.lab.soln.resources.ActionResourceAction
            |
            +--com.ibm.lab.soln.resources.nature_builder.ActionAddBuilderToProject

All Implemented Interfaces:
  org.eclipse.ui.IActionDelegate, org.eclipse.ui.IObjectActionDelegate

public class ActionAddBuilderToProject
extends ActionResourceAction

Implements an action to add the `ReadmeBuilder` directly to an existing project.

This demonstrates the API for the project and project description workspace resources and how you might implement this logic in your tool.

See Also:
  `IProject`, `IProjectDescription`, `ICommand`

Fields inherited from class com.ibm.lab.soln.resources.ActionResourceAction
`selection`

Constructor Summary
`ActionAddBuilderToProject()` ActionAddBuilderToProject default constructor.

Method Summary
`void` | `addToBuildSpec(org.eclipse.core.resources.IProject project)` Adds the ReadmeBuilder to the project description for the selected project if it does not already exist.
`boolean` | `hasBuilder(org.eclipse.core.resources.ICommand[] commands)` Checks project buildspec to determine if builder already associated.
`boolean` | `hasNature(java.lang.String builderName)` Checks builder definition to determine if builder may require a nature.
`void` | `run(org.eclipse.jface.action.IAction action)` Uses saved reference to selected project to call custom logic that adds the builder to the current project.

Methods inherited from class com.ibm.lab.soln.resources.ActionResourceAction
`resultError, resultInformation, resultQuestion, selectionChanged, setActivePart`

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

Constructor Detail

### ActionAddBuilderToProject

    public ActionAddBuilderToProject()

  ActionAddBuilderToProject default constructor.

Method Detail

### addToBuildSpec

    public void addToBuildSpec(org.eclipse.core.resources.IProject project)
                        throws org.eclipse.core.runtime.CoreException

  Adds the ReadmeBuilder to the project description for the selected project if it does not already exist.
  Parameters:
    `project` - selected project resource

### hasBuilder

    public boolean hasBuilder(org.eclipse.core.resources.ICommand[] commands)

  Checks project buildspec to determine if builder already associated.
  Parameters:
    `commands` - - Project build spec
  Returns:
    boolean

### hasNature

    public boolean hasNature(java.lang.String builderName)

  Checks builder definition to determine if builder may require a nature. Method source copied from `BuildManager.instantiateBuilder()` method.
  Parameters:
    `commands` - - Project build spec
  Returns:
    boolean

### run

    public void run(org.eclipse.jface.action.IAction action)

  Uses saved reference to selected project to call custom logic that adds the builder to the current project.
  Parameters:
    `action` - action proxy that handles the presentation portion of the plugin action
  See Also:
    `IActionDelegate.run(IAction)`