org.eclipse.cdt.ui
Class CodeGeneration

java.lang.Object
  extended by org.eclipse.cdt.ui.CodeGeneration

public class CodeGeneration
extends java.lang.Object

Class that offers access to the templates contained in the 'code generation' preference page.

Since:
2.1

Method Summary
static java.lang.String getBodyFileContent(org.eclipse.cdt.core.model.ITranslationUnit tu, java.lang.String typeComment, java.lang.String typeContent, java.lang.String lineDelimiter)
          Returns the content for a new compilation unit using the 'new Java file' code template.
static java.lang.String getClassComment(org.eclipse.cdt.core.model.ITranslationUnit tu, java.lang.String typeQualifiedName, java.lang.String lineDelimiter)
          Returns the content for a new type comment using the 'typecomment' code template.
static java.lang.String getHeaderFileContent(org.eclipse.cdt.core.model.ITranslationUnit tu, java.lang.String typeComment, java.lang.String typeContent, java.lang.String lineDelimiter)
          Returns the content for a new compilation unit using the 'new Java file' code template.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHeaderFileContent

public static java.lang.String getHeaderFileContent(org.eclipse.cdt.core.model.ITranslationUnit tu,
                                                    java.lang.String typeComment,
                                                    java.lang.String typeContent,
                                                    java.lang.String lineDelimiter)
                                             throws org.eclipse.core.runtime.CoreException
Returns the content for a new compilation unit using the 'new Java file' code template.

Parameters:
tu - The translation unit to create the source for. The compilation unit does not need to exist.
typeComment - The comment for the type to created. Used when the code template contains a ${typecomment} variable. Can be null if no comment should be added.
typeContent - The code of the type, including type declaration and body.
lineDelimiter - The line delimiter to be used.
Returns:
Returns the new content or null if the template is undefined or empty.
Throws:
org.eclipse.core.runtime.CoreException

getBodyFileContent

public static java.lang.String getBodyFileContent(org.eclipse.cdt.core.model.ITranslationUnit tu,
                                                  java.lang.String typeComment,
                                                  java.lang.String typeContent,
                                                  java.lang.String lineDelimiter)
                                           throws org.eclipse.core.runtime.CoreException
Returns the content for a new compilation unit using the 'new Java file' code template.

Parameters:
tu - The translation unit to create the source for. The compilation unit does not need to exist.
typeComment - The comment for the type to created. Used when the code template contains a ${typecomment} variable. Can be null if no comment should be added.
typeContent - The code of the type, including type declaration and body.
lineDelimiter - The line delimiter to be used.
Returns:
Returns the new content or null if the template is undefined or empty.
Throws:
org.eclipse.core.runtime.CoreException

getClassComment

public static java.lang.String getClassComment(org.eclipse.cdt.core.model.ITranslationUnit tu,
                                               java.lang.String typeQualifiedName,
                                               java.lang.String lineDelimiter)
                                        throws org.eclipse.core.runtime.CoreException
Returns the content for a new type comment using the 'typecomment' code template. The returned content is unformatted and is not indented.

Parameters:
tu - The translation unit where the type is contained. The compilation unit does not need to exist.
typeQualifiedName - The name of the type to which the comment is added. For inner types the name must be qualified and include the outer types names (dot separated).
lineDelimiter - The line delimiter to be used.
Returns:
Returns the new content or null if the code template is undefined or empty. The returned content is unformatted and is not indented.
Throws:
org.eclipse.core.runtime.CoreException