/** * Get the corresponding local condition link type * * @return link type or null */ private IHintedType getLinkType() { if (UMLElementTypes.Constraint_3011.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPrecondition_4001; } else if (UMLElementTypes.Constraint_3012.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPostcondition_4002; } else if (UMLElementTypes.IntervalConstraint_3032.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPrecondition_4001; } else if (UMLElementTypes.IntervalConstraint_3033.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPostcondition_4002; } else if (UMLElementTypes.DurationConstraint_3034.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPrecondition_4001; } else if (UMLElementTypes.DurationConstraint_3035.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPostcondition_4002; } else if (UMLElementTypes.TimeConstraint_3036.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPrecondition_4001; } else if (UMLElementTypes.TimeConstraint_3037.equals(type)) { return (IHintedType) UMLElementTypes.ActionLocalPostcondition_4002; } else { return null; } }
/** * Get the Command to create the constraint element * * @param containerAction the action which owns the local condition to create * @param conditionType the type of the local condition : precondition (Constraint_3011) or * postcondition (Constraint_3012) * @return the command to create model element or null */ private static ICommandProxy getElementCreationCommand( EObject containerAction, IHintedType conditionType) { CreateElementRequest createElementReq = new CreateElementRequest(containerAction, conditionType); if (UMLElementTypes.Constraint_3011.equals(conditionType)) { ConstraintAsLocalPrecondCreateCommand cmd = new ConstraintAsLocalPrecondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.Constraint_3012.equals(conditionType)) { ConstraintAsLocalPostcondCreateCommand cmd = new ConstraintAsLocalPostcondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.IntervalConstraint_3032.equals(conditionType)) { IntervalConstraintAsLocalPrecondCreateCommand cmd = new IntervalConstraintAsLocalPrecondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.IntervalConstraint_3033.equals(conditionType)) { IntervalConstraintAsLocalPostcondCreateCommand cmd = new IntervalConstraintAsLocalPostcondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.DurationConstraint_3034.equals(conditionType)) { DurationConstraintAsLocalPrecondCreateCommand cmd = new DurationConstraintAsLocalPrecondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.DurationConstraint_3035.equals(conditionType)) { DurationConstraintAsLocalPostcondCreateCommand cmd = new DurationConstraintAsLocalPostcondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.TimeConstraint_3036.equals(conditionType)) { TimeConstraintAsLocalPrecondCreateCommand cmd = new TimeConstraintAsLocalPrecondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else if (UMLElementTypes.TimeConstraint_3037.equals(conditionType)) { TimeConstraintAsLocalPostcondCreateCommand cmd = new TimeConstraintAsLocalPostcondCreateCommand(createElementReq); return new ICommandProxy(cmd); } else { return null; } }