From a16f62f910e467256c08840222b84064cd4a4dc2 Mon Sep 17 00:00:00 2001
From: nullsub <chrisudeussen@gmail.com>
Date: Wed, 13 Jun 2018 10:56:20 +0200
Subject: [PATCH] constrain creation of IntraRelationships to RELATIONSHIP

---
 .../AbstractIntraRelationshipConstraintPattern.java      | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java
index 390b7ea2..a3eb07e3 100644
--- a/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java
+++ b/org.framed.iorm.ui/modules/relationship/intra_relationship_constraints/AbstractIntraRelationshipConstraintPattern.java
@@ -155,10 +155,11 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS
 	@Override
 	public boolean canCreate(ICreateContext createContext) {
 		Connection targetConnection = createContext.getTargetConnection();
-		if(targetConnection != null &&
-		   getBusinessObjectForPictogramElement(targetConnection) instanceof Relation) {
-			Relation relation = (Relation) getBusinessObjectForPictogramElement(targetConnection);
-			return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, this.getModelType());
+		if(targetConnection != null) {
+			Object m = getBusinessObjectForPictogramElement(targetConnection);
+			if(m instanceof Relation && ((Relation) m).getType() == Type.RELATIONSHIP) { //TODO: Create EditPolicy rule for this case
+				return EditPolicyService.getHandler(this.getDiagram()).canCreate(createContext, this.getModelType());
+			}
 		}
 	    return false;
 	}
-- 
GitLab