Commit 9670f2ce authored by reaboi's avatar reaboi
Browse files

3293 deleting a component having a test suite



YELLOW

Signed-off-by: default avatarreaboi <reaboi@fortiss.org>
parent 028c09c0
...@@ -2,7 +2,7 @@ ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN ...@@ -2,7 +2,7 @@ ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN
ConnectorConnectionCompositorBase.java 2c710349fe98f09004521fa68586c020499d6275 GREEN ConnectorConnectionCompositorBase.java 2c710349fe98f09004521fa68586c020499d6275 GREEN
ConnectorHierarchicElementConnectionCompositorBase.java 6a35ca0237ded34169a5b601b5928f1ba58ef6bc GREEN ConnectorHierarchicElementConnectionCompositorBase.java 6a35ca0237ded34169a5b601b5928f1ba58ef6bc GREEN
ConstraintInstanceContainerCompositor.java 85cee7a6e0dfaf087a13b76069d8acfac7589bef GREEN ConstraintInstanceContainerCompositor.java 85cee7a6e0dfaf087a13b76069d8acfac7589bef GREEN
HierarchicElementCompositorBase.java e96b8a5a2cdb946f135edb2c2248a476e2f870ef GREEN HierarchicElementCompositorBase.java cb429c41d6babd6f285e47144288971338aed159 YELLOW
HierarchicElementConnectionCompositorBase.java 08e315fed95d7c45ad5f00b3258fd13b811dbcfb GREEN HierarchicElementConnectionCompositorBase.java 08e315fed95d7c45ad5f00b3258fd13b811dbcfb GREEN
HierarchicElementConnectorConnectionCompositorBase.java eba2318c219f796c73ac0ad0344088298c268eb9 GREEN HierarchicElementConnectorConnectionCompositorBase.java eba2318c219f796c73ac0ad0344088298c268eb9 GREEN
LogMessageUserInteractionContext.java b145045589fba08b67a12b5d41c51729aa4ae94e GREEN LogMessageUserInteractionContext.java b145045589fba08b67a12b5d41c51729aa4ae94e GREEN
......
...@@ -18,6 +18,7 @@ package org.fortiss.tooling.base.compose; ...@@ -18,6 +18,7 @@ package org.fortiss.tooling.base.compose;
import static org.eclipse.emf.ecore.util.EcoreUtil.delete; import static org.eclipse.emf.ecore.util.EcoreUtil.delete;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
...@@ -35,7 +36,7 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService; ...@@ -35,7 +36,7 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
* Base implementation of a compositor for {@link IHierarchicElementContainer}s * Base implementation of a compositor for {@link IHierarchicElementContainer}s
* focusing on the remove mechanism. * focusing on the remove mechanism.
* *
* @author doebber * @author doebber, reaboi
*/ */
public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElementContainer> public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElementContainer>
extends ModelElementCompositorBase<HE> { extends ModelElementCompositorBase<HE> {
...@@ -46,14 +47,26 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem ...@@ -46,14 +47,26 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem
@Override @Override
public final boolean decompose(EObject contained) { public final boolean decompose(EObject contained) {
// Removes first the constraints // Removes first the constraints
List<ConstraintInstance> ciList = new ArrayList<ConstraintInstance>();
List<IConstrained> cList = new ArrayList<IConstrained>();
if(contained instanceof IConstrained) { if(contained instanceof IConstrained) {
for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) { for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) {
for(IConstrained c : ci.getConstraineds()) { for(IConstrained c : ci.getConstraineds()) {
if(c != contained) { if(c != contained) {
c.getConstraintInstances().remove(ci); 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(); ((IConstrained)contained).getConstraintInstances().clear();
} }
return iterateDecompose(contained) && decomposeSpecific(contained); return iterateDecompose(contained) && decomposeSpecific(contained);
......
Supports Markdown
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