Difference between revisions of "EMF Compare/API Viewer FilteringGrouping"

From Eclipsepedia

Jump to: navigation, search
(New page: The API has to allow to launch a graphical comparison of models, specifying the filters to activate and the grouping configuration to use.)
 
Line 1: Line 1:
The API has to allow to launch a graphical comparison of models, specifying the filters to activate and the grouping configuration to use.
+
The API has to allow to launch a graphical comparison of models, specifying the filters to activate and the grouping configuration to use.  
 +
 
 +
It is the service class: CompareServices which contains this API:
 +
 
 +
*<pre>void openView(final ComparisonSnapshot input, final List&lt;IDifferenceFilter&gt; filters, final IDifferenceGroupingFacility group)
 +
</pre>
 +
 
 +
It enables to open the structure view from a comparion result (snapshot) with a given filtering and grouping configuration.
 +
 
 +
Here is an exemple to call this method:
 +
 
 +
----
 +
 
 +
final List&lt;IDifferenceFilter&gt; filters = DifferenceFilterRegistry.INSTANCE.getFilters(DifferenceFilterRegistry.FILTERING_ADDED_ELEMENTS_ID);
 +
 
 +
final ISelectionProvider provider = editor.getEditorSite().getSelectionProvider();
 +
 
 +
if (provider instanceof IInputProvider) {
 +
 
 +
&nbsp; final Object root = ((IInputProvider)provider).getInput();
 +
 
 +
&nbsp; if (root instanceof ComparisonSnapshot) {
 +
 
 +
&nbsp;&nbsp;&nbsp; CompareServices.openView((ComparisonSnapshot)root, filters, null);
 +
 
 +
&nbsp; }
 +
 
 +
}
 +
 
 +
----

Revision as of 04:59, 13 October 2011

The API has to allow to launch a graphical comparison of models, specifying the filters to activate and the grouping configuration to use.

It is the service class: CompareServices which contains this API:

  • void openView(final ComparisonSnapshot input, final List<IDifferenceFilter> filters, final IDifferenceGroupingFacility group)
    

It enables to open the structure view from a comparion result (snapshot) with a given filtering and grouping configuration.

Here is an exemple to call this method:


final List<IDifferenceFilter> filters = DifferenceFilterRegistry.INSTANCE.getFilters(DifferenceFilterRegistry.FILTERING_ADDED_ELEMENTS_ID);

final ISelectionProvider provider = editor.getEditorSite().getSelectionProvider();

if (provider instanceof IInputProvider) {

  final Object root = ((IInputProvider)provider).getInput();

  if (root instanceof ComparisonSnapshot) {

    CompareServices.openView((ComparisonSnapshot)root, filters, null);

  }

}