| Summary: | IMatchScope are not used to filter out model roots in GenericMatchEngine | ||
|---|---|---|---|
| Product: | [Modeling] EMFCompare | Reporter: | Mikaël Barbero <mikael.barbero> |
| Component: | Core | Assignee: | EMF Compare <emf.compare-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | laurent.goubet, mikael.barbero |
| Version: | unspecified | Flags: | laurent.goubet:
iplog+
|
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Thanks for the feedback. This has now been fixed on master and will also find its way in the 1.2.1. |
In GenericMatchEngine, MatchModel.leftRoots and MatchModel.rightRoots are always referencing all left and right resources roots without taking into account given IMatchScope. I think it is a bug as there is no reason to consider model roots as elements that can not be filtered out. Here is the new setModelRoots(MatchModel, EObject, EObject, EObject) method. protected void setModelRoots(MatchModel modelRoot, EObject left, IMatchScope leftScope, EObject right, IMatchScope rightScope, EObject ancestor, IMatchScope ancestorScope) { // Sets values of left, right and ancestor model roots if (left != null && left.eResource() != null) { for (EObject contents : left.eResource().getContents()) { if (leftScope.isInScope(contents)) { modelRoot.getLeftRoots().add(contents); } } } if (right != null && right.eResource() != null) { for (EObject contents : right.eResource().getContents()) { if (rightScope.isInScope(contents)) { modelRoot.getRightRoots().add(contents); } } } if (ancestor != null && ancestor.eResource() != null) { for (EObject contents : ancestor.eResource().getContents()) { if (ancestorScope.isInScope(contents)) { modelRoot.getAncestorRoots().add(contents); } } } } and its direct caller for two-ways diff: protected void setModelRoots(MatchModel modelRoot, EObject left, IMatchScope leftScope, EObject right, IMatchScope rightScope) { setModelRoots(modelRoot, left, leftScope, right, rightScope, null, null); } Then you just have to fix compilation errors by calling the new methods adding appropriate scopes (4 calls in GenericMatchEngine)