hello michael, there are two ways to solve this:
(1) restructure the templates
Workflow {
component = org.eclipse.xtext.mwe.Reader {
// lookup all resources on the classpath
useJavaClassPath = true
// or define search scope explicitly
path = modelPath
// this class will be generated by the xtext generator
register = de.db.kolt.ribdsl.RibDslStandaloneSetup {}
load = {
slot = "allMyModel"
type = "MyModel"
}
}
component = org.eclipse.xpand2.Generator {
expand = "templates::Main::processMain FOR allMyModel"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
}
«DEFINE processMain FOR List[MyModel]-»
«FILE "messages.properties"»
«EXPAND processMainElement FOREACH this»
«ENDFILE»
«ENDDEFINE»
«DEFINE processMainElement FOR MyModel-»
«EXPAND processMessage»
«ENDDEFINE»
«DEFINE processMessage FOR MyModel»
«FOREACH allSubsystem.allMessage AS message»
«FOREACH message.allLanguage AS entry»
«REM»the entry is unique by the name of the subsystem + "." + name of the mesage«ENDREM»
«((Subsystem)message.eContainer()).name».«message.name»=«entry.message»
«ENDFOREACH»
«ENDFOREACH»
«ENDDEFINE»
(2) change the configuration of the outlet
component = org.eclipse.xpand2.Generator {
expand = "templates::Template::main FOREACH greetings"
outlet = {
path = targetDir
append = true
}
fileEncoding = fileEncoding
}
If you have other generated artefacts that should no be appended just create another outlet
component = org.eclipse.xpand2.Generator {
expand = "templates::Template::main FOREACH greetings"
outlet = {
path = targetDir
}
outlet = {
path = targetDir
append = true
name = "ANAME"
}
fileEncoding = fileEncoding
}
«FILE "test.txt" ANAME»
«name»
«ENDFILE»
~Christian