Commit 9db414dc authored by Simon Barner's avatar Simon Barner
Browse files

AllocationTableCollectionCompositorBase: Remove empty AllocationTableCollections

refs 2950
parent acc63acb
AllocationTableCollectionCompositorBase.java fd0a04a506bcaf57e8dcbec670ff33b7e71e81db YELLOW
AllocationTableCollectionCompositorBase.java 68485b24f8d8dfe82b4c792fe3b7e49bd5078ada YELLOW
AllocationTableCollectionFileProjectCompositor.java a762868e5034848735b548cbbbd3661e63452db7 GREEN
......@@ -27,6 +27,7 @@ import org.fortiss.tooling.base.compose.ModelElementCompositorBase;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
/**
* Base compositor for adding {@link AllocationTable} specializations to
......@@ -172,4 +173,18 @@ public abstract class AllocationTableCollectionCompositorBase extends
return true;
}
/** {@inheritDoc} */
@Override
public boolean decompose(EObject contained) {
EObject eContainer = contained.eContainer();
// Remove empty AllocationTableCollections
boolean rval = super.decompose(contained);
if(eContainer.eContents().isEmpty()) {
rval &= IElementCompositorService.getInstance().decompose(eContainer);
}
return rval;
}
}
AllocationModelElementFactory.java 0d13ccc9da944dd9a25db262eb1fa47d1a9582e9 YELLOW
AllocationUtils.java 2ab0769710bb0bb0f8c05e2f2b23e9493d75b0cc YELLOW
AllocationUtils.java 895abb74f059e0bff2d2be8b29851afdc596497a YELLOW
......@@ -18,6 +18,7 @@ package org.fortiss.af3.allocation.utils;
import static org.eclipse.emf.ecore.util.EcoreUtil.create;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.createAllocationEntry;
import static org.fortiss.af3.allocation.utils.AllocationModelElementFactory.createAllocationTableCollection;
import static org.fortiss.af3.project.utils.ProjectUtils.getFileProject;
import static org.fortiss.tooling.common.util.LambdaUtils.asStream;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getEClassForClass;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
......@@ -38,7 +39,6 @@ import org.fortiss.af3.allocation.model.OneToOneAllocationEntry;
import org.fortiss.af3.allocation.model.ParameterEntry;
import org.fortiss.af3.allocation.model.ParameterTable;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
......@@ -405,7 +405,7 @@ public class AllocationUtils {
// Create and initialize new one
AllocationTableCollection atc = createAllocationTableCollection("Allocations");
FileProject fileProject = ProjectUtils.getFileProject(modelRef);
FileProject fileProject = getFileProject(modelRef);
IElementCompositorService cs = IElementCompositorService.getInstance();
cs.compose(fileProject, atc, null);
@SuppressWarnings("unchecked") T at = (T)create(getEClassForClass(allocationTableType));
......
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