Commit 24cd309f authored by Hernan Ponce de Leon's avatar Hernan Ponce de Leon
Browse files

Merge branch '3523-reworked' into 'master'

Constraints: Fixup decompose mechanism for constrained model elements

See merge request !25
parents 8842022d 9ac261c4
......@@ -2,7 +2,7 @@ ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN
ConnectorConnectionCompositorBase.java 2c710349fe98f09004521fa68586c020499d6275 GREEN
ConnectorHierarchicElementConnectionCompositorBase.java 6a35ca0237ded34169a5b601b5928f1ba58ef6bc GREEN
ConstraintInstanceContainerCompositor.java 85cee7a6e0dfaf087a13b76069d8acfac7589bef GREEN
HierarchicElementCompositorBase.java cb429c41d6babd6f285e47144288971338aed159 GREEN
HierarchicElementCompositorBase.java eed5112371a5819843d65ab8463ec385e50ed1e4 GREEN
HierarchicElementConnectionCompositorBase.java 08e315fed95d7c45ad5f00b3258fd13b811dbcfb GREEN
HierarchicElementConnectorConnectionCompositorBase.java eba2318c219f796c73ac0ad0344088298c268eb9 GREEN
LogMessageUserInteractionContext.java b145045589fba08b67a12b5d41c51729aa4ae94e GREEN
......
......@@ -18,7 +18,6 @@ package org.fortiss.tooling.base.compose;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
......@@ -27,7 +26,6 @@ import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
......@@ -36,7 +34,7 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
* Base implementation of a compositor for {@link IHierarchicElementContainer}s
* focusing on the remove mechanism.
*
* @author doebber, reaboi
* @author doebber
*/
public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElementContainer>
extends ModelElementCompositorBase<HE> {
......@@ -46,27 +44,9 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem
*/
@Override
public final boolean decompose(EObject contained) {
// Removes first the constraints
List<ConstraintInstance> ciList = new ArrayList<ConstraintInstance>();
List<IConstrained> cList = new ArrayList<IConstrained>();
// If there exist any constraints, remove them first to avoid verification launches due to
// EMF notifications when the container is removed.
if(contained instanceof IConstrained) {
for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) {
for(IConstrained c : ci.getConstraineds()) {
if(c != contained) {
ciList.add(ci);
cList.add(c);
}
}
}
// Should be removed outside of an iterator
if(!ciList.isEmpty()) {
for(int index = 0; index < ciList.size(); index++) {
IConstrained c = cList.get(index);
ConstraintInstance ci = ciList.get(index);
c.getConstraintInstances().remove(ci);
}
}
((IConstrained)contained).getConstraintInstances().clear();
}
return iterateDecompose(contained) && decomposeSpecific(contained);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment