Skip to content
Snippets Groups Projects
Commit 816f7f6e authored by dgelessus's avatar dgelessus
Browse files

Simplify EventBMerger.isMergerFor using namespace URIs

This way, we don't have to explicitly list all EMF-EventB core package
names, and avoid potential problems with other plugins that use the same
unqualified names.
parent 82c56d78
Branches
Tags
No related merge requests found
package org.eventb.texttools.diffmerge;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.ReferenceChange;
......@@ -8,7 +7,7 @@ import org.eclipse.emf.compare.merge.AbstractMerger;
import org.eclipse.emf.compare.merge.AttributeChangeMerger;
import org.eclipse.emf.compare.merge.ReferenceChangeMerger;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eventb.emf.core.EventBObject;
import org.eventb.texttools.TextPositionUtil;
......@@ -19,20 +18,18 @@ public class EventBMerger extends AbstractMerger {
@Override
public boolean isMergerFor(Diff target) {
String pack = "";
EStructuralFeature thing;
if (target instanceof ReferenceChange) {
ReferenceChange rc = (ReferenceChange) target;
pack = rc.getReference().getEContainingClass().getEPackage().getName();
//System.out.println("REF PACK:"+pack);
thing = rc.getReference();
} else if (target instanceof AttributeChange) {
AttributeChange ac = (AttributeChange) target;
pack = ac.getAttribute().getEContainingClass().getEPackage().getName();
//System.out.println("ATTR PACK:"+pack);
thing = ac.getAttribute();
} else {
System.out.println("TARGET:"+target);
return false;
}
return pack.equals("core") || pack.equals("machine") || pack.equals("context") || pack.equals("formulas");
String namespaceURI = thing.getEContainingClass().getEPackage().getNsURI();
return namespaceURI.startsWith("http://emf.eventb.org/models/core/");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment