From 543aa8cf2a5c5b009c7a3d20719fa6da1db15c62 Mon Sep 17 00:00:00 2001
From: Kevin Kassin <KK@Medion-PC>
Date: Mon, 7 Aug 2017 17:55:39 +0200
Subject: [PATCH] #Commit 7.8 18:00

set up double click feature for compartment types and groups to step in,
fixed bugs concering the reset layout feature,
made the text color of intra relationship constraints darker,
fixed concerning the edit relationship feature
---
 org.framed.iorm.model.edit/.gitignore                |  1 +
 .../ui/graphitifeatures/EditRelationshipFeature.java |  4 ++--
 .../ResetLayoutForElementFeature.java                | 12 ++++++++----
 .../org/framed/iorm/ui/literals/LayoutLiterals.java  |  3 ++-
 .../iorm/ui/providers/ToolBehaviorProvider.java      |  8 +++++++-
 .../iorm/ui/wizards/EditRelationshipDialog.java      |  2 +-
 6 files changed, 21 insertions(+), 9 deletions(-)
 create mode 100644 org.framed.iorm.model.edit/.gitignore

diff --git a/org.framed.iorm.model.edit/.gitignore b/org.framed.iorm.model.edit/.gitignore
new file mode 100644
index 00000000..ae3c1726
--- /dev/null
+++ b/org.framed.iorm.model.edit/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/EditRelationshipFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/EditRelationshipFeature.java
index f8b89e5d..d1f45a8e 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/EditRelationshipFeature.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/EditRelationshipFeature.java
@@ -35,8 +35,8 @@ public class EditRelationshipFeature extends AbstractCustomFeature {
 	 * values for property shape id of the connection decorators of the relationship
 	 */
 	private final String SHAPE_ID_RELATIONSHIP_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_NAME_DECORATOR,
-			   					SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR,
-			   					SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR;
+			   			 SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR,
+			   			 SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_TARGET_CARDINALITY_DECORATOR;
 	
 	/**
 	 * Class constructor
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/ResetLayoutForElementFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/ResetLayoutForElementFeature.java
index 6229d10c..053d1f36 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/ResetLayoutForElementFeature.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/ResetLayoutForElementFeature.java
@@ -41,6 +41,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
 	private final String SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT = IdentifierLiterals.SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT,
 						 SHAPE_ID_ROLETYPE_TYPEBODY = IdentifierLiterals.SHAPE_ID_ROLETYPE_TYPEBODY,
 						 SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR,
+					     SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR,
 						 SHAPE_ID_FULFILLMENT_ROLES = IdentifierLiterals.SHAPE_ID_FULFILLMENT_ROLES;
 	
 	/**
@@ -100,7 +101,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
 			if(relation.getType() == Type.FULFILLMENT)
 				executeForFulfillment(customContext);
 		}
-		if(businessObject instanceof Shape) {	
+		if(businessObject instanceof org.framed.iorm.model.Shape) {	
 			org.framed.iorm.model.Shape shape = (org.framed.iorm.model.Shape) businessObject;
 			if(shape.getType() == Type.ROLE_TYPE)
 				executeForRoleType(customContext);
@@ -120,8 +121,11 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
 				graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, intraRelConsAdded*HEIGHT_CONSTRAINT);
 				intraRelConsAdded++;
 			} else {
-				graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE);
-	}	}	}
+				if(PropertyUtil.isShape_IdValue(decorator, SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR)) {
+					graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), 0, 0);
+				} else {
+					graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE);
+	}	}	}	}
 	
 	/**
 	 * executes the feature for the fulfillments
@@ -154,6 +158,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
 	 * executes the feature for the role types
 	 */
 	private void executeForRoleType(ICustomContext customContext) {
+		System.out.println("AS");
 		ContainerShape containerShape = ((Shape) customContext.getPictogramElements()[0]).getContainer();
 		Shape typeBodyShape = null, occurenceConstraintShape = null;
 		for(Shape shape : containerShape.getChildren()) {
@@ -164,7 +169,6 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
 		}
 		if(typeBodyShape != null && occurenceConstraintShape != null) {
 			RoundedRectangle typeBodyRectangle = (RoundedRectangle) typeBodyShape.getGraphicsAlgorithm();
-			System.out.println(typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2);
 			graphicAlgorithmService.setLocation(occurenceConstraintShape.getGraphicsAlgorithm(),
 				typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2, 
 				typeBodyRectangle.getY()-HEIGHT_CONSTRAINT-PUFFER_BETWEEN_ELEMENTS);
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java
index d21b2b31..1ef9be11 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/LayoutLiterals.java
@@ -1,5 +1,6 @@
 package org.framed.iorm.ui.literals;
 
+import org.eclipse.graphiti.util.ColorConstant;
 import org.eclipse.graphiti.util.IColorConstant;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Display;
@@ -41,7 +42,7 @@ public class LayoutLiterals {
 	 * (1) the color of constraint texts or<br>
 	 * (2) the color of constraint connections
 	 */
-	public static final IColorConstant COLOR_CONSTRAINT_TEXT = IColorConstant.DARK_GRAY,
+	public static final IColorConstant COLOR_CONSTRAINT_TEXT = new ColorConstant(48, 48, 48),
 									   COLOR_CONSTRAINT_CONNECTION = IColorConstant.GRAY;
 		
 	/**
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java
index 12abd0e3..76498a50 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/ToolBehaviorProvider.java
@@ -33,6 +33,7 @@ import org.framed.iorm.ui.util.DiagramUtil;
 import org.framed.iorm.ui.util.GeneralUtil;
 import org.framed.iorm.ui.util.PropertyUtil;
 import org.framed.iorm.ui.providers.FeatureProvider; //*import for javadoc link
+import org.framed.iorm.model.ModelElement;
 import org.framed.iorm.model.Relation;
 import org.framed.iorm.model.Type;
 import org.framed.iorm.ui.exceptions.FeatureHasNoPaletteDescriptorException;
@@ -350,12 +351,17 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
 		if(context.getPictogramElements().length == 1) {
 			PictogramElement pictogramElement = context.getPictogramElements()[0];
 			EObject businessObject = GeneralUtil.getBusinessObjectIfExactlyOne(pictogramElement);
+			ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
 			if(businessObject instanceof Relation) {
-				ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
 				if(((Relation) businessObject).getType() == Type.RELATIONSHIP)
 					return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_RELATIONSHIP_FEATURE_NAME);
 				if(((Relation) businessObject).getType() == Type.FULFILLMENT)
 					return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_FULFILLMENT_FEATURE_NAME);
+			}	
+			if(businessObject instanceof org.framed.iorm.model.Shape) {
+				if(((ModelElement) businessObject).getType() == Type.COMPARTMENT_TYPE ||
+				  ((ModelElement) businessObject).getType() == Type.GROUP)
+					return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, STEP_IN_FEATURE_NAME);
 		}	}
 		return null;
 	}	
diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/wizards/EditRelationshipDialog.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/wizards/EditRelationshipDialog.java
index 630df4d3..94c0d29e 100644
--- a/org.framed.iorm.ui/src/org/framed/iorm/ui/wizards/EditRelationshipDialog.java
+++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/wizards/EditRelationshipDialog.java
@@ -104,7 +104,7 @@ public class EditRelationshipDialog extends Dialog {
 	protected void configureShell(Shell newShell) {
 		super.configureShell(newShell);
 		newShell.setText(EDIT_RELATIONSHIP_FEATURE_NAME + " " + businessObject.getName());
-		newShell.setSize(HEIGHT_EDIT_RELATIONSHIP_DIALOG, WIDTH_EDIT_RELATIONSHIP_DIALOG);
+		newShell.setSize(WIDTH_EDIT_RELATIONSHIP_DIALOG, HEIGHT_EDIT_RELATIONSHIP_DIALOG);
 	}
 	
 	/**
-- 
GitLab