EMF Forms 1.8.0 Feature: Ecore Editor Reloaded

February 11, 2016 | 4 min Read

With Mars.2, we release EMF Forms 1.8.0. EMF Forms makes it really simple to create forms that edit your data, based on an EMF model. To get started with EMF Forms please refer to our getting started tutorial. In this post, we want to outline one of the new features: a new version of the Ecore editor based on EMF Forms. We will also have a talk on EclipseCon North America 2016 about it. Along with the new version of the standard Ecore editor, we also provide a generic editor to be used with your custom model, an alternative for the “generated editor”.

Ecore Editor

Most of the developers who use EMF have used the good-old default Ecore editor:

While there are other tools such as the graphical Ecore Tools or Xcore to create models, the tree-based editor is still extremely beneficial. It is simple to use and allows you to specify models fairly efficiently. However, the implementation is over 10 years old and hasn’t received much “love” since then. EMF Forms was created to build form-based UIs based on existing EMF data models. Those forms are often used in editors, which allow the modification of models. Luckily, there is an EMF model for Ecore itself, that means, Ecore itself is just another EMF model. Therefore, we were able to use the full power of EMF Forms to build a new version of the standard Ecore editor:

As you can see, we got rid of the properties view and combined the tree and the properties in one editor. We ordered the properties by importance (instead of the former alphabetical order), grouped them, and combined some fields, such as lower and upper bounds. Where it made sense, we added custom controls, e.g. to support auto-completion. Finally, we added shortcuts and dialogs for the creation of new elements. This enables you to specify a model without leaving the keyboard and therefore, improves efficiency.

Of course an Ecore editor does not make much sense without a Genmodel editor, therefore we reworked this as well:

Both editors are unfortunately not yet part of an Eclipse package, but they are part of the EMF Client Platform 1.8.0 release. Please see this tutorial on how to install and how to use them.

As the implementation of both editors shares most of the code, we even went step further and also implemented a completely generic editor, which is capable of opening any kind of custom model. This editor is described in the following section.

Generic Editor

Another tool that is frequently used by EMF developers is the generated editor. It allows you to create instances of a given EMF model and thereby provides an easy way of testing a defined model. As the Ecore editor, the generated editor has room for improvement. It was initially only meant as a simple code example. It lacks extensibility and adaptability and is therefore, not a very good starting point for the implementation of a custom editor. To get around this, we also provide a generic editor based on EMF Forms, which works with any custom model. It supports features such as loading/saving, DnD, and undo out of the box. Further it uses EMF Forms for rendering, so you can adapt the controls and layouts used in the detail views as you wish. To make that clear: It provides you with a fully functional Eclipse editor for creating and modifying instances of your custom model, without any coding, code generation, or adaptation!

All three editors, the Ecore editor, the Genmodel editor and the generic editor are currently under active development and will be contributing to Neon. If you are interested in trying them out, please follow this tutorial. Please provide feedback by submitting bugs or feature requests or contact us if you are interested in enhancements or support.

If you want to see these editors live in action, join us on EclipseCon North America and join our talk about them.

Jonas, Maximilian & Philip

Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource. They work as consultants and software engineers for building web-based and desktop-based tools. …