diff --git a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/diagram/CapellaHelper.java b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/diagram/CapellaHelper.java index 41bb3c22..3fb0bb3c 100644 --- a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/diagram/CapellaHelper.java +++ b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/diagram/CapellaHelper.java @@ -14,6 +14,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashSet; +import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -33,9 +34,11 @@ import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.sirius.viewpoint.description.DAnnotation; import org.eclipse.sirius.viewpoint.description.DescriptionPackage; +import org.polarsys.capella.common.data.modellingcore.AbstractType; +import org.polarsys.capella.common.data.modellingcore.AbstractTypedElement; import org.polarsys.capella.core.data.capellacore.CapellaElement; import org.polarsys.capella.core.data.cs.BlockArchitecture; -import org.polarsys.capella.core.data.cs.Component; +import org.polarsys.capella.core.data.information.AbstractInstance; import org.polarsys.capella.core.diagram.helpers.naming.DAnnotationSourceConstants; import org.polarsys.kitalpha.doc.gen.business.core.preference.helper.DocgenDiagramPreferencesHelper; import org.polarsys.kitalpha.doc.gen.business.core.scope.GenerationGlobalScope; @@ -123,8 +126,18 @@ private static EList resolveReferencedElements(EObject element) { EList objects = new BasicEList(); objects.add(element); // If we have a Component then we look also for Parts - if (element instanceof Component) { - objects.addAll(((Component)element).getAbstractTypedElements()); + if (element instanceof AbstractType) { + List ates = ((AbstractType)element).getAbstractTypedElements(); + objects.addAll(ates); + // Then we look for InstanceRoles for these parts + for (EObject ate : ates) { + if (element instanceof AbstractInstance) { + objects.addAll(((AbstractInstance)ate).getRepresentingInstanceRoles()); + } + } + } + if (element instanceof AbstractInstance) { + objects.addAll(((AbstractInstance)element).getRepresentingInstanceRoles()); } return objects; } diff --git a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDiagramHelper.java b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDiagramHelper.java index 1c2caf4a..b5acd6d3 100644 --- a/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDiagramHelper.java +++ b/docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDiagramHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2018 THALES GLOBAL SERVICES. + * Copyright (c) 2006, 2019 THALES GLOBAL SERVICES. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,8 +12,10 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.diagram.DDiagramElement; +import org.polarsys.capella.core.data.capellacommon.AbstractState; import org.polarsys.capella.core.data.capellacore.NamedElement; import org.polarsys.capella.core.data.cs.ExchangeItemAllocation; +import org.polarsys.capella.core.data.fa.AbstractFunction; import org.polarsys.capella.core.data.fa.FunctionalChainInvolvement; import org.polarsys.capella.core.data.information.AbstractEventOperation; import org.polarsys.capella.core.data.interaction.Execution; @@ -72,7 +74,14 @@ public EObject getSemanticElement(DDiagramElement element) { return null; } if (target instanceof StateFragment) { - return ((StateFragment) target).getRelatedAbstractFunction(); + AbstractState aState = ((StateFragment) target).getRelatedAbstractState(); + if (aState != null) { + return aState; + } + AbstractFunction aFunction = ((StateFragment) target).getRelatedAbstractFunction(); + if (aFunction != null) { + return aFunction; + } } if (target instanceof FunctionalChainInvolvement) { return ((FunctionalChainInvolvement) target).getInvolvedElement();