EMF Forms 1.21.0 Feature: Multi Edit for Tables and Trees

July 15, 2019 | 2 min Read

EMF Forms makes it easy to create forms that are able to edit your data based on an EMF model. To get started with EMF Forms please refer to our tutorial. In this article, we would like to outline a new feature in the 1.21.0 release: The support for simultaneously editing multiple EObjects in trees and tables (multi edit).

In some use cases, you might want to enable the users of a form to edit several objects at the same time.

To be more precise, a user can modify an attribute of several objects to the same value with one operation. EMF Forms support this feature in tables and tree master detail elements. To turn the feature on, you simply need to add a value to the view context before rendering:

viewModelContext.putContextValue("enableMultiEdit", Boolean.TRUE);

In tables, you can just press the “Shift” key and the drag a value up or down within the same column to set the same value to other objects shown in the same table. Please note that this feature is only supported by the table renderer based on nebula grid (see this blog post for details).

TreeViewers with multi editing enabled, will allow you to select several objects and modify their attributes in the details pane. To allow doing so, EMF Forms will first calculate the minimal common denominator of available attributes, meaning attributes that are contained in all selected objects. The detail pane will only show those attributes. If you select only objects of the same type, the detail pane will consequently show all available attributes. If all selected objects contain the same value for a certain attribute, it will be shown in the corresponding field. Otherwise, if the values differ, the respective field will be empty (see example in the screenshot below). Finally, if you now modify any of the shown fields in the detail pane, this change will be applied to all selected objects.

As for all EMF Forms features, the multi edit mechanism for trees and tables is of course adaptable to even more custom requirements. If there are any features you miss or ways you wish to adapt it, please provide feedback by submitting bugs or feature requests or contact us if you are interested in enhancements or support.

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. …