Skip to content
Snippets Groups Projects
Commit 11dc578c authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Constraints: Fixup decompose mechanism for constrained model elements

* In the decompose mechanism, the constrained instances are duplicated
  since the resolution of #3293. It is sufficient to remove the
  contrained instances from the container by clearing the list since
  the hierarchical decomposition takes care of the destruction of
  contained specifications.
* Tests: Deleting a component with a test suite succeeds, deleting
  test suites and test suite specs succeeds. The "All tests pass"
  constraint seems to work: It is marked green in a one-component system
  with a "successful" test suite (NOTE: there are currently focus
  problems, so one might need to click into the navigator).

Issue-Ref: 3523
Issue-Url: https://af3-developer.fortiss.org/issues/3523


Signed-off-by: default avatarAlexander Diewald <diewald@fortiss.org>
parent e332be9b
No related branches found
No related tags found
1 merge request!25Constraints: Fixup decompose mechanism for constrained model elements
......@@ -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 0f42b00388aad5cbf463facb03c8993d8bb7357d YELLOW
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;
......@@ -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);
......
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