EMF Compare/Filtering facility

From Eclipsepedia

Jump to: navigation, search

Contents


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:

  • Filter out Structural Differences
    • Hide Addition
    • Hide Removal
    • Hide Modification
    • Hide Move

Each menu entry will be a checkbox button (similar to the ones in the screenshot below), meaning that more than one filter can be selected to customize the content provider of the Diff tree editor.

Checkbox-button-menu.png

Preference page for filter setting configuration

A preference page will be provided to set filter that should be activated by default when the comparison editor is opened. This preference will not be overridable in project-specific preferences as it would add an EMFCompare entry in each project preference page.

Provide an API enabling the contribution of new filters

An API and an extension point will be provided to contribute new filtering facilities. A new filter will have to implement an interface IDifferenceFilter :

/**
 * A filter use to tell if the given DiffElement must be hidden when 
 * this filter is activated.
 */
public interface IDifferenceFilter {
	boolean hide(DiffElement d);
}

The corresponding extension point will be a simple one with two attributes : the name of the filter (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 IDifferenceFilter implementations will be used by the content providers of the diff tree editor to check if the element should be displayed or not.

However, the children of hidden elements MAY be displayed if they are not said to be hidden by the filters.

Prototype

As example, in the plugin.xml has been declared a new filter to filter added elements. Note that the filtering runs on any kind of grouping.

Filtering.png