diff --git a/org.framed.iorm.model.edit/.gitignore b/org.framed.iorm.model.edit/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ae3c1726048cd06b9a143e0376ed46dd9b9a8d53 --- /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 f8b89e5dca6561eff5d6a7dd7ed95753e07658c6..d1f45a8e5734b7af0822b62323bd69c5ea164540 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 6229d10c21c272b71fe10e3afab45e9a14677228..053d1f3671bfe8c07cab58c17d6350c482807f6c 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 d21b2b316239bc9a2539999b131d6d2a6c9aed74..1ef9be113a8a0052038713eafdc78eedc940c353 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 12abd0e3c0cdb58429acfe613bf76203bf1ec391..76498a50b9ee8157495615eba84544cebd9d25bb 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 630df4d3896b024892101dfd598eac0a494cc271..94c0d29e02c27477cf804aeff3128a3be9fc85f0 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); } /**