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

#Commit 25.7 17:25

implemented first non fully working version of role implication
parent 486dd434
No related branches found
No related tags found
No related merge requests found
Showing
with 223 additions and 52 deletions
...@@ -3,7 +3,6 @@ package org.framed.iorm.ui.graphitifeatures; ...@@ -3,7 +3,6 @@ package org.framed.iorm.ui.graphitifeatures;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.graphiti.features.IDeleteFeature;
import org.eclipse.graphiti.features.IFeatureProvider; import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IDeleteContext; import org.eclipse.graphiti.features.context.IDeleteContext;
import org.eclipse.graphiti.features.context.impl.DeleteContext; import org.eclipse.graphiti.features.context.impl.DeleteContext;
......
...@@ -65,7 +65,9 @@ public class IdentifierLiterals { ...@@ -65,7 +65,9 @@ public class IdentifierLiterals {
IMG_ID_FEATURE_ROLEEQUIVALENCE = IMG_ID_PREFIX + "img_roleequivalence", IMG_ID_FEATURE_ROLEEQUIVALENCE = IMG_ID_PREFIX + "img_roleequivalence",
IMG_ID_FEATURE_ROLEPROHIBITION = IMG_ID_PREFIX + "img_roleprohibition", IMG_ID_FEATURE_ROLEPROHIBITION = IMG_ID_PREFIX + "img_roleprohibition",
IMG_ID_FEATURE_RELATIONSHIP = IMG_ID_PREFIX + "img_relationship", IMG_ID_FEATURE_RELATIONSHIP = IMG_ID_PREFIX + "img_relationship",
IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IMG_ID_PREFIX + "img_intrarelationship_constraint"; IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IMG_ID_PREFIX + "img_intrarelationship_constraint",
IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION = IMG_ID_PREFIX + "img_relationship_implication",
IMG_ID_FEATURE_RELATIONSHIP_EXCLUSION = IMG_ID_PREFIX + "img_relationship_exclusion";
/** /**
* feature model identifier * feature model identifier
......
...@@ -94,7 +94,9 @@ public class NameLiterals { ...@@ -94,7 +94,9 @@ public class NameLiterals {
* (7) the name of the cyclic constraint create feature or<br> * (7) the name of the cyclic constraint create feature or<br>
* (8) the name of the irreflexive constraint create feature or<br> * (8) the name of the irreflexive constraint create feature or<br>
* (9) the name of the reflexive constraint create feature or<br> * (9) the name of the reflexive constraint create feature or<br>
* (10) the name of the total constraint create feature * (10) the name of the total constraint create feature or<br>
* (11) the name of the relationship implication create feature or<br>
* (12) the name of the relationship exclusion create feature
*/ */
public static final String INHERITANCE_FEATURE_NAME = "Inheritance", public static final String INHERITANCE_FEATURE_NAME = "Inheritance",
ROLEIMPLICATION_FEATURE_NAME = "Role Implication", ROLEIMPLICATION_FEATURE_NAME = "Role Implication",
...@@ -105,7 +107,9 @@ public class NameLiterals { ...@@ -105,7 +107,9 @@ public class NameLiterals {
CYCLIC_FEATURE_NAME = "Cyclic", CYCLIC_FEATURE_NAME = "Cyclic",
IRREFLEXIVE_FEATURE_NAME = "Irreflexve", IRREFLEXIVE_FEATURE_NAME = "Irreflexve",
REFLEXIVE_FEATURE_NAME = "Reflexive", REFLEXIVE_FEATURE_NAME = "Reflexive",
TOTAL_FEATURE_NAME = "Total"; TOTAL_FEATURE_NAME = "Total",
RELATIONSHIP_IMPLICATION_FEATURE_NAME = "Relationship Implication",
RELATIONSHIP_EXCLUSION_FEATURE_NAME = "Relationship Exclusion";
/** /**
* name literals used in the patterns to be identified by the ToolBehaviorProvider * name literals used in the patterns to be identified by the ToolBehaviorProvider
......
...@@ -68,5 +68,7 @@ public class URLLiterals { ...@@ -68,5 +68,7 @@ public class URLLiterals {
IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE = IMG_FILE_PATH_PREFIX + "roleequivalence.png", IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE = IMG_FILE_PATH_PREFIX + "roleequivalence.png",
IMG_FILEPATH_FEATURE_ROLEPROHIBITION = IMG_FILE_PATH_PREFIX + "roleprohibition.png", IMG_FILEPATH_FEATURE_ROLEPROHIBITION = IMG_FILE_PATH_PREFIX + "roleprohibition.png",
IMG_FILEPATH_FEATURE_RELATIONSHIP = IMG_FILE_PATH_PREFIX + "relationship.png", IMG_FILEPATH_FEATURE_RELATIONSHIP = IMG_FILE_PATH_PREFIX + "relationship.png",
IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IMG_FILE_PATH_PREFIX + "intrarelationship_constraint.png"; IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IMG_FILE_PATH_PREFIX + "intrarelationship_constraint.png",
IMG_FILEPATH_FEATURE_RELATIONSHIP_IMPLICATION = IMG_FILE_PATH_PREFIX + "relationship_implication.png",
IMG_FILEPATH_FEATURE_RELATIONSHIP_EXCLUSION = IMG_FILE_PATH_PREFIX + "relationship_exclusion.png";
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ public class FRaMEDConnectionPattern extends AbstractConnectionPattern { ...@@ -23,7 +23,7 @@ public class FRaMEDConnectionPattern extends AbstractConnectionPattern {
/** /**
* the pictogram elements service used to creates pictogram elements in the subclasses * the pictogram elements service used to creates pictogram elements in the subclasses
*/ */
protected final IPeCreateService pictogramElementCreateSerive = Graphiti.getPeCreateService(); protected final IPeCreateService pictogramElementCreateService = Graphiti.getPeCreateService();
/** /**
* the graphics algorithm service used to create graphics algorithms in the subclasses * the graphics algorithm service used to create graphics algorithms in the subclasses
......
...@@ -115,7 +115,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern { ...@@ -115,7 +115,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
Anchor sourceAnchor = addConnectionContext.getSourceAnchor(); Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
Anchor targetAnchor = addConnectionContext.getTargetAnchor(); Anchor targetAnchor = addConnectionContext.getTargetAnchor();
//Step 1 //Step 1
Connection connection = pictogramElementCreateSerive.createFreeFormConnection(getDiagram()); Connection connection = pictogramElementCreateService.createFreeFormConnection(getDiagram());
connection.setStart(sourceAnchor); connection.setStart(sourceAnchor);
connection.setEnd(targetAnchor); connection.setEnd(targetAnchor);
Polyline polyline = graphicAlgorithmService.createPolyline(connection); Polyline polyline = graphicAlgorithmService.createPolyline(connection);
...@@ -123,7 +123,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern { ...@@ -123,7 +123,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
polyline.setLineWidth(2); polyline.setLineWidth(2);
//Step2 //Step2
ConnectionDecorator connectionDecorator; ConnectionDecorator connectionDecorator;
connectionDecorator = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 1.0, true); connectionDecorator = pictogramElementCreateService.createConnectionDecorator(connection, false, 1.0, true);
int points[] = new int[] { -1*INHERITANCE_ARROWHEAD_LENGTH, INHERITANCE_ARROWHEAD_HEIGHT, //Point 1 int points[] = new int[] { -1*INHERITANCE_ARROWHEAD_LENGTH, INHERITANCE_ARROWHEAD_HEIGHT, //Point 1
0, 0, //P2 0, 0, //P2
-1*INHERITANCE_ARROWHEAD_LENGTH, -1*INHERITANCE_ARROWHEAD_HEIGHT }; //P3 -1*INHERITANCE_ARROWHEAD_LENGTH, -1*INHERITANCE_ARROWHEAD_HEIGHT }; //P3
...@@ -153,8 +153,8 @@ public class InheritancePattern extends FRaMEDConnectionPattern { ...@@ -153,8 +153,8 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
public boolean canCreate(ICreateConnectionContext createContext) { public boolean canCreate(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
if(sourceShape != null && targetShape != null) { if(sourceShape != null && targetShape != null) {
if(sourceShape.getContainer() == targetShape.getContainer() && if(sourceShape.getContainer() == targetShape.getContainer() &&
!(sourceShape.equals(targetShape))) { !(sourceShape.equals(targetShape))) {
...@@ -179,7 +179,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern { ...@@ -179,7 +179,7 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
@Override @Override
public boolean canStartConnection(ICreateConnectionContext createContext) { public boolean canStartConnection(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
if(sourceShape != null){ if(sourceShape != null){
if(sourceShape.getType() == Type.NATURAL_TYPE || if(sourceShape.getType() == Type.NATURAL_TYPE ||
sourceShape.getType() == Type.DATA_TYPE || sourceShape.getType() == Type.DATA_TYPE ||
...@@ -203,8 +203,8 @@ public class InheritancePattern extends FRaMEDConnectionPattern { ...@@ -203,8 +203,8 @@ public class InheritancePattern extends FRaMEDConnectionPattern {
//Step 1 //Step 1
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
//Step 2 //Step 2
Relation newInheritance = OrmFactory.eINSTANCE.createRelation(); Relation newInheritance = OrmFactory.eINSTANCE.createRelation();
newInheritance.setType(Type.INHERITANCE); newInheritance.setType(Type.INHERITANCE);
......
...@@ -134,7 +134,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -134,7 +134,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
Anchor sourceAnchor = addConnectionContext.getSourceAnchor(); Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
Anchor targetAnchor = addConnectionContext.getTargetAnchor(); Anchor targetAnchor = addConnectionContext.getTargetAnchor();
//Step 1 //Step 1
Connection connection = pictogramElementCreateSerive.createFreeFormConnection(getDiagram()); Connection connection = pictogramElementCreateService.createFreeFormConnection(getDiagram());
connection.setStart(sourceAnchor); connection.setStart(sourceAnchor);
connection.setEnd(targetAnchor); connection.setEnd(targetAnchor);
Polyline polyline = graphicAlgorithmService.createPolyline(connection); Polyline polyline = graphicAlgorithmService.createPolyline(connection);
...@@ -142,21 +142,21 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -142,21 +142,21 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
polyline.setLineWidth(2); polyline.setLineWidth(2);
//Step 2 //Step 2
ConnectionDecorator connectionDecoratorForName = ConnectionDecorator connectionDecoratorForName =
pictogramElementCreateSerive.createConnectionDecorator(connection, true, 0.5, true); pictogramElementCreateService.createConnectionDecorator(connection, true, 0.5, true);
Text nameText = graphicAlgorithmService.createText(connectionDecoratorForName, addedRelationship.getName()); Text nameText = graphicAlgorithmService.createText(connectionDecoratorForName, addedRelationship.getName());
graphicAlgorithmService.setLocation(nameText, 0, -1*DISTANCE_FROM_CONNECTION_LINE); graphicAlgorithmService.setLocation(nameText, 0, -1*DISTANCE_FROM_CONNECTION_LINE);
nameText.setForeground(manageColor(COLOR_TEXT)); nameText.setForeground(manageColor(COLOR_TEXT));
PropertyUtil.setShape_IdValue(connectionDecoratorForName, SHAPE_ID_RELATIONSHIP_NAME_DECORATOR); PropertyUtil.setShape_IdValue(connectionDecoratorForName, SHAPE_ID_RELATIONSHIP_NAME_DECORATOR);
//Step 3 //Step 3
ConnectionDecorator connectionDecoratorForSourceLabel = ConnectionDecorator connectionDecoratorForSourceLabel =
pictogramElementCreateSerive.createConnectionDecorator(connection, true, 0.1, true); pictogramElementCreateService.createConnectionDecorator(connection, true, 0.1, true);
Text sourceLabel = graphicAlgorithmService.createText(connectionDecoratorForSourceLabel, addedRelationship.getSourceLabel().getName()); Text sourceLabel = graphicAlgorithmService.createText(connectionDecoratorForSourceLabel, addedRelationship.getSourceLabel().getName());
graphicAlgorithmService.setLocation(sourceLabel, 0, -1*DISTANCE_FROM_CONNECTION_LINE); graphicAlgorithmService.setLocation(sourceLabel, 0, -1*DISTANCE_FROM_CONNECTION_LINE);
sourceLabel.setForeground(manageColor(COLOR_TEXT)); sourceLabel.setForeground(manageColor(COLOR_TEXT));
PropertyUtil.setShape_IdValue(connectionDecoratorForSourceLabel, SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR); PropertyUtil.setShape_IdValue(connectionDecoratorForSourceLabel, SHAPE_ID_RELATIONSHIP_SOURCE_CARDINALITY_DECORATOR);
//Step 3 //Step 3
ConnectionDecorator connectionDecoratorForTargetLabel = ConnectionDecorator connectionDecoratorForTargetLabel =
pictogramElementCreateSerive.createConnectionDecorator(connection, true, 0.9, true); pictogramElementCreateService.createConnectionDecorator(connection, true, 0.9, true);
Text targetLabel = graphicAlgorithmService.createText(connectionDecoratorForTargetLabel, addedRelationship.getTargetLabel().getName()); Text targetLabel = graphicAlgorithmService.createText(connectionDecoratorForTargetLabel, addedRelationship.getTargetLabel().getName());
graphicAlgorithmService.setLocation(targetLabel, 0, -1*DISTANCE_FROM_CONNECTION_LINE); graphicAlgorithmService.setLocation(targetLabel, 0, -1*DISTANCE_FROM_CONNECTION_LINE);
targetLabel.setForeground(manageColor(COLOR_TEXT)); targetLabel.setForeground(manageColor(COLOR_TEXT));
...@@ -174,6 +174,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -174,6 +174,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
EditRelationshipFeature editRelationshipFeature = getEditRelationshipFeature(customContext); EditRelationshipFeature editRelationshipFeature = getEditRelationshipFeature(customContext);
if(editRelationshipFeature.canExecute(customContext)) if(editRelationshipFeature.canExecute(customContext))
editRelationshipFeature.execute(customContext); editRelationshipFeature.execute(customContext);
pictogramElementCreateService.createChopboxAnchor(connection);
return connection; return connection;
} }
...@@ -201,8 +202,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -201,8 +202,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
public boolean canCreate(ICreateConnectionContext createContext) { public boolean canCreate(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
if(sourceShape != null && targetShape != null) { if(sourceShape != null && targetShape != null) {
if(sourceShape.getContainer() == targetShape.getContainer()) { if(sourceShape.getContainer() == targetShape.getContainer()) {
if(sourceShape.getType() == Type.ROLE_TYPE) if(sourceShape.getType() == Type.ROLE_TYPE)
...@@ -223,7 +224,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -223,7 +224,7 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
@Override @Override
public boolean canStartConnection(ICreateConnectionContext createContext) { public boolean canStartConnection(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
if(sourceShape != null){ if(sourceShape != null){
if(sourceShape.getType() == Type.ROLE_TYPE) if(sourceShape.getType() == Type.ROLE_TYPE)
return true; return true;
...@@ -245,8 +246,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern { ...@@ -245,8 +246,8 @@ public class RelationshipPattern extends FRaMEDConnectionPattern {
//Step 1 //Step 1
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
//Step 2 //Step 2
Relation newRelationship = OrmFactory.eINSTANCE.createRelation(); Relation newRelationship = OrmFactory.eINSTANCE.createRelation();
......
package org.framed.iorm.ui.pattern.connections.interrelationship; package org.framed.iorm.ui.pattern.connections.interrelationship;
import org.eclipse.graphiti.features.context.ICreateConnectionContext;
import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.framed.iorm.model.OrmFactory;
import org.framed.iorm.model.Relation;
import org.framed.iorm.model.Type;
import org.framed.iorm.ui.literals.LayoutLiterals;
import org.framed.iorm.ui.pattern.connections.FRaMEDConnectionPattern; import org.framed.iorm.ui.pattern.connections.FRaMEDConnectionPattern;
import org.framed.iorm.ui.util.ConnectionPatternUtil;
//TODO
public class AbstractInterRelationshipConstraintPattern extends FRaMEDConnectionPattern { public class AbstractInterRelationshipConstraintPattern extends FRaMEDConnectionPattern {
/**
* the layout integers used to layout the arrowhead of the inheritances gathered from {@link LayoutLiterals}
*/
private static final int ARROWHEAD_LENGTH = LayoutLiterals.ARROWHEAD_LENGTH,
ARROWHEAD_HEIGHT = LayoutLiterals.ARROWHEAD_HEIGHT;
/**
* Class constructor
*/
public AbstractInterRelationshipConstraintPattern() {
super();
}
//create feature
//~~~~~~~~~~~~~~
/**
* calculates if an inter relationship constraint can be created
* <p>
* returns true if<br>
* (1) target and source connection are not null and<br>
* (2) target and source connection is of valid type and<br>
* (3) source connection container and targets connection container are the same and<br>
* (4) the source connection is not equals the target connection and<br>
* (5) target and source connection are of the same type
* @return if the inter relationship constraint can be added
*/
@Override
public boolean canCreate(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.ModelElement sourceConnection = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.ModelElement targetConnection = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
if(sourceConnection != null && targetConnection != null) {
if(sourceConnection.getContainer() == targetConnection.getContainer() &&
!(sourceConnection.equals(targetConnection))) {
if(sourceConnection.getType() == Type.RELATIONSHIP)
if(targetConnection.getType() == sourceConnection.getType())
return true;
} }
return false;
}
/**
* checks if a inter relationship constraint can be started from a given source connection
* <p>
* returns true if<br>
* (1) source connection is not null and<br>
* (2) source connection is of valid type
* @return if a inter relationship constraint can be started
*/
@Override
public boolean canStartConnection(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor();
org.framed.iorm.model.ModelElement sourceConnection = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
if(sourceConnection != null){
if(sourceConnection.getType() == Type.RELATIONSHIP)
return true;
}
return false;
}
/**
* creates the business object of a inter relationship constraint of the given type using the following steps:
* <p>
* Step 1: get source and target connection<br>
* Step 2: get new inter relationship constraint and add it to the resource of the diagram<br>
* Step 3: set source, target and container of inter relationship constraint<br>
* @param type the type to create a inter relationship constraint of
* @param aircp the sub class calling this operation
*/
public Connection createInterRelationshipConstraint(ICreateConnectionContext createContext, Type type, AbstractInterRelationshipConstraintPattern aircp) {
//Step 1
Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.ModelElement sourceConnection = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.ModelElement targetConnection = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
//Step 2
Relation newInterRelationshipConstraint = OrmFactory.eINSTANCE.createRelation();
newInterRelationshipConstraint.setType(type);
if(newInterRelationshipConstraint.eResource() != null) getDiagram().eResource().getContents().add(newInterRelationshipConstraint);
//Step 3
newInterRelationshipConstraint.setContainer(sourceConnection.getContainer());
sourceConnection.getContainer().getElements().add(newInterRelationshipConstraint);
newInterRelationshipConstraint.setSource(sourceConnection);
newInterRelationshipConstraint.setTarget(targetConnection);
//Step 4
AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);
addContext.setNewObject(newInterRelationshipConstraint);
Connection newConnection = null;
if(aircp.canAdd(addContext)) newConnection = (Connection) aircp.add(addContext);
return newConnection;
}
} }
package org.framed.iorm.ui.pattern.connections.interrelationship; package org.framed.iorm.ui.pattern.connections.interrelationship;
import org.eclipse.graphiti.features.context.ICreateConnectionContext;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.framed.iorm.model.Type;
import org.framed.iorm.ui.literals.IdentifierLiterals;
import org.framed.iorm.ui.literals.LayoutLiterals;
import org.framed.iorm.ui.literals.NameLiterals;
import org.framed.iorm.ui.pattern.connections.roleconstraint.AbstractRoleConstraintPattern;
//TODO
public class RelationshipImplicationConstraintPattern extends AbstractInterRelationshipConstraintPattern { public class RelationshipImplicationConstraintPattern extends AbstractInterRelationshipConstraintPattern {
/**
* the name of the feature gathered from {@link NameLiterals}
*/
private final String RELATIONSHIP_IMPLICATION_FEATURE_NAME = NameLiterals.RELATIONSHIP_IMPLICATION_FEATURE_NAME;
/**
* the identifier for the icon of the create feature gathered from {@link IdentifierLiterals}
*/
private static final String IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION = IdentifierLiterals.IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION;
/**
* Class constructor
*/
public RelationshipImplicationConstraintPattern() {
super();
}
/**
* get method for the features name
* @return the name of the feature
*/
@Override
public String getCreateName() {
return RELATIONSHIP_IMPLICATION_FEATURE_NAME;
}
/**
* get method for the identifier of the icon for the create feature
* @return the id of the icon
*/
@Override
public String getCreateImageId() {
return IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION;
}
//create feature
//~~~~~~~~~~~~~~
/**
* uses the super types equivalent operation to create the relationship implications
*/
@Override
public Connection create(ICreateConnectionContext createContext) {
return super.createInterRelationshipConstraint(createContext, Type.RELATIONSHIP_IMPLICATION, this);
}
} }
...@@ -168,7 +168,7 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS ...@@ -168,7 +168,7 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS
} }
/** /**
* creates the business object of an intra relationship constraint of the given type using the following steps: * creates the business object of an intra relationship constraint of the given type
* @param createContext the context which has a reference to the relationship to add the constraint to * @param createContext the context which has a reference to the relationship to add the constraint to
* @param type the type of the constraint to add to * @param type the type of the constraint to add to
* @param aircp the sub class calling this operation * @param aircp the sub class calling this operation
...@@ -184,8 +184,8 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS ...@@ -184,8 +184,8 @@ public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDS
if(newIntraRelCon.eResource() != null) getDiagram().eResource().getContents().add(newIntraRelCon); if(newIntraRelCon.eResource() != null) getDiagram().eResource().getContents().add(newIntraRelCon);
model.getElements().add(newIntraRelCon); model.getElements().add(newIntraRelCon);
newIntraRelCon.setContainer(model); newIntraRelCon.setContainer(model);
newIntraRelCon.setSource(ConnectionPatternUtil.getShapeForAnchor(sourceAnchor)); newIntraRelCon.setSource(ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor));
newIntraRelCon.setTarget(ConnectionPatternUtil.getShapeForAnchor(targetAnchor)); newIntraRelCon.setTarget(ConnectionPatternUtil.getModelElementForAnchor(targetAnchor));
AddContext addContext = new AddContext(); AddContext addContext = new AddContext();
addContext.setNewObject(newIntraRelCon); addContext.setNewObject(newIntraRelCon);
addContext.setTargetConnection(targetConnection); addContext.setTargetConnection(targetConnection);
......
...@@ -66,8 +66,8 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt ...@@ -66,8 +66,8 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt
public boolean canCreate(ICreateConnectionContext createContext) { public boolean canCreate(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
if(sourceShape != null && targetShape != null) { if(sourceShape != null && targetShape != null) {
if(sourceShape.getContainer() == targetShape.getContainer() && if(sourceShape.getContainer() == targetShape.getContainer() &&
!(sourceShape.equals(targetShape))) { !(sourceShape.equals(targetShape))) {
...@@ -89,7 +89,7 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt ...@@ -89,7 +89,7 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt
@Override @Override
public boolean canStartConnection(ICreateConnectionContext createContext) { public boolean canStartConnection(ICreateConnectionContext createContext) {
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
if(sourceShape != null){ if(sourceShape != null){
if(sourceShape.getType() == Type.ROLE_TYPE) if(sourceShape.getType() == Type.ROLE_TYPE)
return true; return true;
...@@ -111,8 +111,8 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt ...@@ -111,8 +111,8 @@ public abstract class AbstractRoleConstraintPattern extends FRaMEDConnectionPatt
//Step 1 //Step 1
Anchor sourceAnchor = createContext.getSourceAnchor(); Anchor sourceAnchor = createContext.getSourceAnchor();
Anchor targetAnchor = createContext.getTargetAnchor(); Anchor targetAnchor = createContext.getTargetAnchor();
org.framed.iorm.model.Shape sourceShape = ConnectionPatternUtil.getShapeForAnchor(sourceAnchor); org.framed.iorm.model.ModelElement sourceShape = ConnectionPatternUtil.getModelElementForAnchor(sourceAnchor);
org.framed.iorm.model.Shape targetShape = ConnectionPatternUtil.getShapeForAnchor(targetAnchor); org.framed.iorm.model.ModelElement targetShape = ConnectionPatternUtil.getModelElementForAnchor(targetAnchor);
//Step 2 //Step 2
Relation newRoleConstraint = OrmFactory.eINSTANCE.createRelation(); Relation newRoleConstraint = OrmFactory.eINSTANCE.createRelation();
newRoleConstraint.setType(type); newRoleConstraint.setType(type);
......
...@@ -104,7 +104,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern { ...@@ -104,7 +104,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern {
Anchor sourceAnchor = addConnectionContext.getSourceAnchor(); Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
Anchor targetAnchor = addConnectionContext.getTargetAnchor(); Anchor targetAnchor = addConnectionContext.getTargetAnchor();
//Step 1 //Step 1
Connection connection = pictogramElementCreateSerive.createFreeFormConnection(getDiagram()); Connection connection = pictogramElementCreateService.createFreeFormConnection(getDiagram());
connection.setStart(sourceAnchor); connection.setStart(sourceAnchor);
connection.setEnd(targetAnchor); connection.setEnd(targetAnchor);
Polyline polyline = graphicAlgorithmService.createPolyline(connection); Polyline polyline = graphicAlgorithmService.createPolyline(connection);
...@@ -113,7 +113,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern { ...@@ -113,7 +113,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern {
polyline.setLineWidth(2); polyline.setLineWidth(2);
//Step2 //Step2
ConnectionDecorator connectionDecoratorTarget; ConnectionDecorator connectionDecoratorTarget;
connectionDecoratorTarget = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 1.0, true); connectionDecoratorTarget = pictogramElementCreateService.createConnectionDecorator(connection, false, 1.0, true);
int pointsTarget[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1 int pointsTarget[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1
0, 0, //P2 0, 0, //P2
-1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT };//P3 -1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT };//P3
...@@ -122,7 +122,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern { ...@@ -122,7 +122,7 @@ public class RoleEquivalencePattern extends AbstractRoleConstraintPattern {
arrowheadTarget.setBackground(manageColor(COLOR_ARROWHEAD)); arrowheadTarget.setBackground(manageColor(COLOR_ARROWHEAD));
PropertyUtil.setShape_IdValue(connectionDecoratorTarget, SHAPE_ID_ROLE_CONSTRAINT_DECORATOR); PropertyUtil.setShape_IdValue(connectionDecoratorTarget, SHAPE_ID_ROLE_CONSTRAINT_DECORATOR);
ConnectionDecorator connectionDecoratorSource; ConnectionDecorator connectionDecoratorSource;
connectionDecoratorSource = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 0, true); connectionDecoratorSource = pictogramElementCreateService.createConnectionDecorator(connection, false, 0, true);
int pointsSource[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1 int pointsSource[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1
0, 0, //P2 0, 0, //P2
-1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT }; //P3 -1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT }; //P3
......
...@@ -104,7 +104,7 @@ public class RoleImplicationPattern extends AbstractRoleConstraintPattern { ...@@ -104,7 +104,7 @@ public class RoleImplicationPattern extends AbstractRoleConstraintPattern {
Anchor sourceAnchor = addConnectionContext.getSourceAnchor(); Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
Anchor targetAnchor = addConnectionContext.getTargetAnchor(); Anchor targetAnchor = addConnectionContext.getTargetAnchor();
//Step 1 //Step 1
Connection connection = pictogramElementCreateSerive.createFreeFormConnection(getDiagram()); Connection connection = pictogramElementCreateService.createFreeFormConnection(getDiagram());
connection.setStart(sourceAnchor); connection.setStart(sourceAnchor);
connection.setEnd(targetAnchor); connection.setEnd(targetAnchor);
Polyline polyline = graphicAlgorithmService.createPolyline(connection); Polyline polyline = graphicAlgorithmService.createPolyline(connection);
...@@ -113,7 +113,7 @@ public class RoleImplicationPattern extends AbstractRoleConstraintPattern { ...@@ -113,7 +113,7 @@ public class RoleImplicationPattern extends AbstractRoleConstraintPattern {
polyline.setLineWidth(2); polyline.setLineWidth(2);
//Step2 //Step2
ConnectionDecorator connectionDecorator; ConnectionDecorator connectionDecorator;
connectionDecorator = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 1.0, true); connectionDecorator = pictogramElementCreateService.createConnectionDecorator(connection, false, 1.0, true);
int points[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1 int points[] = new int[] { -1*ARROWHEAD_LENGTH, ARROWHEAD_HEIGHT, //Point 1
0, 0, //P2 0, 0, //P2
-1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT }; //P3 -1*ARROWHEAD_LENGTH, -1*ARROWHEAD_HEIGHT }; //P3
......
...@@ -101,7 +101,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern { ...@@ -101,7 +101,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern {
Anchor sourceAnchor = addConnectionContext.getSourceAnchor(); Anchor sourceAnchor = addConnectionContext.getSourceAnchor();
Anchor targetAnchor = addConnectionContext.getTargetAnchor(); Anchor targetAnchor = addConnectionContext.getTargetAnchor();
//Step 1 //Step 1
Connection connection = pictogramElementCreateSerive.createFreeFormConnection(getDiagram()); Connection connection = pictogramElementCreateService.createFreeFormConnection(getDiagram());
connection.setStart(sourceAnchor); connection.setStart(sourceAnchor);
connection.setEnd(targetAnchor); connection.setEnd(targetAnchor);
Polyline polyline = graphicAlgorithmService.createPolyline(connection); Polyline polyline = graphicAlgorithmService.createPolyline(connection);
...@@ -110,7 +110,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern { ...@@ -110,7 +110,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern {
polyline.setLineWidth(2); polyline.setLineWidth(2);
//Step2 //Step2
ConnectionDecorator connectionDecoratorTarget; ConnectionDecorator connectionDecoratorTarget;
connectionDecoratorTarget = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 1.0, true); connectionDecoratorTarget = pictogramElementCreateService.createConnectionDecorator(connection, false, 1.0, true);
int pointsTarget[] = new int[] { 0, ARROWHEAD_HEIGHT, //Point 1 int pointsTarget[] = new int[] { 0, ARROWHEAD_HEIGHT, //Point 1
-1*ARROWHEAD_LENGTH, 0, //P2 -1*ARROWHEAD_LENGTH, 0, //P2
0, -1*ARROWHEAD_HEIGHT }; //P3 0, -1*ARROWHEAD_HEIGHT }; //P3
...@@ -119,7 +119,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern { ...@@ -119,7 +119,7 @@ public class RoleProhibitionPattern extends AbstractRoleConstraintPattern {
polylineTarget.setForeground(manageColor(COLOR_CONNECTIONS)); polylineTarget.setForeground(manageColor(COLOR_CONNECTIONS));
PropertyUtil.setShape_IdValue(connectionDecoratorTarget, SHAPE_ID_ROLE_CONSTRAINT_DECORATOR); PropertyUtil.setShape_IdValue(connectionDecoratorTarget, SHAPE_ID_ROLE_CONSTRAINT_DECORATOR);
ConnectionDecorator connectionDecoratorSource; ConnectionDecorator connectionDecoratorSource;
connectionDecoratorSource = pictogramElementCreateSerive.createConnectionDecorator(connection, false, 0, true); connectionDecoratorSource = pictogramElementCreateService.createConnectionDecorator(connection, false, 0, true);
int pointsSource[] = new int[] { 0, ARROWHEAD_HEIGHT, //Point 1 int pointsSource[] = new int[] { 0, ARROWHEAD_HEIGHT, //Point 1
-1*ARROWHEAD_LENGTH, 0, //P2 -1*ARROWHEAD_LENGTH, 0, //P2
0, -1*ARROWHEAD_HEIGHT }; //P3 0, -1*ARROWHEAD_HEIGHT }; //P3
......
...@@ -20,6 +20,7 @@ import org.framed.iorm.ui.graphitifeatures.StepInFeature; ...@@ -20,6 +20,7 @@ import org.framed.iorm.ui.graphitifeatures.StepInFeature;
import org.framed.iorm.ui.graphitifeatures.StepInNewTabFeature; import org.framed.iorm.ui.graphitifeatures.StepInNewTabFeature;
import org.framed.iorm.ui.graphitifeatures.StepOutFeature; import org.framed.iorm.ui.graphitifeatures.StepOutFeature;
import org.framed.iorm.ui.pattern.connections.*; import org.framed.iorm.ui.pattern.connections.*;
import org.framed.iorm.ui.pattern.connections.interrelationship.RelationshipImplicationConstraintPattern;
import org.framed.iorm.ui.pattern.connections.intrarelationship.AbstractIntraRelationshipConstraintPattern; import org.framed.iorm.ui.pattern.connections.intrarelationship.AbstractIntraRelationshipConstraintPattern;
import org.framed.iorm.ui.pattern.connections.intrarelationship.AcyclicConstraintPattern; import org.framed.iorm.ui.pattern.connections.intrarelationship.AcyclicConstraintPattern;
import org.framed.iorm.ui.pattern.connections.intrarelationship.CyclicConstraintPattern; import org.framed.iorm.ui.pattern.connections.intrarelationship.CyclicConstraintPattern;
...@@ -72,6 +73,8 @@ public class FeatureProvider extends DefaultFeatureProviderWithPatterns { ...@@ -72,6 +73,8 @@ public class FeatureProvider extends DefaultFeatureProviderWithPatterns {
addPattern(new IrreflexiveConstraintPattern()); addPattern(new IrreflexiveConstraintPattern());
addPattern(new ReflexiveConstraintPattern()); addPattern(new ReflexiveConstraintPattern());
addPattern(new TotalConstraintPattern()); addPattern(new TotalConstraintPattern());
addConnectionPattern(new RelationshipImplicationConstraintPattern());
//addConnectionPattern(new RelationshipProhibitionConstraintPattern());
} }
/** /**
......
...@@ -36,7 +36,9 @@ public class ImageProvider extends AbstractImageProvider { ...@@ -36,7 +36,9 @@ public class ImageProvider extends AbstractImageProvider {
IMG_ID_FEATURE_ROLEEQUIVALENCE = IdentifierLiterals.IMG_ID_FEATURE_ROLEEQUIVALENCE, IMG_ID_FEATURE_ROLEEQUIVALENCE = IdentifierLiterals.IMG_ID_FEATURE_ROLEEQUIVALENCE,
IMG_ID_FEATURE_ROLEPROHIBITION = IdentifierLiterals.IMG_ID_FEATURE_ROLEPROHIBITION, IMG_ID_FEATURE_ROLEPROHIBITION = IdentifierLiterals.IMG_ID_FEATURE_ROLEPROHIBITION,
IMG_ID_FEATURE_RELATIONSHIP = IdentifierLiterals.IMG_ID_FEATURE_RELATIONSHIP, IMG_ID_FEATURE_RELATIONSHIP = IdentifierLiterals.IMG_ID_FEATURE_RELATIONSHIP,
IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IdentifierLiterals.IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT; IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IdentifierLiterals.IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT,
IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION = IdentifierLiterals.IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION,
IMG_ID_FEATURE_RELATIONSHIP_PROHIBITION = IdentifierLiterals.IMG_ID_FEATURE_RELATIONSHIP_EXCLUSION;
/** /**
* the image file paths to icons used for shape create features gathered from {@link URLLiterals} * the image file paths to icons used for shape create features gathered from {@link URLLiterals}
...@@ -61,7 +63,9 @@ public class ImageProvider extends AbstractImageProvider { ...@@ -61,7 +63,9 @@ public class ImageProvider extends AbstractImageProvider {
IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE = URLLiterals.IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE, IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE = URLLiterals.IMG_FILEPATH_FEATURE_ROLEEQUIVALENCE,
IMG_FILEPATH_FEATURE_ROLEPROHIBITION = URLLiterals.IMG_FILEPATH_FEATURE_ROLEPROHIBITION, IMG_FILEPATH_FEATURE_ROLEPROHIBITION = URLLiterals.IMG_FILEPATH_FEATURE_ROLEPROHIBITION,
IMG_FILEPATH_FEATURE_RELATIONSHIP = URLLiterals.IMG_FILEPATH_FEATURE_RELATIONSHIP, IMG_FILEPATH_FEATURE_RELATIONSHIP = URLLiterals.IMG_FILEPATH_FEATURE_RELATIONSHIP,
IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT = URLLiterals.IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT; IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT = URLLiterals.IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT,
IMG_FILEPATH_FEATURE_RELATIONSHIP_IMPLICATION = URLLiterals.IMG_FILEPATH_FEATURE_RELATIONSHIP_IMPLICATION,
IMG_FILEPATH_FEATURE_RELATIONSHIP_PROHIBTION = URLLiterals.IMG_FILEPATH_FEATURE_RELATIONSHIP_EXCLUSION;
/** /**
* links the file paths to image identifiers * links the file paths to image identifiers
...@@ -85,5 +89,7 @@ public class ImageProvider extends AbstractImageProvider { ...@@ -85,5 +89,7 @@ public class ImageProvider extends AbstractImageProvider {
addImageFilePath(IMG_ID_FEATURE_ROLEPROHIBITION, IMG_FILEPATH_FEATURE_ROLEPROHIBITION); addImageFilePath(IMG_ID_FEATURE_ROLEPROHIBITION, IMG_FILEPATH_FEATURE_ROLEPROHIBITION);
addImageFilePath(IMG_ID_FEATURE_RELATIONSHIP, IMG_FILEPATH_FEATURE_RELATIONSHIP); addImageFilePath(IMG_ID_FEATURE_RELATIONSHIP, IMG_FILEPATH_FEATURE_RELATIONSHIP);
addImageFilePath(IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT, IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT); addImageFilePath(IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT, IMG_FILEPATH_FEATURE_INTRARELATIONSHIP_CONSTRAINT);
addImageFilePath(IMG_ID_FEATURE_RELATIONSHIP_IMPLICATION, IMG_FILEPATH_FEATURE_RELATIONSHIP_IMPLICATION);
addImageFilePath(IMG_ID_FEATURE_RELATIONSHIP_PROHIBITION, IMG_FILEPATH_FEATURE_RELATIONSHIP_PROHIBTION);
} }
} }
...@@ -60,8 +60,9 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ ...@@ -60,8 +60,9 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
CYCLIC_FEATURE_NAME = NameLiterals.CYCLIC_FEATURE_NAME, CYCLIC_FEATURE_NAME = NameLiterals.CYCLIC_FEATURE_NAME,
IRREFLEXIVE_FEATURE_NAME = NameLiterals.IRREFLEXIVE_FEATURE_NAME, IRREFLEXIVE_FEATURE_NAME = NameLiterals.IRREFLEXIVE_FEATURE_NAME,
REFLEXIVE_FEATURE_NAME = NameLiterals.REFLEXIVE_FEATURE_NAME, REFLEXIVE_FEATURE_NAME = NameLiterals.REFLEXIVE_FEATURE_NAME,
TOTAL_FEATURE_NAME = NameLiterals.TOTAL_FEATURE_NAME; TOTAL_FEATURE_NAME = NameLiterals.TOTAL_FEATURE_NAME,
RELATIONSHIP_IMPLICATION_FEATURE_NAME = NameLiterals.RELATIONSHIP_IMPLICATION_FEATURE_NAME,
RELATIONSHIP_PROHIBITION_FEATURE_NAME = NameLiterals.RELATIONSHIP_EXCLUSION_FEATURE_NAME;
/** /**
* the value for the property diagram kind to identify diagrams belonging to a group or compartment type gathered * the value for the property diagram kind to identify diagrams belonging to a group or compartment type gathered
* from {@link IdentiferLiterals} * from {@link IdentiferLiterals}
...@@ -131,6 +132,8 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ ...@@ -131,6 +132,8 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{
createFeaturesToHideInTopLevelView.add(IRREFLEXIVE_FEATURE_NAME); createFeaturesToHideInTopLevelView.add(IRREFLEXIVE_FEATURE_NAME);
createFeaturesToHideInTopLevelView.add(REFLEXIVE_FEATURE_NAME); createFeaturesToHideInTopLevelView.add(REFLEXIVE_FEATURE_NAME);
createFeaturesToHideInTopLevelView.add(TOTAL_FEATURE_NAME); createFeaturesToHideInTopLevelView.add(TOTAL_FEATURE_NAME);
createFeaturesToHideInTopLevelView.add(RELATIONSHIP_IMPLICATION_FEATURE_NAME);
createFeaturesToHideInTopLevelView.add(RELATIONSHIP_PROHIBITION_FEATURE_NAME);
//feature to hide in the compartment view //feature to hide in the compartment view
createFeaturesToHideInCompartmentView.add(NATURALTYPE_FEATURE_NAME); createFeaturesToHideInCompartmentView.add(NATURALTYPE_FEATURE_NAME);
createFeaturesToHideInCompartmentView.add(DATATYPE_FEATURE_NAME); createFeaturesToHideInCompartmentView.add(DATATYPE_FEATURE_NAME);
......
package org.framed.iorm.ui.util; package org.framed.iorm.ui.util;
import org.eclipse.graphiti.mm.pictograms.Anchor; import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.framed.iorm.model.Shape;
/** /**
* This class offers several utility operations mostly used by the graphiti connection patterns. * This class offers several utility operations mostly used by the graphiti connection patterns.
...@@ -10,20 +9,19 @@ import org.framed.iorm.model.Shape; ...@@ -10,20 +9,19 @@ import org.framed.iorm.model.Shape;
public class ConnectionPatternUtil { public class ConnectionPatternUtil {
/** /**
* helper method to get the {@link Shape} for a given anchor * helper method to get the {@link ModelElement} for a given anchor
* @param anchor the anchor that belongs to the shape to get * @param anchor the anchor that belongs to the model element to get
* @return the shape that has the give anchor * @return the model element that has the give anchor
*/ */
public static org.framed.iorm.model.Shape getShapeForAnchor(Anchor anchor) { public static org.framed.iorm.model.ModelElement getModelElementForAnchor(Anchor anchor) {
Object object = null; Object object = null;
if (anchor != null) { object = GeneralUtil.getBusinessObjectForPictogramElement(anchor.getParent()); } if (anchor != null) { object = GeneralUtil.getBusinessObjectForPictogramElement(anchor.getParent()); }
if (object != null) { if (object != null) {
if (object instanceof org.framed.iorm.model.Shape) if (object instanceof org.framed.iorm.model.Shape)
return (org.framed.iorm.model.Shape) object; return (org.framed.iorm.model.Shape) object;
if (object instanceof org.framed.iorm.model.Relation)
return (org.framed.iorm.model.Relation) object;
} }
return null; return null;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment