EMF Compare/Grouping facility

From Eclipsepedia

Jump to: navigation, search

The capability to group differences will be provided by a menu next to the save diff model button. This button will be same for Grouping and Filtering. The tooltip will be "Group/Filter difference elements". The icon is to be defined.

Comparison tree editor uml save bordered.png

The provided menu will be organized as follow:

  • Group Structural Differences
    • By File
    • By Modification Type
    • By Metamodel Element

Each element will be a radio button (as the ones in the following screenshot), meaning that only one grouping facility can be selected at at time.

Example of radio button menu

An API and an extension point will be provided to contribute new grouping facilities. A new group will have to implement an interface IGroupFilter:

/**
 * Returns the group to which the given DiffElement belongs to.
 */
public interface IGroupFilter {
	UIDifferenceGroup belongsTo(DiffElement d);
}

The corresponding extension point will be a simple one with two attributes : the name of the group (string type) and the implementation class (java type).

The extension point will be implemented by the classical tryptic :

  • ExtensionDescriptor (to support lazy loading)
  • ExtensionRegistry will be the bridge between the plugin registry and emfcompare
  • ExtensionRegistryListener to listen installation and de-installation of contributing plugins.

The IGroupFilter implementations will be used to fill a MultiMap (e.g. Map<UIDifferenceGroup, List<? extends DiffElement>>) of DiffElement by object as returned by the method belongsTo(). This MultiMap will be filled by visiting the whole DiffElement content tree.

Prototype

As example, in the plugin.xml has been declared a new grouping facility, to manage kinds of changes, which defines 2 groups: one to store additions and an other to store all what is not an addition change.

Default.png

Grouping.png