com.ibm.lab.soln.resources.nature_builder
Class CustomNature

java.lang.Object
  |
  +--com.ibm.lab.soln.resources.nature_builder.CustomNature
All Implemented Interfaces:
org.eclipse.core.resources.IProjectNature

public class CustomNature
extends java.lang.Object
implements org.eclipse.core.resources.IProjectNature

Simple implementation of a nature that customizes a project by adding the ReadmeBuilder to the list of builders found in a project description.


Constructor Summary
CustomNature()
          CustomNature default constructor.
 
Method Summary
 void addReadmeBuilderToBuildSpec(org.eclipse.core.resources.IProject project)
          Adds the ReadmeBuilder to the project description for the selected project if it does not already exist.
 void configure()
          Customizes the project by adding a builder, the ReadmeBuilder in this scenario.
 void deconfigure()
          Removes any nature customization and private resources as may be required.
 org.eclipse.core.resources.IProject getProject()
          Returns local reference to associated project
protected  void resultError(java.lang.String title, java.lang.String msg)
          Used to show action results.
protected  void resultInformation(java.lang.String title, java.lang.String msg)
          Used to show action results.
 void setProject(org.eclipse.core.resources.IProject value)
          Saves local reference to associated project.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomNature

public CustomNature()
CustomNature default constructor.
Method Detail

addReadmeBuilderToBuildSpec

public void addReadmeBuilderToBuildSpec(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

configure

public void configure()
               throws org.eclipse.core.runtime.CoreException
Customizes the project by adding a builder, the ReadmeBuilder in this scenario.
Specified by:
configure in interface org.eclipse.core.resources.IProjectNature
See Also:
IProjectNature.configure()

deconfigure

public void deconfigure()
                 throws org.eclipse.core.runtime.CoreException
Removes any nature customization and private resources as may be required.

The ReadmeBuilder is not removed here, but is removed automatically by the platform as the plugin.xml definition links the builder to the nature.

This works when the nature identifies the builder using a entry and the builder states that it has a nature using a ... entry.

Specified by:
deconfigure in interface org.eclipse.core.resources.IProjectNature
See Also:
IProjectNature.deconfigure()

getProject

public org.eclipse.core.resources.IProject getProject()
Returns local reference to associated project
Specified by:
getProject in interface org.eclipse.core.resources.IProjectNature
See Also:
IProjectNature.getProject()

resultError

protected void resultError(java.lang.String title,
                           java.lang.String msg)
Used to show action results.
See Also:
MessageDialog

resultInformation

protected void resultInformation(java.lang.String title,
                                 java.lang.String msg)
Used to show action results.
See Also:
MessageDialog

setProject

public void setProject(org.eclipse.core.resources.IProject value)
Saves local reference to associated project.
Specified by:
setProject in interface org.eclipse.core.resources.IProjectNature
See Also:
IProjectNature.setProject(IProject)