
to achieve single-sourcing for RCP and RAP applica-
tions. In particular, we also describe the methodology
to achieve single-sourcing.
EMF Parsley is built on top of the EMF model-
ing framework and aims to make the development of
applications based on EMF easy. EMF Parsley pro-
vides several reusable UI components (trees, tables,
forms, views, editors) acting on EMF models, hiding
the complexity of internal details. EMF Parsley pro-
vides Eclipse parts (i.e., editors and views) for editing
EMF models. Unlike the standard EMF application
development workflow, in EMF Parsley, the developer
must not modify monolithic generated classes: all
aspects are easily customizable and configured with
Google Guice (Prasanna, 2009), a mainstream Depen-
dency Injection framework.
EMF Parsley mechanisms are built on top of
EMF.Edit (Steinberg et al., 2008), but it hides the in-
ternal and difficult details of EMF.Edit. EMF Parsley
components can be configured and customized with
Java using EMF Parsley declarative API. However,
EMF Parsley also provides its DSL to simplify these
operations further. Using the DSL, one can define
the configuration of EMF Parsley UI components in a
very compact, readable, and maintainable way. Then,
the EMF Parsley DSL compiler will generate all the
corresponding Java code, including the dependency
injection configuration. In that respect, EMF Pars-
ley is based on the Generation Gap pattern (Vlissides,
1998).
This DSL is implemented with Xtext (Bettini,
2016a), the mainstream framework for developing
DSLs with a fully-fledged IDE on top of Eclipse.
Thus, the EMF Parsley DSL has a rich Eclipse edi-
tor with all the typical IDE tooling (syntax highlight-
ing, code completion, quickfixes, automated building,
etc.). Moreover, the DSL relies on Xbase (Efftinge
et al., 2012), a reusable Java-like expression lan-
guage completely interoperable with the type system
of Java: all the existing Java libraries can be used in
the DSL. Java programmers will be able to learn the
Xbase language easily.
An input file for the EMF Parsley DSL, i.e., a
file with extension emfparsley, consists of a main
module section. This corresponds to a Google Guice
module in the generated Java code. Inside the mod-
ule, one specifies customizations. Each customiza-
tion has its specific sub-section. We will show several
examples in Section 3.
The module section allows the developer to spec-
ify Eclipse parts (i.e., EMF Parsley views and edi-
tors) that are initialized, configured, and customized
in the current module. The DSL compiler will gen-
erate the plugin.xml with the corresponding Eclipse
extension points.
Thus, all the EMF Parsley UI components are
specified in a compact form in a single file instead
of being spread into several Java classes (like what
happens when using EMF and its generated code).
Moreover, EMF Parsley provides some Eclipse
project wizards to create projects configured to get
started with EMF Parsley UI components and its
DSL. These wizards provide initial templates for spe-
cific views (e.g., tree, tree with form, table, etc.).
EMF Parsley leverages the RAP framework to
achieve single-sourcing (Lange, 2009) (before 2012,
the acronym RAP was meant for “Rich Ajax Plat-
form”). RAP provides a widget toolkit that imple-
ments the SWT widgets and other RCP concepts tar-
geting the web platform. Since these custom im-
plementations keep the same name as the standard
SWT ones, by switching the runtime platform from
the standard RCP to the RAP one, the source code us-
ing SWT can be re-used without modifications. One
of RAP’s main goals is to make the web runtime en-
vironment transparent for the developer. In particu-
lar, just by using Java and no HTML or Javascript,
one can create a web application. RAP does not
implement all the RCP/SWT; thus, only the API
available in both runtimes must be used to achieve
single-sourcing. EMF Parsley uses only the com-
mon API, which is available both in RCP and RAP.
This way, applications implemented with EMF Pars-
ley will transparently be implementable with single-
sourcing.
EMF Parsley provides its Eclipse features and
bundles into two separate update sites: one for stan-
dard RCP desktop applications and one for web RAP
applications.
The crucial thing for single-sourcing is to use two
different target platforms, depending on the desired
runtime platform. Eclipse uses a “target platform”
to specify the external dependencies (called bundles
in OSGi). The dependencies specified in the target
platform are used to compile and run the code in an
Eclipse workspace. EMF Parsley provides a wizard
that creates a target definition file already configured
with all the needed dependencies from the RAP ver-
sion of EMF Parsley and additional required RAP de-
pendencies.
Note that an Eclipse workspace can activate a sin-
gle target platform at a time. For this reason, it is best
to have two separate workspaces, one for RCP and
one for RAP, each with the proper target platform en-
abled. Then, we must configure the projects of our
single-sourcing application appropriately. As we will
see later, we will also need two small projects (one for
each runtime platform) to deal with the start of the ap-
MODELSWARD 2024 - 12th International Conference on Model-Based Software and Systems Engineering
220