EMF Parsley: building UIs productively!


Introduction

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 is very powerful and allows you to build complex custom applications and user interfaces in a matter of minutes. It's even compatible with any UI technology such as desktop, web development and mobile, thanks to the recent efforts leveraging the Parsley core over the JSON protocol.

Every single aspect of your project is easily customizable, including label and content providers, resource management, features handling, etc.. They are also maintained in a consistent way thanks to EMF Parsley's flexible Domain Specific Language (DSL) and the help of the powerful Google Guice dependency injection framework. It is also easy to incrementally or partially port an existing EMF application to EMF Parsley since EMF Parsley relies on EMF.Edit for the default behaviors.

Now that we have your attention, find out what's behind the tool and how easy it is to use it!

Parsley DSL

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.




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 on 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 databinding 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:

  • AngularJS
  • GWT
  • Mobile Android (using Eclipse Andmore project)
  • Mobile Hybrid (using Eclipse Thym project)



Getting Started

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.




Links & Resources

EMF Parsley EclipseCon Talks

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)

Other useful resources:

About the Authors