EMF Parsley: from the model to the UI in a snap
Eclipse Modeling Framework (EMF) models are easily maintainable, useful, pluggable, amongst other things, but building user interfaces (UIs) from a model wasn't always straightforward. This is why EMF Parsley was developed to make creating UIs from EMF models just as easy.
EMF Parsley allows you to build complex custom applications and user interfaces in a matter of minutes. Since, by default, it delegates to EMF.Edit, this means that you can easily port an existing EMF application to EMF Parsley, or simply use both Parsley and your custom .edit plugin projects.
Every single aspect of your project is easily customizable, including label and content providers, resource management, features handling, etc. EMF Parsley does not rely on extension points for specifying customizations: it uses Dependency Injection (relying on Google Guice) and this makes it easy to inject custom implementation in the framework, focusing on the customization of single aspects that will be consistently used by EMF Parsley.
Customizations can be implemented in Java or by using EMF Parsley's flexible Domain Specific Language (DSL).
Summarizing, that is why we think you should use EMF Parsley in your projects:
- it is very lightweight (it just leverages EMF.Edit layer, Eclipse Xtext for the DSL and little more) and can be added to existing projects with minimum impact
- it provides out-of-the-box integrations with XMI, Teneo and CDO persistence implementations (it is however possible - and super easy - to provide your own I/O services)
- it uses Dependency Injection (via Google Guice) instead of Extension Point mechanism
- it ships with an Eclipse/JDT integrated DSL with rich tooling and a static type system
- it is generation-code oriented (debuggable!) instead of using a reflective approach (no bad runtime surprises). This also guarantees seamlessly upgrading when new versions are released
- thanks to the out-of-the-box RAP integration it allows developers to build Web application with the same Eclipse RCP technology stack used for desktop (honoring the web/desktop ‘single-sourcing’ RAP pattern)
Now that we have your attention, find out what's behind the tool and how easy it is to use it!
The Parsley DSL is built with Xtext and Xbase, which allows for compact definition of many aspects. Thanks to Xtext, the DSL provides a rich IDE tooling; just open the DSL editor and make use of Ctrl-space for auto-completion features for example. The entire Java Type-system and APIs are available within Xtext DSLs just like in the standard Java editor. This means that from the DSL you can access all the Java libraries existing in your classpath.
You can write code directly using the DSL or call methods from a Java class if reuse is required. As you write in the DSL editor a set of Java classes are generated and maintained automatically.
The Eclipse Quickfix feature is also available, as in the standard Java editor.
This is where Xbase comes into play and makes the Eclipse IDE tooling integration so seamless and advanced, you can even add breakpoints in the DSL and debug the DSL itself, rather than the generated code.
As you can see below, standard and EMF context menus are easily customizable and Undo/Redo features are managed by EMF Parsley automatically.
The Parsley DSL is statically typed, in order to promote static checks and to catch possible problems during compilation, not at run-time. This means that the DSL strongly differs from purely reflective approaches. The debugging functionality also allows you to have full control of the code. Again, making possible problems easier to spot compared to a reflective runtime approach.
The Parsley DSL is only an additional facility for the usage of EMF Parsley. All EMF Parsley APIs are Java APIs, thus specifications made with the DSL and code written in Java will seamlessly coexist and interoperate.
Usage with a generic service or even non-EMF-models
The fact that Parsley leverages EMF doesn't mean that you can only use it if you adopted EMF for modeling. In fact, although you can have EMF persistence (Teneo and CDO) out-of-the-box, it is extremely easy to provide your own Resource Manager from external services.
For example, you could have web services, legacy code or something else: just wrap your retrieved data in an EMF model as simple as needed and you are done.
Finally, thanks to the data-binding mechanism, any change in the underlying model will be reflected on the UI automatically, so you can focus on the model content instead of dealing with UI custom code.
Single sourcing for Desktop and Web
Switching from RCP Running platform to a RAP (Remote Application Platform) Target Platform allows you to use the same source code to run your application on the Web!
Opening to other development scenarios
Recently the Parsley Core has been decoupled from the UI parts and made accessible in plain JEE projects, throughout JSON APIs. Parsley now works with all of its customizations, even virtually in any UI development environment.
Initial implementations have been made with:
- Mobile Android (using Eclipse Andmore project)
- Mobile Hybrid (using Eclipse Thym project)
EMF Parsley is part of the Eclipse Release Train, so it can be found in the main Eclipse update site.
For up-to-date releases of EMF Parsley, you may want to use our update site:http://download.eclipse.org/emf-parsley/updates
If you want to contribute to EMF Parsley, you can use Oomph: EMF Parsley is listed on the Oomph Catalog, so anyone can setup the development environment to use it or contribute to the project in a matter of minutes.
Toward version 2.0
Along with the 2018 Eclipse release Photon, EMF Parsley will be released with its new 2.0 version.
In this version, APIs will be strongly revisited in order to make them simpler and more usable. However, we will ensure backward compatibility as long as the DSL has been used. (A complete migration guide will be part of the release).
Moreover, it will contain the following features:
- Heavy decoupling from SWT, in order to allow UI rendering with other GUI environments (for a broader web and mobile integration with other frameworks)
- Optimizations & bug fixing
- Developer Tools, like the “Live Preview” that allows the developer to see live the changes specified in the DSL without launching a new Eclipse instance
- New built-in components like Search widget that automatically add a filter to existing viewers
Links & Resources
EMF Parsley EclipseCon Talks
- EclipseCon Europe 2017 - Lesson learned from using Eclipse and EMF for building desktop & web Applications
- EclipseCon France 2017 - The EMF Parsley DSL: an extensive use case of Xtext/Xbase powerful mechanisms
- EclipseCon Europe 2016 - Six good reasons to spice up your projects with EMF Parsley
- EclipseCon France 2016 - Five good reasons to spice up your projects with EMF Parsley
- EclipseCon Europe 2015 - From EMF to UIs: how to use EMF Parsley to get desktop, web and mobile UIs from the model
- EclipseCon Europe 2013 - Add some spice to your application! (using EMF Parsley in your UI)