Skip to content
Snippets Groups Projects
Commit f3cc89e2 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

filterID utility method

refs 2712
parent 0c52fced
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,10 @@ import java.util.NoSuchElementException;
import java.util.function.Consumer;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.IConstraint;
import org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.model.constraints.ConstraintsFactory;
import org.fortiss.tooling.kernel.model.constraints.ErrorConstraintInstanceStatus;
......@@ -244,4 +246,18 @@ public class ConstraintsUtils {
fix.accept(status);
}
}
/** Removes the IDs of the given object and of its sub-elements. */
public static void filterIDs(EObject obj) {
if(obj instanceof IIdLabeled) {
((IIdLabeled)obj).setId(0);
}
TreeIterator<EObject> it = obj.eAllContents();
while(it.hasNext()) {
EObject elt = it.next();
if(elt instanceof IIdLabeled) {
((IIdLabeled)elt).setId(0);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment