From ba9b092e82606a8858d02a6b1571894a8a8954b9 Mon Sep 17 00:00:00 2001
From: nullsub <chrisudeussen@gmail.com>
Date: Wed, 13 Jun 2018 00:49:14 +0200
Subject: [PATCH] fix error in RelationshipPattern

---
 org.framed.iorm.ui/core/baseRules.editpolicy                  | 4 ++++
 org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java   | 2 +-
 org.framed.iorm.ui/core/inheritance/InheritancePattern.java   | 2 +-
 .../modules/compartment/CompartmentTypePattern.java           | 2 +-
 .../modules/relationship/RelationshipPattern.java             | 4 ++--
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/org.framed.iorm.ui/core/baseRules.editpolicy b/org.framed.iorm.ui/core/baseRules.editpolicy
index a8989f82..44a65f53 100644
--- a/org.framed.iorm.ui/core/baseRules.editpolicy
+++ b/org.framed.iorm.ui/core/baseRules.editpolicy
@@ -32,6 +32,10 @@
     <featureRule xsi:type="editpolicymodel:TrueFeatureRule"/>
     <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/>
   </policies>
+  <policies action="Execute" actionType="CompartmentType">
+    <featureRule xsi:type="editpolicymodel:TrueFeatureRule"/>
+    <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/>
+  </policies>
   <policies action="Execute" actionType="Relationship">
     <featureRule xsi:type="editpolicymodel:TrueFeatureRule"/>
     <constraintRule xsi:type="editpolicymodel:TrueConstraintRule"/>
diff --git a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
index a9f020d7..84375e18 100644
--- a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
+++ b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
@@ -81,7 +81,7 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern {
 		Anchor newAnchor = context.getNewAnchor();
 		org.framed.iorm.model.ModelElement newShape = UIUtil.getModelElementForAnchor(newAnchor);
 		if(newShape != null) {	
-			return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newShape.getType());
+			return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, this.modelType);
 		}
 		return false;
 	}
diff --git a/org.framed.iorm.ui/core/inheritance/InheritancePattern.java b/org.framed.iorm.ui/core/inheritance/InheritancePattern.java
index 0c4a0889..b6f5b5b1 100644
--- a/org.framed.iorm.ui/core/inheritance/InheritancePattern.java
+++ b/org.framed.iorm.ui/core/inheritance/InheritancePattern.java
@@ -92,7 +92,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
 			    if(oldShape != null && newShape != null) {
 			    	if(oldShape.getContainer() == newShape.getContainer()) {
 			    		if(newShape.getType() == oldShape.getType()) {
-			    			return true; //TODO: Handle by the EditPolicyHandler
+			 			   return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, this.modelType);
 		}	}  	}	}	}
 	    return false;
 	}
diff --git a/org.framed.iorm.ui/modules/compartment/CompartmentTypePattern.java b/org.framed.iorm.ui/modules/compartment/CompartmentTypePattern.java
index b8cb1e6b..cb6aaba0 100644
--- a/org.framed.iorm.ui/modules/compartment/CompartmentTypePattern.java
+++ b/org.framed.iorm.ui/modules/compartment/CompartmentTypePattern.java
@@ -42,7 +42,7 @@ import org.framed.iorm.featuremodel.FRaMEDFeature;
 import org.framed.iorm.model.Model;
 import org.framed.iorm.model.ModelElement;
 import org.framed.iorm.model.OrmFactory;
-import org.framed.iorm.model.Segment;
+import org.framed.iorm.model.Segment; 
 import org.framed.iorm.model.Type;
 import org.framed.iorm.ui.FRaMEDShapePattern;
 import org.framed.iorm.ui.UILiterals;
diff --git a/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java b/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java
index 3ccacd49..f15bf771 100644
--- a/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java
+++ b/org.framed.iorm.ui/modules/relationship/RelationshipPattern.java
@@ -96,7 +96,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
 		Anchor newAnchor = context.getNewAnchor();
 		org.framed.iorm.model.ModelElement newShape = UIUtil.getModelElementForAnchor(newAnchor);
 		if(newShape != null) {
-			return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, newShape.getType());
+			return EditPolicyService.getHandler(this.getDiagram()).canReconnect(context, this.modelType);
 		}
 		return false;
 	}
@@ -302,7 +302,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
 		Anchor sourceAnchor = createContext.getSourceAnchor();
 		org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor);
 		if(sourceShape != null){	
-			return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, sourceShape.getType());
+			return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, this.modelType);
 		}	
 		return false;
 	}
-- 
GitLab