From b29c38864c5fa862ff34dfc5012640aff83b1465 Mon Sep 17 00:00:00 2001 From: Erwann Traisnel Date: Wed, 1 Mar 2023 15:28:17 +0100 Subject: [PATCH] #2607 SystemEngineeringExt.getSystemEngineering now applies on ExtensibleElement SystemEngineeringExt.getSystemEngineering used to apply on CapellaElement, but it is required to apply on ExtensibleElement to be compatible with viewpoints Change-Id: Ie59232acafef9c2a47eafd8deeb21bcdc1d858f1 Signed-off-by: Erwann Traisnel --- .../model/helpers/SystemEngineeringExt.java | 3 ++- .../model/helpers/query/IRootQueries.java | 6 +++--- .../model/helpers/query/impl/RootQueries.java | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/SystemEngineeringExt.java b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/SystemEngineeringExt.java index bef5905d48..d9e85c4e55 100644 --- a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/SystemEngineeringExt.java +++ b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/SystemEngineeringExt.java @@ -62,6 +62,7 @@ import org.polarsys.capella.core.data.sharedmodel.SharedPkg; import org.polarsys.capella.core.model.helpers.query.CapellaQueries; import org.polarsys.capella.core.model.utils.CollectionExt; +import org.polarsys.kitalpha.emde.model.ExtensibleElement; /** * SystemEngineering helpers @@ -781,7 +782,7 @@ public static Component getSystem(SystemEngineering currentElement) { return null; } - public static SystemEngineering getSystemEngineering(CapellaElement currentElement) { + public static SystemEngineering getSystemEngineering(ExtensibleElement currentElement) { SystemEngineering sysEng = CapellaQueries.getInstance().getRootQueries().getSystemEngineering(currentElement); return sysEng; } diff --git a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/IRootQueries.java b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/IRootQueries.java index 8e28bca988..94ef394ecf 100644 --- a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/IRootQueries.java +++ b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/IRootQueries.java @@ -15,7 +15,7 @@ import org.polarsys.capella.core.data.capellamodeller.Project; import org.polarsys.capella.core.data.capellamodeller.SystemEngineering; -import org.polarsys.capella.common.data.modellingcore.ModelElement; +import org.polarsys.kitalpha.emde.model.ExtensibleElement; /** * Root queries for the Sys & Soft models. @@ -27,7 +27,7 @@ public interface IRootQueries { * @param modelElement a business element * @return the system engineering (or null if it does not exist) */ - SystemEngineering getSystemEngineering(ModelElement modelElement); + SystemEngineering getSystemEngineering(ExtensibleElement modelElement); - public Project getProject(ModelElement modelElement); + public Project getProject(ExtensibleElement modelElement); } diff --git a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/impl/RootQueries.java b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/impl/RootQueries.java index 1c3aa81962..f540222298 100644 --- a/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/impl/RootQueries.java +++ b/core/plugins/org.polarsys.capella.core.model.helpers/src/org/polarsys/capella/core/model/helpers/query/impl/RootQueries.java @@ -13,10 +13,11 @@ package org.polarsys.capella.core.model.helpers.query.impl; +import org.polarsys.capella.common.data.modellingcore.ModelElement; import org.polarsys.capella.core.data.capellamodeller.Project; import org.polarsys.capella.core.data.capellamodeller.SystemEngineering; import org.polarsys.capella.core.model.helpers.query.IRootQueries; -import org.polarsys.capella.common.data.modellingcore.ModelElement; +import org.polarsys.kitalpha.emde.model.ExtensibleElement; public class RootQueries implements IRootQueries { /** @@ -24,35 +25,35 @@ public class RootQueries implements IRootQueries { * @see org.polarsys.capella.core.model.helpers.query.IRootQueries#getSystemEngineering() * @param modelElement a business element */ - public SystemEngineering getSystemEngineering(ModelElement modelElement) { + public SystemEngineering getSystemEngineering(ExtensibleElement modelElement) { return (SystemEngineering) getSystemEngineeringRecursively(modelElement); } - private ModelElement getSystemEngineeringRecursively(ModelElement modelElement) { + private ModelElement getSystemEngineeringRecursively(ExtensibleElement modelElement) { ModelElement result; if (null == modelElement) { result = null; } else if (modelElement instanceof SystemEngineering) { - result = modelElement; + result = (ModelElement) modelElement; } else { - ModelElement container = (ModelElement) modelElement.eContainer(); + ExtensibleElement container = (ExtensibleElement) modelElement.eContainer(); result = getSystemEngineeringRecursively(container); } return result; } - public Project getProject(ModelElement modelElement) { + public Project getProject(ExtensibleElement modelElement) { return (Project) getProjectRecursively(modelElement); } - private ModelElement getProjectRecursively(ModelElement modelElement) { + private ModelElement getProjectRecursively(ExtensibleElement modelElement) { ModelElement result; if (null == modelElement) { result = null; } else if (modelElement instanceof Project) { - result = modelElement; + result = (ModelElement) modelElement; } else { - ModelElement container = (ModelElement) modelElement.eContainer(); + ExtensibleElement container = (ExtensibleElement) modelElement.eContainer(); result = getProjectRecursively(container); } return result;