...
2 featureCaptionProvider {
text {
4 Mail : recipients −> ’to’
}
6 }
formControlFactory {
8 control {
Mail : message −> {
10 createText("", SWT.MULTI, SWT.
BORDER, SWT.WRAP, SWT.
V SCROLL)
} target observeText(SWT.Modify)
12 }
}
14 ...
Listing 10: Customization of the form.
ents” feature; we specify this using featureCaption-
Provider. Moreover, we want to show the body of the
mail (the feature “message”) in a text area instead of
a single line text. Note that in this case we have full
control both on the creation of the SWT control and
on the corresponding EMF Databinding mechanism
(the target section is indeed used by EMF Parsley to
perform databinding).
We refer to http://projects.eclipse.org/
projects/modeling.emf-parsley for the com-
plete source code of the example. Here, we only
want to stress that for implementing this application
we only had to write an average of 30 lines of EMF
Parsley DSL code for each view (and in some cases a
few small Java classes).
5 OTHER FEATURES
Teneo and CDO are two mainstream frameworks to
persist EMF models on databases. Teneo resources
can already be used seamlessly in EMF Parsley. On
the contrary, CDO resources require some additional
work. Indeed, CDO offers scalability, transactions ca-
pabilities, explicit locking, change notification, and
branching/merging over models. EMF Parsley auto-
matically recognizes CDO resource URIs and uses a
specific resource loader that automatically creates a
transaction (or a view, in case we use read-only wid-
gets) and returns the associated CDO resource. Thus,
also CDO resources can be used transparently with
EMF Parsley, again, relieving the programmer from
all the internal details.
Another important feature of EMF Parsley is
its support for RAP (Remote Application Frame-
work) (Eclipse Foundation, 2014). RAP allows to
seamlessly port an existing RCP application to the
web. In particular, with its single-sourcing features
the same application developed on the desktop can
run in the browser (RAP supports all relevant web
browsers, without any add-ons required). All EMF
Parsley views, editors and internal mechanisms are
implemented with single sourcing techniques so that
they are available also for RAP applications. Figure 3
shows an RCP application implemented with EMF
Parsley on the left; the same application (without any
modification) is ready for RAP, it just needs to use
the RAP version of EMF Parsley bundles; the figure
shows the web version running on Chrome (center)
and on Firefox (right). All of them are using a CDO
resource, thus they act on the same data.
The use of Xbase implies another important fea-
ture: when running the generated Java code in debug-
ging mode in Eclipse, we can choose to debug directly
the original Parsley DSL code (it is always possible
to switch to the generated Java code). Indeed a well-
known problem of DSLs that generate Java code is
that for debugging, the programmer has to debug the
generated code that is usually quite different from the
original program; our DSL implementation does not
have this drawback.
6 RELATED WORK AND
CONCLUSIONS
Differently from many generative frameworks for
EMF (such as, e.g., JET or EEF and EGF, which
are available in EMFT (Eclipse Modeling Framework
Technology, 2012)), EMF Parsley does not generate
code for the widgets and does not require the pro-
grammer to modify that generated code: the program-
mer uses the provided components and injects the cus-
tomized code. The only point where we generate code
is in the DSL (Section 4), but we generate code only
for the customizations, not the code of the widgets.
EMF Parsley is also much different from GUI gen-
erators, like, for instance, WindowBuilder. Window-
Builder generates Java classes for GUI parts, and pro-
vides a visual editor with rich tooling to design GUI
parts visually. Since WindowBuilder directly gener-
ates Java code, and not an intermediate representation
of the GUI part, it is also capable of dynamically in-
specting such Java code and updating the visual editor
accordingly. Thus, the programmer can insert manu-
ally written sections in such generated Java code. As
we stressed throughout the paper, EMF Parsley fol-
lows a completely orthogonal approach: it provides
GUI parts that are ready to use, and allows the pro-
grammer to “inject” customizations of behavioral as-
pects. With that respect, EMF Parsley and its DSL
share many design and goals with other reflective and
ICSOFT-PT2014-9thInternationalConferenceonSoftwareParadigmTrends
64