Goals of the tutorial
Beginners See a simple concrete case study
Acceleo addicts Discover new killing features
Android experts Learn enough to build a full fledged generator
Slide 4
Slide 4 text
I 'm
I 'm
not
not
an Android
an Android
development expert
development expert
Slide 5
Slide 5 text
1.
Acceleo:
A new code generator
Slide 6
Slide 6 text
A long history...
A long history...
Version 3.0 is part of the
Eclipse Helios release train
From Acceleo.org in 2006...
...to Eclipse.org in 2009
Slide 7
Slide 7 text
A long history...
A long history...
Acceleo 2
Acceleo 3
Slide 8
Slide 8 text
8
Metamodel and
templates based
technology
Implementation
of the Model To
Text OMG
standard (MTL)
Eclipse Modeling
/ M2T Project
Tooling to help
starting a new
generator from
scratch
A new code generation
language
Slide 9
Slide 9 text
9
Acceleo Runtime
(Compiler + Engine)
Acceleo
Development Tools
+
=
Eclipse independant: can be
run anywhere (plain old Jar,
OSGi, Eclipse...)
The Acceleo SDK
Slide 10
Slide 10 text
2.
Prototype
based
approach
Slide 11
Slide 11 text
Let's have a look at the
Android prototype
Slide 12
Slide 12 text
12
Unlock the power of your models
Java UI Java DB
XML Properties
Different kinds of source
artifacts to be generated
Slide 13
Slide 13 text
13
One kind of file to be
generated...
...one MTL file to be created
Good Practice
17
A little bit of syntax
Queries can return any kind of objects
Templates are better for generating text
and return a string
You can call Java services from a template or a query
The result of a query is stored in a cache.
Slide 18
Slide 18 text
18
The workflow file
The MTL file
calling the other
ones
@main annotation
Slide 19
Slide 19 text
19
Initialize the generation project
1. Create new
Acceleo project
2. Use the wizard
(update file paths)
3. Create a
workflow file
Slide 20
Slide 20 text
20
3... 2... 1...
Launch
configuration
Anything
that can
launch Java...
Generated
Java Main
Stand
alone
Same
VM as
Eclipse
Standalone Standalone
Slide 21
Slide 21 text
21
Ignition
1. Launch the
generator
(launch config as Eclipse plugin)
Slide 22
Slide 22 text
From a static generator...
… to a one
dynamic
3.
Slide 23
Slide 23 text
23
Quick replacement
Select a text section in the
template, then hit "Content
Assist" hotkeys
Slide 24
Slide 24 text
24
Hierarchy Tree
Select a text section in the
template, then right-click
"Source > As For/If"
Slide 25
Slide 25 text
25
"As For/If" is quick but dirty...
...use template
Good Practice
polymorphism instead!!
Slide 26
Slide 26 text
26
Generation patterns
Use the Generation
Patterns View
Slide 27
Slide 27 text
27
Extract as
template
Select a text section in the
template, then right click
"Refactor > Extract as template"
Slide 28
Slide 28 text
28
Refactoring
Alt + Shift + R
Slide 29
Slide 29 text
Launch the generator
- open the Result view
- launch config as Eclipse plugin
- activate the Traceability
Have a look at the Result view
Slide 30
Slide 30 text
30
4.
Make the Android App
run
Slide 31
Slide 31 text
31
Debug your templates
Thanks to Acceleo
debugger
Slide 32
Slide 32 text
32
Configure the
Android Development Kit
Create a new Android
Virtual Device - AVD
Set the path to the
SDK location
Slide 33
Slide 33 text
33
Turn on the phone
Slide 34
Slide 34 text
34
5.
A generic Android App
generator
Slide 35
Slide 35 text
Create a fresh new model
Slide 36
Slide 36 text
36
Android Apps
Generate new
Slide 37
Slide 37 text
37
6.
A new App
in a few
clicks
Slide 38
Slide 38 text
38
Packaging and deploying
Generate an Eclipse
UI plugin
Add an action on
right-click on models
Create a builder
Synchronize your
code and your model
Slide 39
Slide 39 text
39
Packaging settings
Filename pattern
of the model
Target folder of
the generation
Warning Eclipse specific
Slide 40
Slide 40 text
40
Workout
1. Create new
Acceleo UI project
2. Use the wizard
3. Launch a 2n
d
Eclipse Runtime
and test