Java Reference
In-Depth Information
located using the source path project settings. The FILE directive creates a new
CSV file with the name equal to the title of our map. Note that the end
<<guillemet>> has a hyphen before it. This indicates that white space should be
stripped from the contents of this element. We need this to ensure that our CSV
file has no leading spaces or empty lines.
The FOREACH directive iterates over our Topic elements, which are distin-
guished from our Relationship elements using the typeSelect(mindmap::
Topic) operation. We refer to each Topic instance during iteration as topic
and access its attributes for output, inserting commas in between.
To invoke this template on our Mindmap.xmi dynamic instance, we need to
configure our project and add the following mindmap2csv.mwe file.
<?xml version="1.0"?>
< workflow >
< property name="model"
value="platform:/resource/org.eclipse.dsl.mindmap/model/Mindmap.xmi"/>
< property name="out" value="out" />
<!— set up EMF for standalone execution —>
< bean class="org.eclipse.emf.mwe.utils.StandaloneSetup">
<platformUri value="../" />
</ bean >
< component class="org.eclipse.emf.mwe.utils.Reader">
< uri value="${model}" />
< modelSlot value="model" />
</ component >
<!— generate code —>
< component class="org.eclipse.xpand2.Generator">
< metaModel id="mm"
class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
< expand value="mindmap2csv::Main FOR model" />
< outlet path="${out}"/>
</ component >
</ workflow >
The workflow contains two component elements, one for the EMF reader
that knows about our Ecore model and the other for the generator itself. The
StandaloneSetup bean is initialized to the root of the workspace. You can find
information on the workflow engine in Section 14.1.16, “Workflow Engine.”
7.3 Generating Java
As we've mentioned previously, you must consider at least two possibilities when
generating Java, or any programming language, from models. The first is to use
 
Search WWH ::




Custom Search