Skip to content
Snippets Groups Projects
Commit 543aa8cf authored by Kevin Kassin's avatar Kevin Kassin
Browse files

#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
parent cc0d743a
No related branches found
No related tags found
No related merge requests found
/bin/
...@@ -41,6 +41,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature { ...@@ -41,6 +41,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
private final String SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT = IdentifierLiterals.SHAPE_ID_ROLETYPE_OCCURRENCE_CONSTRAINT, 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_ROLETYPE_TYPEBODY = IdentifierLiterals.SHAPE_ID_ROLETYPE_TYPEBODY,
SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR, 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; SHAPE_ID_FULFILLMENT_ROLES = IdentifierLiterals.SHAPE_ID_FULFILLMENT_ROLES;
/** /**
...@@ -100,7 +101,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature { ...@@ -100,7 +101,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
if(relation.getType() == Type.FULFILLMENT) if(relation.getType() == Type.FULFILLMENT)
executeForFulfillment(customContext); 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; org.framed.iorm.model.Shape shape = (org.framed.iorm.model.Shape) businessObject;
if(shape.getType() == Type.ROLE_TYPE) if(shape.getType() == Type.ROLE_TYPE)
executeForRoleType(customContext); executeForRoleType(customContext);
...@@ -119,9 +120,12 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature { ...@@ -119,9 +120,12 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
if(PropertyUtil.isShape_IdValue(decorator, SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR)) { if(PropertyUtil.isShape_IdValue(decorator, SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR)) {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, intraRelConsAdded*HEIGHT_CONSTRAINT); graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, intraRelConsAdded*HEIGHT_CONSTRAINT);
intraRelConsAdded++; intraRelConsAdded++;
} else {
if(PropertyUtil.isShape_IdValue(decorator, SHAPE_ID_RELATIONSHIP_ANCHOR_DECORATOR)) {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), 0, 0);
} else { } else {
graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE); graphicAlgorithmService.setLocation(decorator.getGraphicsAlgorithm(), DISTANCE_FROM_CONNECTION_LINE, -1*DISTANCE_FROM_CONNECTION_LINE);
} } } } } } }
/** /**
* executes the feature for the fulfillments * executes the feature for the fulfillments
...@@ -154,6 +158,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature { ...@@ -154,6 +158,7 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
* executes the feature for the role types * executes the feature for the role types
*/ */
private void executeForRoleType(ICustomContext customContext) { private void executeForRoleType(ICustomContext customContext) {
System.out.println("AS");
ContainerShape containerShape = ((Shape) customContext.getPictogramElements()[0]).getContainer(); ContainerShape containerShape = ((Shape) customContext.getPictogramElements()[0]).getContainer();
Shape typeBodyShape = null, occurenceConstraintShape = null; Shape typeBodyShape = null, occurenceConstraintShape = null;
for(Shape shape : containerShape.getChildren()) { for(Shape shape : containerShape.getChildren()) {
...@@ -164,7 +169,6 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature { ...@@ -164,7 +169,6 @@ public class ResetLayoutForElementFeature extends AbstractCustomFeature {
} }
if(typeBodyShape != null && occurenceConstraintShape != null) { if(typeBodyShape != null && occurenceConstraintShape != null) {
RoundedRectangle typeBodyRectangle = (RoundedRectangle) typeBodyShape.getGraphicsAlgorithm(); RoundedRectangle typeBodyRectangle = (RoundedRectangle) typeBodyShape.getGraphicsAlgorithm();
System.out.println(typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2);
graphicAlgorithmService.setLocation(occurenceConstraintShape.getGraphicsAlgorithm(), graphicAlgorithmService.setLocation(occurenceConstraintShape.getGraphicsAlgorithm(),
typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2, typeBodyRectangle.getX()+typeBodyRectangle.getWidth()/2-HEIGHT_CONSTRAINT/2,
typeBodyRectangle.getY()-HEIGHT_CONSTRAINT-PUFFER_BETWEEN_ELEMENTS); typeBodyRectangle.getY()-HEIGHT_CONSTRAINT-PUFFER_BETWEEN_ELEMENTS);
......
package org.framed.iorm.ui.literals; package org.framed.iorm.ui.literals;
import org.eclipse.graphiti.util.ColorConstant;
import org.eclipse.graphiti.util.IColorConstant; import org.eclipse.graphiti.util.IColorConstant;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
...@@ -41,7 +42,7 @@ public class LayoutLiterals { ...@@ -41,7 +42,7 @@ public class LayoutLiterals {
* (1) the color of constraint texts or<br> * (1) the color of constraint texts or<br>
* (2) the color of constraint connections * (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; COLOR_CONSTRAINT_CONNECTION = IColorConstant.GRAY;
/** /**
......
...@@ -33,6 +33,7 @@ import org.framed.iorm.ui.util.DiagramUtil; ...@@ -33,6 +33,7 @@ import org.framed.iorm.ui.util.DiagramUtil;
import org.framed.iorm.ui.util.GeneralUtil; import org.framed.iorm.ui.util.GeneralUtil;
import org.framed.iorm.ui.util.PropertyUtil; import org.framed.iorm.ui.util.PropertyUtil;
import org.framed.iorm.ui.providers.FeatureProvider; //*import for javadoc link 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.Relation;
import org.framed.iorm.model.Type; import org.framed.iorm.model.Type;
import org.framed.iorm.ui.exceptions.FeatureHasNoPaletteDescriptorException; import org.framed.iorm.ui.exceptions.FeatureHasNoPaletteDescriptorException;
...@@ -350,12 +351,17 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ ...@@ -350,12 +351,17 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
if(context.getPictogramElements().length == 1) { if(context.getPictogramElements().length == 1) {
PictogramElement pictogramElement = context.getPictogramElements()[0]; PictogramElement pictogramElement = context.getPictogramElements()[0];
EObject businessObject = GeneralUtil.getBusinessObjectIfExactlyOne(pictogramElement); EObject businessObject = GeneralUtil.getBusinessObjectIfExactlyOne(pictogramElement);
if(businessObject instanceof Relation) {
ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context); ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context);
if(businessObject instanceof Relation) {
if(((Relation) businessObject).getType() == Type.RELATIONSHIP) if(((Relation) businessObject).getType() == Type.RELATIONSHIP)
return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_RELATIONSHIP_FEATURE_NAME); return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_RELATIONSHIP_FEATURE_NAME);
if(((Relation) businessObject).getType() == Type.FULFILLMENT) if(((Relation) businessObject).getType() == Type.FULFILLMENT)
return (ICustomFeature) GeneralUtil.findFeatureByName(customFeatures, EDIT_FULFILLMENT_FEATURE_NAME); 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; return null;
} }
......
...@@ -104,7 +104,7 @@ public class EditRelationshipDialog extends Dialog { ...@@ -104,7 +104,7 @@ public class EditRelationshipDialog extends Dialog {
protected void configureShell(Shell newShell) { protected void configureShell(Shell newShell) {
super.configureShell(newShell); super.configureShell(newShell);
newShell.setText(EDIT_RELATIONSHIP_FEATURE_NAME + " " + businessObject.getName()); 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);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment