org.eclipse.emf.codegen.jet
Class JETNature

java.lang.Object
  extended by org.eclipse.emf.codegen.jet.JETNature
All Implemented Interfaces:
IProjectNature, IJETNature

public class JETNature
extends java.lang.Object
implements IJETNature


Field Summary
protected static java.lang.String BUILDER
           
protected static java.lang.String DEFAULT_TEMPLATE_CONTAINER_NAME
           
protected static java.lang.String JET_NATURE_PROPERTIES_FILE
           
protected static java.lang.String JET_SETTINGS_NODE
           
protected  IContainer jetJavaSourceContainer
           
protected  IProject jetProject
           
protected  java.util.List<java.lang.Object> jetTemplateContainers
           
protected  java.util.List<java.lang.Object> jetTemplateSourceContainers
           
protected static java.lang.String SOURCE_CONTAINER_NODE
           
protected static java.lang.String TEMPLATE_CONTAINER_NODE
           
 
Fields inherited from interface org.eclipse.emf.codegen.jet.IJETNature
NATURE_ID
 
Constructor Summary
JETNature()
          Constructor for JETNature.
 
Method Summary
protected  void addToFrontOfBuildSpec(java.lang.String builderID)
          Adds a builder to the build specification for the given project.
protected  void commitXML(org.w3c.dom.Document document)
           
 void configure()
           
 void configure(IProgressMonitor monitor)
           
protected  void createDefaultJETSettingsFile(java.util.List<java.lang.Object> templateContainers, IContainer sourceContainer)
           
protected  void createDefaultJETSettingsFile(java.util.List<java.lang.Object> templateContainers, java.util.List<java.lang.Object> templateSourceContainers, IContainer sourceContainer)
          Writes the default file
 void deconfigure()
           
protected  org.w3c.dom.Element getChildWithLocalName(org.w3c.dom.Element element, java.lang.String localName)
          Returns the child with the given local name.
static java.lang.String getContainer(IProject project, IContainer container)
           
static IContainer getContainer(IProject project, IPath path)
           
static IContainer getContainer(IProject project, java.lang.String path)
           
static java.lang.String getContainers(IProject project, java.util.List<java.lang.Object> containers)
           
static java.lang.String getContainers(IProject project, java.util.List<java.lang.Object> containers, java.util.List<java.lang.Object> sourceContainers)
           
static java.util.List<java.lang.Object> getContainers(IProject project, java.lang.String paths)
           
static java.util.List<java.lang.Object> getContainers(IProject project, java.lang.String paths, boolean filter)
           
protected  IContainer getContainerValue(org.w3c.dom.Element element, java.lang.String localName)
          Returns the container defined from the base Element passed in.
protected  java.util.List<java.lang.Object> getContainerValues(org.w3c.dom.Element element, java.lang.String localName)
          Returns the containers defined from the base Element passed in.
protected  java.util.List<java.lang.Object> getContainerValues(org.w3c.dom.Element element, java.lang.String localName, boolean filter)
          Returns the containers defined from the base Element passed in with entries starting with @ filtered out.
protected  IPath getDefaultSourcePath()
          Returns the project's root directory
 IContainer getJavaSourceContainer()
          Returns the container where the generated Java sources go.
 IContainer getJavaSourceContainerFromFile()
          Returns the template file from the .jetproperties file
 IProject getProject()
           
static JETNature getRuntime(IProject project)
          Get a JETNature that corresponds to the supplied project.
 java.util.List<java.lang.Object> getTemplateContainers()
          Returns the containers where the templates are located.
 java.util.List<java.lang.Object> getTemplateContainersFromFile()
          Returns the template path from the .jetproperties file.
 java.util.List<java.lang.Object> getTemplateSourceContainers()
          Returns the containers where the template sources are located.
protected  java.util.List<java.lang.Object> getTemplateSourceContainersFromFile()
          Returns the template source path from the .jetproperties file.
protected  void initJavaSourceContainer(IProgressMonitor monitor)
          Initializes the Java Source Container
protected  void initTemplateContainer(IProgressMonitor monitor)
          Initializes the template container.
protected  org.w3c.dom.Document parseJETSettings()
          Parse the JET settings file for the root element.
static byte[] readContentsAsBytes(java.io.InputStream input)
          Reads an input stream and converts it to bytes
protected  java.io.StringReader readJETSettingFile()
          Open the JET Settings file and return a StringReader on the contents
protected  void setContainerValue(IContainer container, org.w3c.dom.Element element, java.lang.String localName)
          Sets the template container location in the settings file
protected  void setContainerValues(java.util.List<java.lang.Object> containers, org.w3c.dom.Element element, java.lang.String localName)
           
protected  void setContainerValues(java.util.List<java.lang.Object> containers, java.util.List<java.lang.Object> sourceContainers, org.w3c.dom.Element element, java.lang.String localName)
          Sets the template container locations in the settings file
 void setDefaults(IProgressMonitor monitor)
          Sets the containers to their defaults.
 void setJavaSourceContainer(IContainer javaSourceContainer)
          Sets the container where the generated Java sources go.
 void setJavaSourceContainerToFile(IContainer sourceContainer)
          Writes the Java Source Container Location to a file
 void setProject(IProject project)
           
 void setTemplateContainers(java.util.List<java.lang.Object> templateContainers)
          Sets the containers where the templates are located.
 void setTemplateContainers(java.util.List<java.lang.Object> templateContainers, java.util.List<java.lang.Object> templateSourceContainers)
          Sets the containers where the template sources are located.
 void setTemplateContainersToFile(java.util.List<java.lang.Object> templateContainers)
           
 void setTemplateContainersToFile(java.util.List<java.lang.Object> templateContainers, java.util.List<java.lang.Object> templateSourceContainers)
          Writes the Template Container Location to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILDER

protected static final java.lang.String BUILDER
See Also:
Constant Field Values

DEFAULT_TEMPLATE_CONTAINER_NAME

protected static final java.lang.String DEFAULT_TEMPLATE_CONTAINER_NAME
See Also:
Constant Field Values

JET_NATURE_PROPERTIES_FILE

protected static final java.lang.String JET_NATURE_PROPERTIES_FILE
See Also:
Constant Field Values

TEMPLATE_CONTAINER_NODE

protected static final java.lang.String TEMPLATE_CONTAINER_NODE
See Also:
Constant Field Values

SOURCE_CONTAINER_NODE

protected static final java.lang.String SOURCE_CONTAINER_NODE
See Also:
Constant Field Values

JET_SETTINGS_NODE

protected static final java.lang.String JET_SETTINGS_NODE
See Also:
Constant Field Values

jetProject

protected IProject jetProject

jetTemplateContainers

protected java.util.List<java.lang.Object> jetTemplateContainers

jetTemplateSourceContainers

protected java.util.List<java.lang.Object> jetTemplateSourceContainers

jetJavaSourceContainer

protected IContainer jetJavaSourceContainer
Constructor Detail

JETNature

public JETNature()
Constructor for JETNature.

Method Detail

getRuntime

public static JETNature getRuntime(IProject project)
Get a JETNature that corresponds to the supplied project.

Parameters:
project - IProject
Returns:
JETNature

getTemplateContainers

public java.util.List<java.lang.Object> getTemplateContainers()
Description copied from interface: IJETNature
Returns the containers where the templates are located.

Specified by:
getTemplateContainers in interface IJETNature
Returns:
the containers where the templates are located.

getTemplateSourceContainers

public java.util.List<java.lang.Object> getTemplateSourceContainers()
Description copied from interface: IJETNature
Returns the containers where the template sources are located.

Specified by:
getTemplateSourceContainers in interface IJETNature
Returns:
the containers where the template sources are located.

getJavaSourceContainer

public IContainer getJavaSourceContainer()
Description copied from interface: IJETNature
Returns the container where the generated Java sources go.

Specified by:
getJavaSourceContainer in interface IJETNature
Returns:
the container where the generated Java sources go.

setTemplateContainers

public void setTemplateContainers(java.util.List<java.lang.Object> templateContainers)
Description copied from interface: IJETNature
Sets the containers where the templates are located.

Specified by:
setTemplateContainers in interface IJETNature
Parameters:
templateContainers - the new locations.

setTemplateContainers

public void setTemplateContainers(java.util.List<java.lang.Object> templateContainers,
                                  java.util.List<java.lang.Object> templateSourceContainers)
Description copied from interface: IJETNature
Sets the containers where the template sources are located.

Specified by:
setTemplateContainers in interface IJETNature
Parameters:
templateContainers - the new locations.
templateSourceContainers - the new source locations.

setJavaSourceContainer

public void setJavaSourceContainer(IContainer javaSourceContainer)
Description copied from interface: IJETNature
Sets the container where the generated Java sources go.

Specified by:
setJavaSourceContainer in interface IJETNature
Parameters:
javaSourceContainer - the new location.

configure

public void configure()
               throws CoreException
Specified by:
configure in interface IProjectNature
Throws:
CoreException

configure

public void configure(IProgressMonitor monitor)
               throws CoreException
Throws:
CoreException

setDefaults

public void setDefaults(IProgressMonitor monitor)
                 throws CoreException
Sets the containers to their defaults.

Throws:
CoreException

deconfigure

public void deconfigure()
                 throws CoreException
Specified by:
deconfigure in interface IProjectNature
Throws:
CoreException

getProject

public IProject getProject()
Specified by:
getProject in interface IProjectNature

setProject

public void setProject(IProject project)
Specified by:
setProject in interface IProjectNature

initTemplateContainer

protected void initTemplateContainer(IProgressMonitor monitor)
                              throws CoreException
Initializes the template container.

Throws:
CoreException

initJavaSourceContainer

protected void initJavaSourceContainer(IProgressMonitor monitor)
                                throws CoreException
Initializes the Java Source Container

Throws:
CoreException

getDefaultSourcePath

protected IPath getDefaultSourcePath()
Returns the project's root directory


addToFrontOfBuildSpec

protected void addToFrontOfBuildSpec(java.lang.String builderID)
                              throws CoreException
Adds a builder to the build specification for the given project.

Throws:
CoreException

getTemplateContainersFromFile

public java.util.List<java.lang.Object> getTemplateContainersFromFile()
Returns the template path from the .jetproperties file.


getTemplateSourceContainersFromFile

protected java.util.List<java.lang.Object> getTemplateSourceContainersFromFile()
Returns the template source path from the .jetproperties file.


getJavaSourceContainerFromFile

public IContainer getJavaSourceContainerFromFile()
Returns the template file from the .jetproperties file


parseJETSettings

protected org.w3c.dom.Document parseJETSettings()
                                         throws javax.xml.parsers.ParserConfigurationException,
                                                org.xml.sax.SAXException,
                                                java.io.IOException,
                                                CoreException
Parse the JET settings file for the root element.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
CoreException

readJETSettingFile

protected java.io.StringReader readJETSettingFile()
                                           throws CoreException,
                                                  java.io.IOException
Open the JET Settings file and return a StringReader on the contents

Throws:
CoreException
java.io.IOException

getContainerValues

protected java.util.List<java.lang.Object> getContainerValues(org.w3c.dom.Element element,
                                                              java.lang.String localName)
Returns the containers defined from the base Element passed in.


getContainerValues

protected java.util.List<java.lang.Object> getContainerValues(org.w3c.dom.Element element,
                                                              java.lang.String localName,
                                                              boolean filter)
Returns the containers defined from the base Element passed in with entries starting with @ filtered out.


getContainerValue

protected IContainer getContainerValue(org.w3c.dom.Element element,
                                       java.lang.String localName)
Returns the container defined from the base Element passed in.


setContainerValues

protected void setContainerValues(java.util.List<java.lang.Object> containers,
                                  org.w3c.dom.Element element,
                                  java.lang.String localName)

setContainerValues

protected void setContainerValues(java.util.List<java.lang.Object> containers,
                                  java.util.List<java.lang.Object> sourceContainers,
                                  org.w3c.dom.Element element,
                                  java.lang.String localName)
Sets the template container locations in the settings file


setContainerValue

protected void setContainerValue(IContainer container,
                                 org.w3c.dom.Element element,
                                 java.lang.String localName)
Sets the template container location in the settings file


getChildWithLocalName

protected org.w3c.dom.Element getChildWithLocalName(org.w3c.dom.Element element,
                                                    java.lang.String localName)
Returns the child with the given local name.


readContentsAsBytes

public static byte[] readContentsAsBytes(java.io.InputStream input)
                                  throws java.io.IOException
Reads an input stream and converts it to bytes

Throws:
java.io.IOException

setTemplateContainersToFile

public void setTemplateContainersToFile(java.util.List<java.lang.Object> templateContainers)
                                 throws CoreException
Throws:
CoreException

setTemplateContainersToFile

public void setTemplateContainersToFile(java.util.List<java.lang.Object> templateContainers,
                                        java.util.List<java.lang.Object> templateSourceContainers)
                                 throws CoreException
Writes the Template Container Location to a file

Throws:
CoreException

setJavaSourceContainerToFile

public void setJavaSourceContainerToFile(IContainer sourceContainer)
                                  throws CoreException
Writes the Java Source Container Location to a file

Throws:
CoreException

createDefaultJETSettingsFile

protected void createDefaultJETSettingsFile(java.util.List<java.lang.Object> templateContainers,
                                            IContainer sourceContainer)
                                     throws CoreException,
                                            java.io.IOException
Throws:
CoreException
java.io.IOException

createDefaultJETSettingsFile

protected void createDefaultJETSettingsFile(java.util.List<java.lang.Object> templateContainers,
                                            java.util.List<java.lang.Object> templateSourceContainers,
                                            IContainer sourceContainer)
                                     throws CoreException,
                                            java.io.IOException
Writes the default file

Throws:
CoreException
java.io.IOException

commitXML

protected void commitXML(org.w3c.dom.Document document)
                  throws CoreException,
                         java.lang.ClassNotFoundException,
                         java.io.IOException
Throws:
CoreException
java.lang.ClassNotFoundException
java.io.IOException

getContainer

public static IContainer getContainer(IProject project,
                                      IPath path)

getContainer

public static IContainer getContainer(IProject project,
                                      java.lang.String path)

getContainers

public static java.util.List<java.lang.Object> getContainers(IProject project,
                                                             java.lang.String paths)

getContainers

public static java.util.List<java.lang.Object> getContainers(IProject project,
                                                             java.lang.String paths,
                                                             boolean filter)

getContainers

public static java.lang.String getContainers(IProject project,
                                             java.util.List<java.lang.Object> containers)

getContainers

public static java.lang.String getContainers(IProject project,
                                             java.util.List<java.lang.Object> containers,
                                             java.util.List<java.lang.Object> sourceContainers)

getContainer

public static java.lang.String getContainer(IProject project,
                                            IContainer container)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.