Modelers

org.topcased.modeler.extensions
Class Template

java.lang.Object
  extended by org.topcased.modeler.extensions.Template

public class Template
extends java.lang.Object

Template created from a file.
creation : 6 sept. 2004


Constructor Summary
Template(java.io.File src)
          Constructor
 
Method Summary
protected  boolean _checkTemplate()
           
 void addVariable(java.lang.String key, java.lang.String value)
          Set the value of a parameter
 org.eclipse.core.resources.IResource generate(org.eclipse.core.runtime.IProgressMonitor monitor)
          Generates files as part of the template execution.
 java.lang.String getProcessedString(java.lang.String source)
          Process the given String through the parameter map
 void setDestination(org.eclipse.core.resources.IContainer container)
          Set the destination directory of the template
 void setVariables(java.util.Map variables)
          Set the list of parameters and its values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template(java.io.File src)
Constructor

Parameters:
src - the template source file
Method Detail

setDestination

public void setDestination(org.eclipse.core.resources.IContainer container)
Set the destination directory of the template

Parameters:
container - the destination container

setVariables

public void setVariables(java.util.Map variables)
Set the list of parameters and its values

Parameters:
variables - the map of parameters (key="Parameter name String", value="Parameter value String")

addVariable

public void addVariable(java.lang.String key,
                        java.lang.String value)
Set the value of a parameter

Parameters:
key - the parameter name
value - the parameter value

_checkTemplate

protected boolean _checkTemplate()

getProcessedString

public java.lang.String getProcessedString(java.lang.String source)
Process the given String through the parameter map

Parameters:
source - the source String
Returns:
the processed string

generate

public org.eclipse.core.resources.IResource generate(org.eclipse.core.runtime.IProgressMonitor monitor)
                                              throws org.eclipse.core.runtime.CoreException
Generates files as part of the template execution. The default implementation uses template location as a root of the file templates. The files found in the location are processed in the following way: Files and folders are copied directly into the target folder with the conditional generation and variable replacement for files. Variable replacement also includes file names.

Parameters:
monitor - progress monitor to use to indicate generation progress
Returns:
the processed resource
Throws:
org.eclipse.core.runtime.CoreException

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.