From aaacb4264088276a9c0af615606485eea8ae377f Mon Sep 17 00:00:00 2001
From: nullsub <chrisudeussen@gmail.com>
Date: Fri, 27 Apr 2018 07:45:11 +0200
Subject: [PATCH] update patterns

---
 .../core/attributeAndOperation/AttributePattern.java        | 1 -
 org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java | 4 ++--
 org.framed.iorm.ui/core/model/ModelPattern.java             | 4 ++--
 org.framed.iorm.ui/core/standardPolicies.editpolicy         | 6 +++++-
 .../framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java    | 4 +---
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/org.framed.iorm.ui/core/attributeAndOperation/AttributePattern.java b/org.framed.iorm.ui/core/attributeAndOperation/AttributePattern.java
index d3ba6009..fa84c5cb 100644
--- a/org.framed.iorm.ui/core/attributeAndOperation/AttributePattern.java
+++ b/org.framed.iorm.ui/core/attributeAndOperation/AttributePattern.java
@@ -7,7 +7,6 @@ import org.eclipse.graphiti.mm.pictograms.Shape;
 import org.eclipse.graphiti.pattern.IPattern;
 import org.framed.iorm.model.NamedElement;
 import org.framed.iorm.model.OrmFactory;
-import org.framed.iorm.model.Type;
 import org.framed.iorm.ui.UIUtil;
 import org.framed.iorm.ui.editPolicy.EditPolicyService;
 import org.framed.iorm.ui.references.AbstractHasAttsAndOpsReference;
diff --git a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
index 6570d442..10a15622 100644
--- a/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
+++ b/org.framed.iorm.ui/core/fulfillment/FulfillmentPattern.java
@@ -233,8 +233,8 @@ public class FulfillmentPattern extends FRaMEDConnectionPattern {
 		Anchor sourceAnchor = createContext.getSourceAnchor();
 		org.framed.iorm.model.ModelElement sourceShape = UIUtil.getModelElementForAnchor(sourceAnchor);
 		if (sourceShape != null) {
-			if(sourceTypes.contains(sourceShape.getType()))
-				   return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.FULFILLMENT);
+	//		if(sourceTypes.contains(sourceShape.getType()))
+				  return EditPolicyService.getHandler(this.getDiagram()).canStart(createContext, Type.FULFILLMENT);
 		}
 		return false;
 	}
diff --git a/org.framed.iorm.ui/core/model/ModelPattern.java b/org.framed.iorm.ui/core/model/ModelPattern.java
index 86dd0edb..7bf08395 100644
--- a/org.framed.iorm.ui/core/model/ModelPattern.java
+++ b/org.framed.iorm.ui/core/model/ModelPattern.java
@@ -101,8 +101,8 @@ public class ModelPattern extends FRaMEDShapePattern implements IPattern {
 	public boolean canAdd(IAddContext addContext) {
 		if(addContext.getNewObject() instanceof Model && ((Model)addContext.getNewObject()).getParent() != null) {
 			Type type = ((Model) addContext.getNewObject()).getParent().getType();
-			return (UIUtil.getLinkedModelForDiagram(getDiagram()) == null);
-					//&& EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, type);
+			return (UIUtil.getLinkedModelForDiagram(getDiagram()) == null)
+					&& EditPolicyService.getHandler(this.getDiagram()).canAdd(addContext, type);
 		}  
 		return false;
 	}
diff --git a/org.framed.iorm.ui/core/standardPolicies.editpolicy b/org.framed.iorm.ui/core/standardPolicies.editpolicy
index 7c442c12..eef06cef 100644
--- a/org.framed.iorm.ui/core/standardPolicies.editpolicy
+++ b/org.framed.iorm.ui/core/standardPolicies.editpolicy
@@ -221,7 +221,11 @@
   </policies>
   <policies action="Start" actionType="Fulfillment">
     <featureRule xsi:type="Editpolicymodel:TrueFeatureRule"/>
-    <constraintRule xsi:type="Editpolicymodel:TrueConstraintRule"/>
+    <constraintRule xsi:type="Editpolicymodel:IsSourceType" type="NaturalType"/>
+  </policies>
+  <policies action="Start" actionType="Fulfillment">
+    <featureRule xsi:type="Editpolicymodel:IsFeature" featureName="Dates"/>
+    <constraintRule xsi:type="Editpolicymodel:IsSourceType" type="DataType"/>
   </policies>
   <policies action="Start" actionType="Relationship">
     <featureRule xsi:type="Editpolicymodel:TrueFeatureRule"/>
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java
index 1a1997cf..d767d6ba 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/ConstraintRuleVisitor.java
@@ -2,12 +2,10 @@ package org.framed.iorm.ui.editPolicy;
 
 import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
 import org.eclipse.graphiti.mm.pictograms.Anchor;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
 import org.eclipse.graphiti.mm.pictograms.Diagram;
 import org.eclipse.graphiti.mm.pictograms.Shape;
 import org.framed.iorm.model.ModelElement;
 import org.framed.iorm.model.Type;
-import org.framed.iorm.ui.UILiterals;
 import org.framed.iorm.ui.UIUtil;
 import org.framed.iorm.ui.exceptions.NoDiagramFoundException;
 
@@ -43,6 +41,7 @@ public class ConstraintRuleVisitor {
 	 */
 	private boolean isStepOut;
 	
+	@SuppressWarnings("unused")
 	private Type type;
 
 	private Diagram diagram;
@@ -200,7 +199,6 @@ public class ConstraintRuleVisitor {
 		
 		return false;
 	}
-
 	
 	private boolean orRuleVisitor(OrConstraintRule rule) {
 		for(ConstraintRule abstractRule : rule.getRules()) {
-- 
GitLab