Hiding nodes in the model tree [message #1385965] |
Thu, 12 June 2014 09:47  |
Eclipse User |
|
|
|
Hi,
I'm new to coding with EMF Compare, so I might have overlooked something well-known, please let me know if that's the case. 
I would like to hide some tree nodes in the match results, since they are just containers with no meaning to our users.
This is an actual example, where the two instances of "RT Variable Setup List" should be hidden:
> settings
> RT Variable Setup List
> v2
> RT Variable Setup List
> field4
[details of diff]
> field6
[details of diff]
So, I would want this instead:
> settings
> v2
> field4
[details of diff]
> field6
[details of diff]
since that matches the actual model, known by our users.
I have tried tweaking the scope by removing the class that represents those nodes. That ruins the tree structure, so I only get the separate diffs in the top "Model differences" view. I would like to get a trimmed tree structure.
I attach the saved comparisons, in case that helps.
What I have done:
...
DefaultComparisonScope scope = new DefaultComparisonScope(changedModel, referenceModel, null);
scope.setEObjectContentFilter(and(not(IS_RT_VARIABLE_SETUP_LIST), not(IS_EGENERIC_TYPE_WITHOUT_PARAMETERS)));
scope.setResourceContentFilter(and(not(IS_RT_VARIABLE_SETUP_LIST), not(IS_EGENERIC_TYPE_WITHOUT_PARAMETERS)));
result = comparator.compare(scope);
...
with this new Predicate, which is combined with the default scope Predicate.
/**
* Predicate used to know if the given object is an Domain object that should not be included in matching.
*
* @return true, if the given EObject is an DomainRTVariableSetupList, false otherwise.
*/
public static final Predicate<? super EObject> IS_RT_VARIABLE_SETUP_LIST = new Predicate<EObject>() {
public boolean apply(EObject input) {
return input instanceof DomainRTVariableSetupList;
}
};
I'd really appreciate some pointers as to how to move forward with this.
Thanks,
Mattias
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03949 seconds