Skip to content
Snippets Groups Projects
Commit 9d4eabd9 authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Kernel: Improved comments and added util


Fixed review comments.

Issue-ref: 4244
Issue-URL: af3#4244

Signed-off-by: default avatarAndreas Bayha <bayha@fortiss.org>
parent 4fc5e8b4
No related branches found
No related tags found
1 merge request!1794244
Pipeline #35540 passed
Pipeline: maven-releng

#35541

    This commit is part of merge request !179. Comments created here will be created in the context of that merge request.
    VariabilityUtils.java 8ac97aafcbc2409ee39a5d9ee85f234a49bb2079 RED
    VariabilityUtils.java ccbcc8a13557a107608130e25880f9523b84cfba YELLOW
    ......@@ -16,6 +16,7 @@
    package org.fortiss.tooling.ext.variability.util;
    import static org.fortiss.tooling.ext.variability.model.VariabilityModelElementFactory.createOptionalVariationPointSpecification;
    import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
    import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
    import org.eclipse.emf.ecore.EObject;
    ......@@ -71,17 +72,14 @@ public class VariabilityUtils {
    return true;
    }
    // TODO (TM): Use the methods provided by the `EcoreUtils`. `isAncestor()` can replace the
    // check whether the `eContainer` is `null` and `getFirstChildWithType()` can be used to see
    // whether any `AbstractFeatureModel` is present.
    // Check whether the root container contains any AbstractFeatureModel
    // Find the root container (usually a FileProject)
    EObject topLevelElem = element;
    while(topLevelElem.eContainer() != null) {
    topLevelElem = topLevelElem.eContainer();
    }
    return topLevelElem.eContents().stream().anyMatch(c -> c instanceof AbstractFeatureModel);
    // Check whether this root container contains any AbstractFeatureModel.
    return getFirstChildWithType(topLevelElem, AbstractFeatureModel.class) != null;
    }
    /**
    ......
    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