public class GenerateData
extends org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
Modifier and Type | Field and Description |
---|---|
static String |
MODULE_FILE_NAME
The name of the module.
|
static String[] |
TEMPLATE_NAMES
The name of the templates that are to be generated.
|
Constructor and Description |
---|
GenerateData()
Allows the public constructor to be used.
|
GenerateData(org.eclipse.emf.ecore.EObject model,
File targetFolder,
List<? extends Object> arguments)
This allows clients to instantiates a generator with all required
information.
|
GenerateData(org.eclipse.emf.common.util.URI modelURI,
File targetFolder,
List<? extends Object> arguments)
This allows clients to instantiates a generator with all required
information.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertiesFile(String propertiesFile)
Adds a properties file in the list of properties files.
|
void |
doGenerate(org.eclipse.emf.common.util.Monitor monitor)
Launches the generation described by this instance.
|
List<org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener> |
getGenerationListeners()
If this generator needs to listen to text generation events, listeners
can be returned from here.
|
org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy |
getGenerationStrategy()
If you need to change the way files are generated, this is your entry
point.
|
String |
getModuleName()
This will be called in order to find and load the module that will be
launched through this launcher.
|
List<String> |
getProperties()
If the module(s) called by this launcher require properties files, return
their qualified path from
here.Take note that the first added properties files will take precedence
over subsequent ones if they
contain conflicting keys.
|
String[] |
getTemplateNames()
This will be used to get the list of templates that are to be launched by
this launcher.
|
static void |
main(String[] args)
This can be used to launch the generation from a standalone application.
|
void |
registerPackages(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
This can be used to update the resource set's package registry with all
needed EPackages.
|
void |
registerResourceFactories(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
This can be used to update the resource set's resource factory registry
with all needed factories.
|
addGenerationListener, addListeners, addProperties, clearPackageRegistry, createAcceleoService, createTemplateURI, createURIConverter, findModuleURL, generate, generate, getArguments, getModel, getModule, getOCLStdLibPackage, getPropertiesLoaderService, getTargetFolder, initialize, initialize, isInWorkspace, postGenerate, postInitialize, setGenerationID
public static final String MODULE_FILE_NAME
public static final String[] TEMPLATE_NAMES
public GenerateData()
AbstractAcceleoGenerator.initialize(EObject, File, List)
or
AbstractAcceleoGenerator.initialize(URI, File, List)
is called.
The main reason for this constructor is to allow clients of this
generation to call it from another Java file, as it allows for the
retrieval of getProperties()
and
getGenerationListeners()
.
public GenerateData(org.eclipse.emf.common.util.URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException
modelURI
- URI where the model on which this generator will be used is
located.targetFolder
- This will be used as the output folder for this generation :
it will be the base path
against which all file block URLs will be resolved.arguments
- If the template which will be called requires more than one
argument taken from the model,
pass them here.IOException
- This can be thrown in three scenarios : the module cannot be
found, it cannot be loaded, or
the model cannot be loaded.public GenerateData(org.eclipse.emf.ecore.EObject model, File targetFolder, List<? extends Object> arguments) throws IOException
model
- We'll iterate over the content of this element to find Objects
matching the first parameter
of the template we need to call.targetFolder
- This will be used as the output folder for this generation :
it will be the base path
against which all file block URLs will be resolved.arguments
- If the template which will be called requires more than one
argument taken from the model,
pass them here.IOException
- This can be thrown in two scenarios : the module cannot be
found, or it cannot be loaded.public static void main(String[] args)
args
- Arguments of the generation.public void doGenerate(org.eclipse.emf.common.util.Monitor monitor) throws IOException
doGenerate
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
monitor
- This will be used to display progress information to the user.IOException
- This will be thrown if any of the output files cannot be
saved to disk.public List<org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener> getGenerationListeners()
getGenerationListeners
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
public org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy getGenerationStrategy()
The default is
DefaultStrategy
;
it generates files on the fly. If you only need to preview the results,
return a new
PreviewStrategy
.
Both of these aren't aware of the running Eclipse and can be used
standalone.
If you need the file generation to be aware of the workspace (A typical
example is when you wanna override files that are under clear case or any
other VCS that could forbid the overriding), then return a new
WorkspaceAwareStrategy
. Note, however, that this cannot be used standalone.
All three of these default strategies support merging through JMerge.
getGenerationStrategy
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
public String getModuleName()
getModuleName
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
public List<String> getProperties()
getProperties
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
ResourceBundle.getBundle(String)
public void addPropertiesFile(String propertiesFile)
addPropertiesFile
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
propertiesFile
- The properties file to add.public String[] getTemplateNames()
getTemplateNames
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
getModuleName()
.public void registerPackages(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
registerPackages
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
resourceSet
- The resource set which registry has to be updated.public void registerResourceFactories(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
registerResourceFactories
in class org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator
resourceSet
- The resource set which registry has to be updated.Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.