Skip to content

Commit b9abdb5

Browse files
[558271] Handle scenario diagram navigation from State elements
Bug: 558271 Change-Id: I60ed091ef26c0ed328fb8c7481b724e2adf5d9df Signed-off-by: Arnaud Dieumegard <arnaud.dieumegard@obeo.fr>
1 parent 42645de commit b9abdb5

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/diagram/CapellaHelper.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.Collection;
1515
import java.util.HashSet;
1616
import java.util.LinkedHashSet;
17+
import java.util.List;
1718
import java.util.Set;
1819
import java.util.stream.Collectors;
1920

@@ -33,9 +34,11 @@
3334
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor;
3435
import org.eclipse.sirius.viewpoint.description.DAnnotation;
3536
import org.eclipse.sirius.viewpoint.description.DescriptionPackage;
37+
import org.polarsys.capella.common.data.modellingcore.AbstractType;
38+
import org.polarsys.capella.common.data.modellingcore.AbstractTypedElement;
3639
import org.polarsys.capella.core.data.capellacore.CapellaElement;
3740
import org.polarsys.capella.core.data.cs.BlockArchitecture;
38-
import org.polarsys.capella.core.data.cs.Component;
41+
import org.polarsys.capella.core.data.information.AbstractInstance;
3942
import org.polarsys.capella.core.diagram.helpers.naming.DAnnotationSourceConstants;
4043
import org.polarsys.kitalpha.doc.gen.business.core.preference.helper.DocgenDiagramPreferencesHelper;
4144
import org.polarsys.kitalpha.doc.gen.business.core.scope.GenerationGlobalScope;
@@ -123,8 +126,18 @@ private static EList<EObject> resolveReferencedElements(EObject element) {
123126
EList<EObject> objects = new BasicEList<EObject>();
124127
objects.add(element);
125128
// If we have a Component then we look also for Parts
126-
if (element instanceof Component) {
127-
objects.addAll(((Component)element).getAbstractTypedElements());
129+
if (element instanceof AbstractType) {
130+
List<AbstractTypedElement> ates = ((AbstractType)element).getAbstractTypedElements();
131+
objects.addAll(ates);
132+
// Then we look for InstanceRoles for these parts
133+
for (EObject ate : ates) {
134+
if (element instanceof AbstractInstance) {
135+
objects.addAll(((AbstractInstance)ate).getRepresentingInstanceRoles());
136+
}
137+
}
138+
}
139+
if (element instanceof AbstractInstance) {
140+
objects.addAll(((AbstractInstance)element).getRepresentingInstanceRoles());
128141
}
129142
return objects;
130143
}

docgenhtml/plugins/org.polarsys.capella.docgen/src/org/polarsys/capella/docgen/util/CapellaDiagramHelper.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
2+
* Copyright (c) 2006, 2019 THALES GLOBAL SERVICES.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -12,8 +12,10 @@
1212

1313
import org.eclipse.emf.ecore.EObject;
1414
import org.eclipse.sirius.diagram.DDiagramElement;
15+
import org.polarsys.capella.core.data.capellacommon.AbstractState;
1516
import org.polarsys.capella.core.data.capellacore.NamedElement;
1617
import org.polarsys.capella.core.data.cs.ExchangeItemAllocation;
18+
import org.polarsys.capella.core.data.fa.AbstractFunction;
1719
import org.polarsys.capella.core.data.fa.FunctionalChainInvolvement;
1820
import org.polarsys.capella.core.data.information.AbstractEventOperation;
1921
import org.polarsys.capella.core.data.interaction.Execution;
@@ -72,7 +74,14 @@ public EObject getSemanticElement(DDiagramElement element) {
7274
return null;
7375
}
7476
if (target instanceof StateFragment) {
75-
return ((StateFragment) target).getRelatedAbstractFunction();
77+
AbstractState aState = ((StateFragment) target).getRelatedAbstractState();
78+
if (aState != null) {
79+
return aState;
80+
}
81+
AbstractFunction aFunction = ((StateFragment) target).getRelatedAbstractFunction();
82+
if (aFunction != null) {
83+
return aFunction;
84+
}
7685
}
7786
if (target instanceof FunctionalChainInvolvement) {
7887
return ((FunctionalChainInvolvement) target).getInvolvedElement();

0 commit comments

Comments
 (0)