From 29c1753de59f0e814ba7e5d9cedb7b41ff173367 Mon Sep 17 00:00:00 2001 From: Erwann Traisnel Date: Wed, 1 Mar 2023 15:28:17 +0100 Subject: [PATCH] #2607 RootQueries now applies on ExtensibleElement RootQueries 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/query/IRootQueries.java | 6 +++--- .../model/helpers/query/impl/RootQueries.java | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) 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;