Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-25 04:05:34 -0400
committerCamille Letavernier2014-08-25 04:05:34 -0400
commit8a76c4c043ace8da2cf418aaed0a4b034831a78d (patch)
treeb71f3ef022c1998682821d2fd2f8b9aeb7cb80f5 /plugins
parentd93eec6c1340beeeffc483b9149a882c8ad6f69b (diff)
downloadorg.eclipse.papyrus-8a76c4c043ace8da2cf418aaed0a4b034831a78d.tar.gz
org.eclipse.papyrus-8a76c4c043ace8da2cf418aaed0a4b034831a78d.tar.xz
org.eclipse.papyrus-8a76c4c043ace8da2cf418aaed0a4b034831a78d.zip
442376: [SysML BDD] Associations between blocks not working
https://bugs.eclipse.org/bugs/show_bug.cgi?id=442376 - Fix IndexOutOfBoundsExceptions when associations have less than 2 member ends
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java
index 40a2c7afc50..cba1a327d2e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java
@@ -103,6 +103,12 @@ public class SysMLCreateOrShowExistingElementHelper extends CreateOrShowExisting
boolean result = super.hasWantedType(eobject, wantedType);
if (result) {
if (eobject instanceof Association) {
+ Association association = (Association) eobject;
+ // Skip incomplete associations: it can't be a duplicate of the current link (Which has a source and a target)
+ if (association.getMemberEnds().size() < 2) {
+ return false;
+ }
+
final AggregationKind current = getAssociationAggregationKind((Association) eobject);
if (current == AggregationKind.NONE_LITERAL) {
if (SysMLElementTypes.ASSOCIATION_NONE.equals(current) || SysMLElementTypes.ASSOCIATION_NONE_DIRECTED.equals(wantedType)) {
@@ -132,8 +138,14 @@ public class SysMLCreateOrShowExistingElementHelper extends CreateOrShowExisting
* the association kind for the association
*/
private static final AggregationKind getAssociationAggregationKind(final Association association) {
+ // Incomplete associations
+ if (association.getMemberEnds().size() < 2) {
+ return AggregationKind.NONE_LITERAL;
+ }
+
final Property source = association.getMemberEnds().get(0);
final Property target = association.getMemberEnds().get(1);
+
if (source.getAggregation() == AggregationKind.NONE_LITERAL && target.getAggregation() == AggregationKind.NONE_LITERAL) {
return AggregationKind.NONE_LITERAL;
} else if ((source.getAggregation() == AggregationKind.COMPOSITE_LITERAL) || (target.getAggregation() == AggregationKind.COMPOSITE_LITERAL)) {

Back to the top