Commit 4a1b4740 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

constraint removal by default

refs 2885
parent 0b3f74bf
......@@ -28,6 +28,8 @@ 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;
......@@ -38,7 +40,7 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
* @author doebber
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 213E75CDA52B53F686EB057F4997FFB7
* @ConQAT.Rating YELLOW Hash: 4906F0460532A087B908F48F77EC100C
*/
public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElementContainer>
extends ModelElementCompositorBase<HE> {
......@@ -48,6 +50,15 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem
*/
@Override
public final boolean decompose(EObject contained) {
// Removes first the constraints
if(contained instanceof IConstrained) {
for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) {
for(IConstrained c : ci.getConstraineds()) {
c.getConstraintInstances().remove(ci);
}
EcoreUtil.delete(ci, true);
}
}
return iterateDecompose(contained) && decomposeSpecific(contained);
}
......
......@@ -33,6 +33,8 @@ import org.fortiss.tooling.kernel.extension.IElementCompositor;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -43,7 +45,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author diewald
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: D0431D84DF7559E6C1D2C46B0796E8DE
* @ConQAT.Rating YELLOW Hash: 4EB492F5A289867C7D1829B76C9ABD97
*/
public abstract class ModelElementCompositorBase<C extends EObject> extends Observable implements
IElementCompositor<C> {
......@@ -86,11 +88,20 @@ public abstract class ModelElementCompositorBase<C extends EObject> extends Obse
* Decomposition that takes care of deleting {@link IModelElement} specific references etc..
* </p>
* <p>
* <b>Note: Derived compositors MAY NOT CALL THIS METHOD via {@code supde.decompose(...)}!.</b>
* <b>Note: Derived compositors MAY NOT CALL THIS METHOD via {@code super.decompose(...)}!.</b>
* </p>
*/
@Override
public boolean decompose(EObject contained) {
// Removes first the constraints
if(contained instanceof IConstrained) {
for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) {
for(IConstrained c : ci.getConstraineds()) {
c.getConstraintInstances().remove(ci);
}
EcoreUtil.delete(ci, true);
}
}
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