diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/FRaMEDMoveConnectionDecoratorFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/FRaMEDMoveConnectionDecoratorFeature.java index ed9776c6ee70b94b7cb3db09bf5128f7dcbc0757..61cc96b9c517e3bc2f6039c4779f1ce29dbc4942 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/FRaMEDMoveConnectionDecoratorFeature.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/graphitifeatures/FRaMEDMoveConnectionDecoratorFeature.java @@ -18,7 +18,8 @@ public class FRaMEDMoveConnectionDecoratorFeature extends DefaultMoveConnectionD /** * values for property shape id of the connection decorators that should be moveable */ - private static final String SHAPE_ID_RELATIONSHIP_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_NAME_DECORATOR; + private static final String SHAPE_ID_RELATIONSHIP_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_RELATIONSHIP_NAME_DECORATOR, + SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR; /** * Class constructor @@ -32,7 +33,8 @@ public class FRaMEDMoveConnectionDecoratorFeature extends DefaultMoveConnectionD * calculates if a connection decorator can be moved */ public boolean canMoveConnectionDecorator(IMoveConnectionDecoratorContext context) { - if(PropertyUtil.isShape_IdValue(context.getConnectionDecorator(), SHAPE_ID_RELATIONSHIP_NAME_DECORATOR)) + if(PropertyUtil.isShape_IdValue(context.getConnectionDecorator(), SHAPE_ID_RELATIONSHIP_NAME_DECORATOR) || + PropertyUtil.isShape_IdValue(context.getConnectionDecorator(), SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR)) return true; return false; } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/NameLiterals.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/NameLiterals.java index d7c8062cf28fea3063745879450c54acfb4a4b82..cd6403daa39d723b03e7c959ffb3b33b63ec42bf 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/NameLiterals.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/literals/NameLiterals.java @@ -90,14 +90,22 @@ public class NameLiterals { * (3) the name of the role equivalence create feature or<br> * (4) the name of the role prohibition create feature or<br> * (5) the name of the relationship create feature or<br> - * (6) the name of the cyclic constraint create feature + * (6) the name of the acyclic 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> + * (9) the name of the reflexive constraint create feature or<br> + * (10) the name of the total constraint create feature */ public static final String INHERITANCE_FEATURE_NAME = "Inheritance", ROLEIMPLICATION_FEATURE_NAME = "Role Implication", ROLEEQUIVALENCE_FEATURE_NAME = "Role Eqivalence", ROLEPROHIBITION_FEATURE_NAME = "Role Prohibition", RELATIONSHIP_FEATURE_NAME = "Relationship", - CYCLIC_FEATURE_NAME = "Cyclic"; + ACYCLIC_FEATURE_NAME = "Acyclic", + CYCLIC_FEATURE_NAME = "Cyclic", + IRREFLEXIVE_FEATURE_NAME = "Irreflexve", + REFLEXIVE_FEATURE_NAME = "Reflexive", + TOTAL_FEATURE_NAME = "Total"; /** * name literals used in the patterns to be identified by the ToolBehaviorProvider diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintFeature.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintPattern.java similarity index 57% rename from org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintFeature.java rename to org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintPattern.java index 7299abc04ada0ef1a24c2a96687a98e1309dd626..e1137f327ee7d67337a823dd620405c968fd8573 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintFeature.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractIntraRelationshipConstraintPattern.java @@ -1,11 +1,8 @@ package org.framed.iorm.ui.pattern.connections; -import java.util.List; - import org.eclipse.graphiti.features.context.IAddContext; -import org.eclipse.graphiti.features.context.ICreateConnectionContext; import org.eclipse.graphiti.features.context.ICreateContext; -import org.eclipse.graphiti.features.context.impl.AddConnectionContext; +import org.eclipse.graphiti.features.context.impl.AddContext; import org.eclipse.graphiti.mm.algorithms.Text; import org.eclipse.graphiti.mm.pictograms.Anchor; import org.eclipse.graphiti.mm.pictograms.Connection; @@ -23,15 +20,28 @@ import org.framed.iorm.ui.util.ConnectionPatternUtil; import org.framed.iorm.ui.util.DiagramUtil; import org.framed.iorm.ui.util.PropertyUtil; -//TODO implemented as shapePattern since it should be clicked on a relationship -public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDShapePattern { +/** + * This is the abstract super class of the patterns for intra relationship contraints. It collects similiar operations + * of the patterns {@link AcyclicConstraintPattern}, {@link CyclicConstraintPattern}, {@link IrreflexiveConstraintPattern}, + * {@link ReflexiveConstraintPattern} and {@link TotalConstraintPattern}. + * <p> + * This is implemented as shape pattern instead of a connection pattern since its easier for the user to click on a relationship to + * add a constraint. This would not be able if a connection pattern would be used. As a developer this solution is also preferred as + * this way already provides the relationship to add the constraint to. Otherwise the relationship has to be searched and more code + * would be needed. + * @author Kevin Kassin + */ +public abstract class AbstractIntraRelationshipConstraintPattern extends FRaMEDShapePattern { /** * the identifier for the icon of the create feature gathered from {@link IdentifierLiterals} */ private static final String IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT = IdentifierLiterals.IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT; - //TODO + /** + * the value of the property shape id for the decorators added to the relationship by the intra relationship constraint gathered + * from {@link IdentifierLiterals} + */ protected static final String SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR = IdentifierLiterals.SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR; /** @@ -40,7 +50,15 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS protected static final IColorConstant COLOR_CONNECTIONS = LayoutLiterals.COLOR_CONNECTIONS, COLOR_TEXT = LayoutLiterals.COLOR_TEXT; - public AbstractIntraRelationshipConstraintFeature() { + /** + * layout integers gathered from {@link LayoutLiterals} + */ + protected static final int DISTANCE_FROM_CONNECTION_LINE = LayoutLiterals.DISTANCE_FROM_CONNECTION_LINE; + + /** + * Class constructor + */ + public AbstractIntraRelationshipConstraintPattern() { super(); } @@ -54,6 +72,10 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS return IMG_ID_FEATURE_INTRARELATIONSHIP_CONSTRAINT; } + /** + * checks if pattern is applicable for a given business object + * @return true, if the business object is a {@link org.framed.iorm.model.Relation} of the right type + */ @Override public boolean isMainBusinessObjectApplicable(Object mainBusinessObject) { if(mainBusinessObject instanceof Relation) { @@ -68,11 +90,19 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS return false; } + /** + * checks if pattern is applicable for a given pictogram element + * @return true, if business object of the pictogram element is a {@link org.framed.iorm.model.Relation} of the right type + */ @Override protected boolean isPatternControlled(PictogramElement pictogramElement) { return isMainBusinessObjectApplicable(this.getBusinessObjectForPictogramElement(pictogramElement)); } - + + /** + * checks if pattern is applicable for a given pictogram element + * @return true, if the business object of the pictogram element is a {@link org.framed.iorm.model.Relation} of the right type + */ @Override protected boolean isPatternRoot(PictogramElement pictogramElement) { return isMainBusinessObjectApplicable(this.getBusinessObjectForPictogramElement(pictogramElement)); @@ -80,7 +110,13 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS //add feature //~~~~~~~~~~~ - //TODO + /** + * calculates if the intra relationship constraint can be added to the relationship + * <p> + * returns true if:<br> + * (1) the new business object is a {@link org.framed.iorm.model.Relation} of the right type + * @return if the intra relationship constraint can be added + */ public boolean canAddIntraRelationshipConstraint(IAddContext addContext, Type type) { if(addContext.getNewObject() instanceof Relation) { Relation relation = (Relation) addContext.getNewObject(); @@ -90,13 +126,21 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS return false; } - //TODO + /** + * adds the graphical representation of an intra relationship constraint in the relationship + * <p> + * @param addContext the context which has a reference to the relationship to add the constraint to + * @param type the type of the constraint to add + * @return the connection decorator with the constraints name added + */ public PictogramElement addIntraRelationshipConstraint(IAddContext addContext, Type type) { Connection targetConnection = addContext.getTargetConnection(); ConnectionDecorator constraintName = pictogramElementCreateService.createConnectionDecorator(targetConnection, true, 0.5, true); Text nameText = graphicAlgorithmService.createText(constraintName, type.getName().toLowerCase()); - nameText.setForeground(manageColor(COLOR_TEXT)); + nameText.setForeground(manageColor(COLOR_TEXT)); + nameText.setFont(manageFont("Arial", 10, false, true)); + graphicAlgorithmService.setLocation(nameText, 0, DISTANCE_FROM_CONNECTION_LINE); PropertyUtil.setShape_IdValue(constraintName, SHAPE_ID_INTRA_REL_CON_NAME_DECORATOR); link(constraintName, addContext.getNewObject()); return constraintName; @@ -107,8 +151,7 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS /** * calculates if a intra relationship constraint can be created * <p> - * returns true if<br> - * TODO + * returns true if the clicked on pictogram element belongs to a relationship * @return if inheritance can be added */ @Override @@ -121,8 +164,15 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS } return false; } - - public Object[] createIntraRelationshipConstraint(ICreateContext createContext, Type type) { + + /** + * creates the business object of an intra relationship constraint of the given type using the following steps: + * @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 aircp the sub class calling this operation + * @return the created business object + */ + public Object[] createIntraRelationshipConstraint(ICreateContext createContext, Type type, AbstractIntraRelationshipConstraintPattern aircp) { Connection targetConnection = createContext.getTargetConnection(); Anchor sourceAnchor = targetConnection.getStart(), targetAnchor = targetConnection.getEnd(); @@ -135,7 +185,11 @@ public abstract class AbstractIntraRelationshipConstraintFeature extends FRaMEDS newIntraRelCon.setContainer(model); newIntraRelCon.setSource(ConnectionPatternUtil.getShapeForAnchor(sourceAnchor)); newIntraRelCon.setTarget(ConnectionPatternUtil.getShapeForAnchor(targetAnchor)); - addGraphicalRepresentation(createContext, newIntraRelCon); + + AddContext addContext = new AddContext(); + addContext.setNewObject(newIntraRelCon); + addContext.setTargetConnection(targetConnection); + if(aircp.canAdd(addContext)) aircp.add(addContext); return new Object[] { newIntraRelCon }; } } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractRoleConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractRoleConstraintPattern.java index 870aa78aa3d307ca12af86f294e5b63d60b42a44..12811c24bd68931d7ffb511e6fc310c9a046ec12 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractRoleConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AbstractRoleConstraintPattern.java @@ -12,7 +12,7 @@ import org.framed.iorm.ui.literals.IdentifierLiterals; import org.framed.iorm.ui.util.ConnectionPatternUtil; /** - * This is the abstract sub class of the pattern for role constraint. It collects similiar operations + * This is the abstract super class of the patterns for role constraint. It collects similiar operations * of the patterns {@link RoleImplicationPattern}, {@link RoleEquivalencePattern} and * {@link RoleProhibitionPattern}. * @author Kevin Kassin diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AcyclicConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AcyclicConstraintPattern.java new file mode 100644 index 0000000000000000000000000000000000000000..e840eef98238c1478fa43cbb14112dee3b62cf1b --- /dev/null +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/AcyclicConstraintPattern.java @@ -0,0 +1,71 @@ +package org.framed.iorm.ui.pattern.connections; + +import org.eclipse.graphiti.features.context.IAddContext; +import org.eclipse.graphiti.features.context.ICreateContext; +import org.eclipse.graphiti.mm.pictograms.PictogramElement; +import org.framed.iorm.model.Relation; +import org.framed.iorm.model.Type; +import org.framed.iorm.ui.literals.NameLiterals; + +/** + * This graphiti pattern is used to work with {@link Relation}s + * of the type {@link Type#ACYCLIC} in the editor. + * <p> + * It deals with the following aspects of acyclic intra relationship constraints:<br> + * (1) creating acyclic constraints, especially their business object<br> + * (2) adding acyclic constraints to the diagram, especially their pictogram elements<br> + * <p> + * It is a subclass of {@link AbstractIntraRelationshipConstraintPattern} and several operations used here are implemented there. + * @author Kevin Kassin + */ +public class AcyclicConstraintPattern extends AbstractIntraRelationshipConstraintPattern { + + /** + * the name of the feature gathered from {@link NameLiterals} + */ + private static final String ACYCLIC_FEATURE_NAME = NameLiterals.ACYCLIC_FEATURE_NAME; + + /** + * Class constructor + */ + public AcyclicConstraintPattern() { + super(); + } + + /** + * get method for the features name + * @return the name of the feature + */ + @Override + public String getCreateName() { + return ACYCLIC_FEATURE_NAME; + } + + //add feature + //~~~~~~~~~~~ + /** + * calls its equivalent super class operation to calculate if an acyclic constraint can be added + */ + @Override + public boolean canAdd(IAddContext addContext) { + return canAddIntraRelationshipConstraint(addContext, Type.ACYCLIC); + } + + /** + * calls its equivalent super class operation to add an acyclic constraint + */ + @Override + public PictogramElement add(IAddContext addContext) { + return addIntraRelationshipConstraint(addContext, Type.ACYCLIC); + } + + //create feature + //~~~~~~~~~~~~~~ + /** + * calls its equivalent super class operation to create an acyclic constraint + */ + @Override + public Object[] create(ICreateContext createContext) { + return createIntraRelationshipConstraint(createContext, Type.ACYCLIC, this); + } +} diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/CyclicConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/CyclicConstraintPattern.java index 16a29c28978a3bfbaf38c1df9928022abb435170..0829e0ea3413d31bec2e858b3192c69d55bb562e 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/CyclicConstraintPattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/CyclicConstraintPattern.java @@ -1,15 +1,24 @@ package org.framed.iorm.ui.pattern.connections; import org.eclipse.graphiti.features.context.IAddContext; -import org.eclipse.graphiti.features.context.ICreateConnectionContext; import org.eclipse.graphiti.features.context.ICreateContext; -import org.eclipse.graphiti.mm.pictograms.Connection; import org.eclipse.graphiti.mm.pictograms.PictogramElement; +import org.framed.iorm.model.Relation; import org.framed.iorm.model.Type; import org.framed.iorm.ui.literals.NameLiterals; -//TODO -public class CyclicConstraintPattern extends AbstractIntraRelationshipConstraintFeature { +/** + * This graphiti pattern is used to work with {@link Relation}s + * of the type {@link Type#CYCLIC} in the editor. + * <p> + * It deals with the following aspects of cyclic intra relationship constraints:<br> + * (1) creating cyclic constraints, especially their business object<br> + * (2) adding cyclic constraints to the diagram, especially their pictogram elements<br> + * <p> + * It is a subclass of {@link AbstractIntraRelationshipConstraintPattern} and several operations used here are implemented there. + * @author Kevin Kassin + */ +public class CyclicConstraintPattern extends AbstractIntraRelationshipConstraintPattern { /** * the name of the feature gathered from {@link NameLiterals} @@ -34,11 +43,17 @@ public class CyclicConstraintPattern extends AbstractIntraRelationshipConstraint //add feature //~~~~~~~~~~~ + /** + * calls its equivalent super class operation to calculate if a cyclic constraint can be added + */ @Override public boolean canAdd(IAddContext addContext) { return canAddIntraRelationshipConstraint(addContext, Type.CYCLIC); } + /** + * calls its equivalent super class operation to add a cyclic constraint + */ @Override public PictogramElement add(IAddContext addContext) { return addIntraRelationshipConstraint(addContext, Type.CYCLIC); @@ -46,8 +61,11 @@ public class CyclicConstraintPattern extends AbstractIntraRelationshipConstraint //create feature //~~~~~~~~~~~~~~ + /** + * calls its equivalent super class operation to create a cyclic constraint + */ @Override public Object[] create(ICreateContext createContext) { - return createIntraRelationshipConstraint(createContext, Type.CYCLIC); + return createIntraRelationshipConstraint(createContext, Type.CYCLIC, this); } } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/IrreflexiveConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/IrreflexiveConstraintPattern.java new file mode 100644 index 0000000000000000000000000000000000000000..8da3c514863d4c03051b5b0ce1b58f2be1e0ad89 --- /dev/null +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/IrreflexiveConstraintPattern.java @@ -0,0 +1,71 @@ +package org.framed.iorm.ui.pattern.connections; + +import org.eclipse.graphiti.features.context.IAddContext; +import org.eclipse.graphiti.features.context.ICreateContext; +import org.eclipse.graphiti.mm.pictograms.PictogramElement; +import org.framed.iorm.model.Relation; +import org.framed.iorm.model.Type; +import org.framed.iorm.ui.literals.NameLiterals; + +/** + * This graphiti pattern is used to work with {@link Relation}s + * of the type {@link Type#IRREFLEXIVE} in the editor. + * <p> + * It deals with the following aspects of irreflexive intra relationship constraints:<br> + * (1) creating irreflexive constraints, especially their business object<br> + * (2) adding irreflexive constraints to the diagram, especially their pictogram elements<br> + * <p> + * It is a subclass of {@link AbstractIntraRelationshipConstraintPattern} and several operations used here are implemented there. + * @author Kevin Kassin + */ +public class IrreflexiveConstraintPattern extends AbstractIntraRelationshipConstraintPattern { + + /** + * the name of the feature gathered from {@link NameLiterals} + */ + private static final String IRREFLEXIVE_FEATURE_NAME = NameLiterals.IRREFLEXIVE_FEATURE_NAME; + + /** + * Class constructor + */ + public IrreflexiveConstraintPattern() { + super(); + } + + /** + * get method for the features name + * @return the name of the feature + */ + @Override + public String getCreateName() { + return IRREFLEXIVE_FEATURE_NAME; + } + + //add feature + //~~~~~~~~~~~ + /** + * calls its equivalent super class operation to calculate if an irreflexive constraint can be added + */ + @Override + public boolean canAdd(IAddContext addContext) { + return canAddIntraRelationshipConstraint(addContext, Type.IRREFLEXIVE); + } + + /** + * calls its equivalent super class operation to add an irreflexive constraint + */ + @Override + public PictogramElement add(IAddContext addContext) { + return addIntraRelationshipConstraint(addContext, Type.IRREFLEXIVE); + } + + //create feature + //~~~~~~~~~~~~~~ + /** + * calls its equivalent super class operation to create an irreflexive constraint + */ + @Override + public Object[] create(ICreateContext createContext) { + return createIntraRelationshipConstraint(createContext, Type.IRREFLEXIVE, this); + } +} diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/ReflexiveConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/ReflexiveConstraintPattern.java new file mode 100644 index 0000000000000000000000000000000000000000..124a94448ab7fc42d7968f7ff7f68fcfeab84ccf --- /dev/null +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/ReflexiveConstraintPattern.java @@ -0,0 +1,71 @@ +package org.framed.iorm.ui.pattern.connections; + +import org.eclipse.graphiti.features.context.IAddContext; +import org.eclipse.graphiti.features.context.ICreateContext; +import org.eclipse.graphiti.mm.pictograms.PictogramElement; +import org.framed.iorm.model.Relation; +import org.framed.iorm.model.Type; +import org.framed.iorm.ui.literals.NameLiterals; + +/** + * This graphiti pattern is used to work with {@link Relation}s + * of the type {@link Type#REFLEXIVE} in the editor. + * <p> + * It deals with the following aspects of irreflexive intra relationship constraints:<br> + * (1) creating reflexive constraints, especially their business object<br> + * (2) adding reflexive constraints to the diagram, especially their pictogram elements<br> + * <p> + * It is a subclass of {@link AbstractIntraRelationshipConstraintPattern} and several operations used here are implemented there. + * @author Kevin Kassin + */ +public class ReflexiveConstraintPattern extends AbstractIntraRelationshipConstraintPattern { + + /** + * the name of the feature gathered from {@link NameLiterals} + */ + private static final String REFLEXIVE_FEATURE_NAME = NameLiterals.REFLEXIVE_FEATURE_NAME; + + /** + * Class constructor + */ + public ReflexiveConstraintPattern() { + super(); + } + + /** + * get method for the features name + * @return the name of the feature + */ + @Override + public String getCreateName() { + return REFLEXIVE_FEATURE_NAME; + } + + //add feature + //~~~~~~~~~~~ + /** + * calls its equivalent super class operation to calculate if a reflexive constraint can be added + */ + @Override + public boolean canAdd(IAddContext addContext) { + return canAddIntraRelationshipConstraint(addContext, Type.REFLEXIVE); + } + + /** + * calls its equivalent super class operation to add a reflexive constraint + */ + @Override + public PictogramElement add(IAddContext addContext) { + return addIntraRelationshipConstraint(addContext, Type.REFLEXIVE); + } + + //create feature + //~~~~~~~~~~~~~~ + /** + * calls its equivalent super class operation to create a reflexive constraint + */ + @Override + public Object[] create(ICreateContext createContext) { + return createIntraRelationshipConstraint(createContext, Type.REFLEXIVE, this); + } +} diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/TotalConstraintPattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/TotalConstraintPattern.java new file mode 100644 index 0000000000000000000000000000000000000000..734ad6a0fd5baffc0b124cd8b8242df0cbebb734 --- /dev/null +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/connections/TotalConstraintPattern.java @@ -0,0 +1,71 @@ +package org.framed.iorm.ui.pattern.connections; + +import org.eclipse.graphiti.features.context.IAddContext; +import org.eclipse.graphiti.features.context.ICreateContext; +import org.eclipse.graphiti.mm.pictograms.PictogramElement; +import org.framed.iorm.model.Relation; +import org.framed.iorm.model.Type; +import org.framed.iorm.ui.literals.NameLiterals; + +/** + * This graphiti pattern is used to work with {@link Relation}s + * of the type {@link Type#TOTAL} in the editor. + * <p> + * It deals with the following aspects of total intra relationship constraints:<br> + * (1) creating total constraints, especially their business object<br> + * (2) adding total constraints to the diagram, especially their pictogram elements<br> + * <p> + * It is a subclass of {@link AbstractIntraRelationshipConstraintPattern} and several operations used here are implemented there. + * @author Kevin Kassin + */ +public class TotalConstraintPattern extends AbstractIntraRelationshipConstraintPattern { + + /** + * the name of the feature gathered from {@link NameLiterals} + */ + private static final String TOTAL_FEATURE_NAME = NameLiterals.TOTAL_FEATURE_NAME; + + /** + * Class constructor + */ + public TotalConstraintPattern() { + super(); + } + + /** + * get method for the features name + * @return the name of the feature + */ + @Override + public String getCreateName() { + return TOTAL_FEATURE_NAME; + } + + //add feature + //~~~~~~~~~~~ + /** + * calls its equivalent super class operation to calculate if a total constraint can be added + */ + @Override + public boolean canAdd(IAddContext addContext) { + return canAddIntraRelationshipConstraint(addContext, Type.TOTAL); + } + + /** + * calls its equivalent super class operation to add a total constraint + */ + @Override + public PictogramElement add(IAddContext addContext) { + return addIntraRelationshipConstraint(addContext, Type.TOTAL); + } + + //create feature + //~~~~~~~~~~~~~~ + /** + * calls its equivalent super class operation to create a total constraint + */ + @Override + public Object[] create(ICreateContext createContext) { + return createIntraRelationshipConstraint(createContext, Type.TOTAL, this); + } +} diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java index 1c9f63eab998498567e9e21ddb63e2fd1ba5ead7..c2bb496f194113a2038b8a27313c0a70c9248934 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/pattern/shapes/RoleTypePattern.java @@ -26,7 +26,6 @@ import org.eclipse.graphiti.mm.algorithms.Text; import org.eclipse.graphiti.mm.algorithms.styles.Orientation; import org.eclipse.graphiti.mm.pictograms.ContainerShape; import org.eclipse.graphiti.mm.pictograms.Diagram; -import org.eclipse.graphiti.mm.pictograms.FixPointAnchor; import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.graphiti.mm.pictograms.Shape; import org.eclipse.graphiti.pattern.AbstractPattern; diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/FeatureProvider.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/FeatureProvider.java index 1d37671e1a360ec2279aff402cbea9ee9c2ddd60..f4b4623512d8dd303286afbdd7702d04d7e771a8 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/FeatureProvider.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/providers/FeatureProvider.java @@ -19,22 +19,8 @@ import org.framed.iorm.ui.graphitifeatures.FRaMEDMoveConnectionDecoratorFeature; import org.framed.iorm.ui.graphitifeatures.StepInFeature; import org.framed.iorm.ui.graphitifeatures.StepInNewTabFeature; import org.framed.iorm.ui.graphitifeatures.StepOutFeature; -import org.framed.iorm.ui.pattern.connections.CyclicConstraintPattern; -import org.framed.iorm.ui.pattern.connections.InheritancePattern; -import org.framed.iorm.ui.pattern.connections.RelationshipPattern; -import org.framed.iorm.ui.pattern.connections.RoleEquivalencePattern; -import org.framed.iorm.ui.pattern.connections.RoleImplicationPattern; -import org.framed.iorm.ui.pattern.connections.RoleProhibitionPattern; -import org.framed.iorm.ui.pattern.shapes.AttributeOperationCommonPattern; -import org.framed.iorm.ui.pattern.shapes.AttributePattern; -import org.framed.iorm.ui.pattern.shapes.CompartmentTypePattern; -import org.framed.iorm.ui.pattern.shapes.DataTypePattern; -import org.framed.iorm.ui.pattern.shapes.GroupOrCompartmentTypeElementPattern; -import org.framed.iorm.ui.pattern.shapes.GroupPattern; -import org.framed.iorm.ui.pattern.shapes.ModelPattern; -import org.framed.iorm.ui.pattern.shapes.NaturalTypePattern; -import org.framed.iorm.ui.pattern.shapes.OperationPattern; -import org.framed.iorm.ui.pattern.shapes.RoleTypePattern; +import org.framed.iorm.ui.pattern.connections.*; +import org.framed.iorm.ui.pattern.shapes.*; /** * This class manages the pattern and features for the editing of the diagram type @@ -47,6 +33,9 @@ public class FeatureProvider extends DefaultFeatureProviderWithPatterns { * <p> * It sets the pattern that are used to created, edit and delete shape (Step 1) and * connections (Step 2) in the editor for the diagram type. + * <p> + * For the reason the intra relationship constraints are implemented as shape pattern see + * {@link AbstractIntraRelationshipConstraintPattern}. * @param diagramTypeProvider the provider of the edited diagram type */ public FeatureProvider(IDiagramTypeProvider diagramTypeProvider) { @@ -69,7 +58,11 @@ public class FeatureProvider extends DefaultFeatureProviderWithPatterns { addConnectionPattern(new RoleImplicationPattern()); addConnectionPattern(new RoleEquivalencePattern()); addConnectionPattern(new RoleProhibitionPattern()); + addPattern(new AcyclicConstraintPattern()); addPattern(new CyclicConstraintPattern()); + addPattern(new IrreflexiveConstraintPattern()); + addPattern(new ReflexiveConstraintPattern()); + addPattern(new TotalConstraintPattern()); } /** 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 0b48687b4f55413d8a8fd2ff7664fe44ea93d285..20c9595ba4fc3ba4a68a231282a80d6a4c4d3b68 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 @@ -20,6 +20,7 @@ import org.eclipse.graphiti.tb.IContextMenuEntry; import org.framed.iorm.ui.literals.IdentifierLiterals; import org.framed.iorm.ui.literals.NameLiterals; 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.Relation; @@ -44,9 +45,8 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ NATURALTYPE_FEATURE_NAME = NameLiterals.NATURALTYPE_FEATURE_NAME, DATATYPE_FEATURE_NAME = NameLiterals.DATATYPE_FEATURE_NAME, GROUP_FEATURE_NAME = NameLiterals.GROUP_FEATURE_NAME, - ROLETYPE_FEATURE_NAME = NameLiterals.ROLETYPE_FEATURE_NAME, - CYCLIC_FEATURE_NAME = NameLiterals.CYCLIC_FEATURE_NAME; - + ROLETYPE_FEATURE_NAME = NameLiterals.ROLETYPE_FEATURE_NAME; + /** * the name literals for connection create features to remove from the editor palette for the diagram type * gathered from {@link NameLiterals} @@ -55,7 +55,12 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ ROLEEQUIVALENCE_FEATURE_NAME = NameLiterals.ROLEEQUIVALENCE_FEATURE_NAME, ROLEPROHIBITION_FEATURE_NAME = NameLiterals.ROLEPROHIBITION_FEATURE_NAME, RELATIONSHIP_FEATURE_NAME = NameLiterals.RELATIONSHIP_FEATURE_NAME, - RELATIONSHIP_DECORATOR_FEATURE_NAME = NameLiterals.RELATIONSHIP_DECORATOR_FEATURE_NAME; + RELATIONSHIP_DECORATOR_FEATURE_NAME = NameLiterals.RELATIONSHIP_DECORATOR_FEATURE_NAME, + ACYCLIC_FEATURE_NAME = NameLiterals.ACYCLIC_FEATURE_NAME, + CYCLIC_FEATURE_NAME = NameLiterals.CYCLIC_FEATURE_NAME, + IRREFLEXIVE_FEATURE_NAME = NameLiterals.IRREFLEXIVE_FEATURE_NAME, + REFLEXIVE_FEATURE_NAME = NameLiterals.REFLEXIVE_FEATURE_NAME, + TOTAL_FEATURE_NAME = NameLiterals.TOTAL_FEATURE_NAME; /** * the value for the property diagram kind to identify diagrams belonging to a group or compartment type gathered @@ -98,12 +103,38 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ */ private String paletteType = PALETTE_TYPE_TOPLEVELVIEW; + private List<String> createFeaturesToHideInEveryView = new ArrayList<String>(), + createFeaturesToHideInTopLevelView = new ArrayList<String>(), + createFeaturesToHideInCompartmentView = new ArrayList<String>(); + /** * Class constructor + * <p> + * fills the list of features to hide * @param diagramTypeProvider the provider of the edited diagram type */ public ToolBehaviorProvider(IDiagramTypeProvider diagramTypeProvider) { super(diagramTypeProvider); + //features to hide in every view + createFeaturesToHideInEveryView.add(ATTRIBUTE_OPERATION_COMMON_FEATURE_NAME); + createFeaturesToHideInEveryView.add(MODEL_FEATURE_NAME); + createFeaturesToHideInEveryView.add(GROUP_OR_COMPARTMENT_TYPE_ELEMENT_FEATURE_NAME); + createFeaturesToHideInEveryView.add(RELATIONSHIP_DECORATOR_FEATURE_NAME); + //features to hide in the top level view + createFeaturesToHideInTopLevelView.add(ROLEIMPLICATION_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(ROLEEQUIVALENCE_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(ROLEPROHIBITION_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(RELATIONSHIP_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(ROLETYPE_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(ACYCLIC_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(CYCLIC_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(IRREFLEXIVE_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(REFLEXIVE_FEATURE_NAME); + createFeaturesToHideInTopLevelView.add(TOTAL_FEATURE_NAME); + //feature to hide in the compartment view + createFeaturesToHideInCompartmentView.add(NATURALTYPE_FEATURE_NAME); + createFeaturesToHideInCompartmentView.add(DATATYPE_FEATURE_NAME); + createFeaturesToHideInCompartmentView.add(GROUP_FEATURE_NAME); } /** @@ -218,35 +249,26 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ //Step 1 for(int i = 0; i < superCompartments[1].getToolEntries().size(); i++) { IToolEntry toolEntry = superCompartments[1].getToolEntries().get(i); - if(toolEntry.getLabel().equals(ATTRIBUTE_OPERATION_COMMON_FEATURE_NAME) || - toolEntry.getLabel().equals(MODEL_FEATURE_NAME) || - toolEntry.getLabel().equals(GROUP_OR_COMPARTMENT_TYPE_ELEMENT_FEATURE_NAME) || - toolEntry.getLabel().equals(RELATIONSHIP_DECORATOR_FEATURE_NAME)) + if(GeneralUtil.containsEqual(createFeaturesToHideInEveryView, toolEntry.getLabel())) toolEntriesShapesToDelete.add(toolEntry); } //Step 2 if(paletteType.equals(PALETTE_TYPE_TOPLEVELVIEW)) { for(int i = 0; i < superCompartments[0].getToolEntries().size(); i++) { IToolEntry toolEntry = superCompartments[0].getToolEntries().get(i); - if(toolEntry.getLabel().equals(ROLEIMPLICATION_FEATURE_NAME) || - toolEntry.getLabel().equals(ROLEEQUIVALENCE_FEATURE_NAME) || - toolEntry.getLabel().equals(ROLEPROHIBITION_FEATURE_NAME) || - toolEntry.getLabel().equals(RELATIONSHIP_FEATURE_NAME) || - toolEntry.getLabel().equals(CYCLIC_FEATURE_NAME)) + if(GeneralUtil.containsEqual(createFeaturesToHideInTopLevelView, toolEntry.getLabel())) toolEntriesConnectionToDelete.add(toolEntry); } for(int i = 0; i < superCompartments[1].getToolEntries().size(); i++) { IToolEntry toolEntry = superCompartments[1].getToolEntries().get(i); - if(toolEntry.getLabel().equals(ROLETYPE_FEATURE_NAME)) + if(GeneralUtil.containsEqual(createFeaturesToHideInTopLevelView, toolEntry.getLabel())) toolEntriesShapesToDelete.add(toolEntry); } } //Step 3 if(paletteType.equals(PALETTE_TYPE_COMPARTMENTVIEW)) { for(int i = 0; i < superCompartments[1].getToolEntries().size(); i++) { IToolEntry toolEntry = superCompartments[1].getToolEntries().get(i); - if(toolEntry.getLabel().equals(NATURALTYPE_FEATURE_NAME) || - toolEntry.getLabel().equals(DATATYPE_FEATURE_NAME) || - toolEntry.getLabel().equals(GROUP_FEATURE_NAME)) + if(GeneralUtil.containsEqual(createFeaturesToHideInCompartmentView, toolEntry.getLabel())) toolEntriesShapesToDelete.add(toolEntry); } } for(IToolEntry toolEntryConnectionToDelete : toolEntriesConnectionToDelete) { @@ -259,5 +281,5 @@ public class ToolBehaviorProvider extends DefaultToolBehaviorProvider{ paletteCompartmentEntry.add(superCompartments[j]); } return paletteCompartmentEntry.toArray(new IPaletteCompartmentEntry[paletteCompartmentEntry.size()]); - } + } } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ConnectionPatternUtil.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ConnectionPatternUtil.java index e18ff1ee6932f2f6e1d309aa5f591c9e2777f9b0..d544d5546d687fe95cb60ff9a6b5f7f000643e06 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ConnectionPatternUtil.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ConnectionPatternUtil.java @@ -1,40 +1,14 @@ package org.framed.iorm.ui.util; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.graphiti.features.IMappingProvider; //*import for javadoc link import org.eclipse.graphiti.mm.pictograms.Anchor; -import org.eclipse.graphiti.mm.pictograms.PictogramElement; -import org.framed.iorm.model.Relation; import org.framed.iorm.model.Shape; -import org.framed.iorm.model.Type; +/** + * This class offers several utility operations mostly used by the graphiti connection patterns. + * @author Kevin Kassin + */ public class ConnectionPatternUtil { - public static List<Relation> getRelationForClassOrRole(Shape classOrRole, Type type) { - List<Relation> relations = new ArrayList<Relation>(); - for(Relation relation : classOrRole.getIncomingRelations()) { - if(relation.getType() == type) relations.add(relation); - } - for(Relation relation : classOrRole.getOutgoingRelations()) { - if(relation.getType() == type) relations.add(relation); - } - return relations; - } - - public static List<Relation> getRelationsBetweenClassesOrRoles(Shape sourceClassOrRole, Shape targetClassOrRole, Type type) { - List<Relation> commonRelations = new ArrayList<Relation>(); - List<Relation> sourceRelations = getRelationForClassOrRole(sourceClassOrRole, type); - List<Relation> targetRelations = getRelationForClassOrRole(targetClassOrRole, type); - for(Relation relation : targetRelations) { - if(sourceRelations.contains(relation)) - commonRelations.add(relation); - } - return commonRelations; - } - /** * helper method to get the {@link Shape} for a given anchor * @param anchor the anchor that belongs to the shape to get @@ -42,7 +16,7 @@ public class ConnectionPatternUtil { */ public static org.framed.iorm.model.Shape getShapeForAnchor(Anchor anchor) { Object object = null; - if (anchor != null) { object = getBusinessObjectForPictogramElement(anchor.getParent()); } + if (anchor != null) { object = GeneralUtil.getBusinessObjectForPictogramElement(anchor.getParent()); } if (object != null) { if (object instanceof org.framed.iorm.model.Shape) return (org.framed.iorm.model.Shape) object; @@ -50,18 +24,6 @@ public class ConnectionPatternUtil { return null; } - /** - * returns the first linked business object of a pictogram - * <p> - * This operation is build after method {@link IMappingProvider#getBusinessObjectForPictogramElement} to avoid - * a dependency.<br> - * This is a convenience method for getAllBusinessObjectsForPictogramElement(PictogramElement), because in many - * usecases only a single business object is linked. - * @param pictogramElement the pictogram element to get business object for - * @return the first business object of a pictogram element - */ - private static EObject getBusinessObjectForPictogramElement(PictogramElement pictogramElement) { - return pictogramElement.getLink().getBusinessObjects().get(0); - } + } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/GeneralUtil.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/GeneralUtil.java index b7f4cf15c8c8650396e270a6c1e251dae845be53..866b5f28d45746ef894fd27f075c36d72aba5161 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/GeneralUtil.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/GeneralUtil.java @@ -1,8 +1,13 @@ package org.framed.iorm.ui.util; +import java.util.List; + import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.graphiti.features.IMappingProvider; //*import for javadoc link import org.eclipse.graphiti.features.context.ICreateContext; import org.eclipse.graphiti.features.context.impl.AddContext; +import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; import org.framed.iorm.model.Type; @@ -99,4 +104,31 @@ public class GeneralUtil { } }); } + + /** + * Similiar to the contains operation of lists this method offers a comparison using the equal operation + * of strings to search for equal string in a list of strings. + * @param list the list to search an equal string in + * @param stringToCheckAgainst the string to search an equal one for + * @return if an equal string is found in a given list + */ + public static boolean containsEqual(List<String> list, String stringToCheckAgainst) { + for(String string : list) + if(string.equals(stringToCheckAgainst)) return true; + return false; + } + + /** + * returns the first linked business object of a pictogram + * <p> + * This operation is build after method {@link IMappingProvider#getBusinessObjectForPictogramElement} to avoid + * a dependency.<br> + * This is a convenience method for getAllBusinessObjectsForPictogramElement(PictogramElement), because in many + * usecases only a single business object is linked. + * @param pictogramElement the pictogram element to get business object for + * @return the first business object of a pictogram element + */ + public static EObject getBusinessObjectForPictogramElement(PictogramElement pictogramElement) { + return pictogramElement.getLink().getBusinessObjects().get(0); + } } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ShapePatternUtil.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ShapePatternUtil.java index e18e22dfca8eb70a797c1665d73c2d1d88d5d628..0658f45d1f51edcbdcd2e59efb4235272fd857f9 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ShapePatternUtil.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/util/ShapePatternUtil.java @@ -3,7 +3,6 @@ package org.framed.iorm.ui.util; import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.ecore.EObject; import org.eclipse.graphiti.mm.algorithms.Text; import org.eclipse.graphiti.mm.pictograms.ContainerShape; import org.eclipse.graphiti.mm.pictograms.Diagram; @@ -16,10 +15,9 @@ import org.framed.iorm.model.Type; import org.framed.iorm.ui.literals.IdentifierLiterals; import org.framed.iorm.ui.wizards.RoleModelWizard; //*import for javadoc link import org.framed.iorm.ui.pattern.shapes.GroupPattern; //*import for javadoc link -import org.eclipse.graphiti.features.IMappingProvider; //*import for javadoc link /** - * This class offers several utility operations used by the graphiti patterns. + * This class offers several utility operations mostly used by the graphiti shape patterns. * @author Kevin Kassin */ public class ShapePatternUtil { @@ -167,7 +165,7 @@ public class ShapePatternUtil { if(PropertyUtil.isShape_IdValue(innerContainerShape, SHAPE_ID_ATTRIBUTECONTAINER)) { for(Shape attributeShape : innerContainerShape.getChildren()) { if(PropertyUtil.isShape_IdValue(attributeShape, SHAPE_ID_ATTRIBUTE_TEXT)) { - NamedElement attribute = (NamedElement) getBusinessObjectForPictogramElement(attributeShape); + NamedElement attribute = (NamedElement) GeneralUtil.getBusinessObjectForPictogramElement(attributeShape); businessAttributeNames.add(attribute.getName()); } } } } } } return businessAttributeNames; @@ -211,26 +209,12 @@ public class ShapePatternUtil { if(PropertyUtil.isShape_IdValue(innerContainerShape, SHAPE_ID_OPERATIONCONTAINER)) { for(Shape operationShape : innerContainerShape.getChildren()) { if(PropertyUtil.isShape_IdValue(operationShape, SHAPE_ID_OPERATION_TEXT)) { - NamedElement operation = (NamedElement) getBusinessObjectForPictogramElement(operationShape); + NamedElement operation = (NamedElement) GeneralUtil.getBusinessObjectForPictogramElement(operationShape); businessOperationNames.add(operation.getName()); } } } } } } return businessOperationNames; } - /** - * returns the first linked business object of a pictogram - * <p> - * This operation is build after method {@link IMappingProvider#getBusinessObjectForPictogramElement} to avoid - * a dependency.<br> - * This is a convenience method for getAllBusinessObjectsForPictogramElement(PictogramElement), because in many - * usecases only a single business object is linked. - * @param pictogramElement the pictogram element to get business object for - * @return the first business object of a pictogram element - */ - private static EObject getBusinessObjectForPictogramElement(PictogramElement pictogramElement) { - return pictogramElement.getLink().getBusinessObjects().get(0); - } - /** * fetches the shown occurrence constraint of a role type or role group by its given type body shape * @param pictogramElement the pictogram element to get the shown occurrence constraint for