public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (e.NewRolePlayer != null)
            {
                foreach (PresentationElement pe in e.ElementLink.PresentationRolePlayers)
                {
                    // Fix up any binary link shapes attached to the element link.
                    BinaryLinkShape linkShape = pe as BinaryLinkShape;
                    if (linkShape != null)
                    {
                        if (linkShape.ToShape != null && linkShape.ToShape.ModelElement == e.OldRolePlayer)
                        {
                            // The role player on the "to" side of the link changed, point at new role player
                            PresentationElementMoveableCollection newToShapes = e.NewRolePlayer.PresentationRolePlayers;
                            linkShape.ToShape = newToShapes.Count > 0 ? newToShapes[0] as NodeShape : null;
                        }
                        else if (linkShape.FromShape != null && linkShape.FromShape.ModelElement == e.OldRolePlayer)
                        {
                            // The role player on the "from" side of the link changed, point at new role player
                            PresentationElementMoveableCollection newFromShapes = e.NewRolePlayer.PresentationRolePlayers;
                            linkShape.FromShape = newFromShapes.Count > 0 ? newFromShapes[0] as NodeShape : null;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnReferenceChanged(RolePlayerChangedEventArgs args)
        {
            SpecificElementsDiagramReferencesDomainClasses con = args.ElementLink as SpecificElementsDiagramReferencesDomainClasses;

            if (con != null)
            {
                if (args.DomainRole.Id == SpecificElementsDiagramReferencesDomainClasses.SpecificElementsDiagramDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.DiagramClassView.DiagramClass.Id)
                    {
                        RemoveReference(con.DomainClass);
                    }

                    if (args.NewRolePlayerId == this.DiagramClassView.DiagramClass.Id)
                    {
                        AddReference(con.DomainClass);
                    }
                }
                else if (args.DomainRole.Id == SpecificElementsDiagramReferencesDomainClasses.DomainClassId)
                {
                    if (args.OldRolePlayer != null)
                    {
                        RemoveReference(args.OldRolePlayer as DomainClass);
                    }

                    if (args.NewRolePlayer != null)
                    {
                        AddReference(args.NewRolePlayer as DomainClass);
                    }
                }
            }
        }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ElementLink == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
                return;

            DomainClassReferencesBaseClass inhRelationship = e.ElementLink as DomainClassReferencesBaseClass;
            if (inhRelationship != null)
            {
                SerializationHelper.UpdateDerivedElementsSerializationProperties(inhRelationship.DerivedClass);
                SerializationHelper.UpdateDerivedElementsSerializationDomainRoles(inhRelationship.DerivedClass);
            }

            DomainRelationshipReferencesBaseRelationship inhRelationshipRel = e.ElementLink as DomainRelationshipReferencesBaseRelationship;
            if (inhRelationshipRel != null)
            {
                SerializationHelper.UpdateDerivedElementsSerializationProperties(inhRelationshipRel.DerivedRelationship);
            }
        }
Esempio n. 4
0
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
            {
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                {
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                    {
                        return;
                    }
                }
            }

            if (e.ElementLink == null)
            {
                return;
            }

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
            {
                return;
            }

            DomainRoleReferencesCustomPropertyGridEditor con = e.ElementLink as DomainRoleReferencesCustomPropertyGridEditor;

            if (con != null)
            {
                if (con.DomainRole.Relationship is EmbeddingRelationship)
                {
                    (con.DomainRole.Relationship as EmbeddingRelationship).SerializedEmbeddingRelationship.IsTargetIncludedSubmodel = true;
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// RolePlayerChangeRule: typeof(Microsoft.VisualStudio.Modeling.Diagrams.LinkConnectsToNode)
        /// External constraint shapes can only be drawn if they show all of their
        /// links, so automatically remove them if a link is moved off the constraint
        /// shape.
        /// </summary>
        private static void VerifyConnectedShapeShapeRolePlayerChangedRule(RolePlayerChangedEventArgs e)
        {
            ShapeElement shape;

            if (e.DomainRole.Id == LinkConnectsToNode.NodesDomainRoleId &&
                ((LinkConnectsToNode)e.ElementLink).Link is ExternalConstraintLink &&
                null != (shape = e.OldRolePlayer as ShapeElement))
            {
                ExternalConstraintShape constraintShape;
                FactTypeShape           factTypeShape;
                if (null != (constraintShape = shape as ExternalConstraintShape))
                {
                    FrameworkDomainModel.DelayValidateElement(constraintShape, DelayValidateExternalConstraintShapeFullyConnected);
                }
                else if (null != (factTypeShape = MultiShapeUtility.ResolvePrimaryShape(shape) as FactTypeShape))
                {
                    FrameworkDomainModel.DelayValidateElement(factTypeShape, DelayValidateFactTypeShapeSize);
                    if (null != (shape = e.NewRolePlayer as ShapeElement) &&
                        null != (factTypeShape = MultiShapeUtility.ResolvePrimaryShape(shape) as FactTypeShape))
                    {
                        FrameworkDomainModel.DelayValidateElement(factTypeShape, DelayValidateFactTypeShapeSize);
                    }
                }
            }
        }
 /// <summary>
 /// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ValueTypeHasDataType)
 /// Update table size when a column datatype is changed.
 /// </summary>
 private static void DataTypeChangedRule(RolePlayerChangedEventArgs e)
 {
     if (e.DomainRole.Id == ValueTypeHasDataType.DataTypeDomainRoleId)
     {
         UpdateTablesOnDataTypeChange((ValueTypeHasDataType)e.ElementLink);
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args">Arguments.</param>
        protected virtual void OnModelContextChanged(RolePlayerChangedEventArgs args)
        {
            ExternModelContextReferencesModelContext con = args.ElementLink as ExternModelContextReferencesModelContext;

            if (con != null)
            {
                if (args.DomainRole.Id == ExternModelContextReferencesModelContext.ExternModelContextDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.ModelContext.Id)
                    {
                        DeleteModelContext(con.ModelContext);
                    }

                    if (args.NewRolePlayerId == this.ModelContext.Id)
                    {
                        AddModelContext(con.ModelContext);
                    }
                }
                else if (args.DomainRole.Id == ExternModelContextReferencesModelContext.ModelContextDomainRoleId)
                {
                    if (args.OldRolePlayer != null)
                    {
                        DeleteModelContext(args.OldRolePlayer as LibraryModelContext);
                    }

                    if (args.NewRolePlayer != null)
                    {
                        AddModelContext(args.NewRolePlayer as LibraryModelContext);
                    }
                }
            }
        }
Esempio n. 8
0
 private static void PreferredIdentifierRolePlayerChangedEvent(object sender, RolePlayerChangedEventArgs e)
 {
     if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierDomainRoleId)
     {
         InvalidateForPreferredIdentifier((UniquenessConstraint)e.OldRolePlayer);
         InvalidateForPreferredIdentifier((UniquenessConstraint)e.NewRolePlayer);
     }
 }
 /// <summary>
 /// Called whenever a role player changed ever has occured.
 /// </summary>
 /// <param name="e"></param>
 public void OnRolePlayerChanged(RolePlayerChangedEventArgs e)
 {
     DomainModelLink con = e.ElementLink as DomainModelLink;
     if (con != null)
     {
         this.deletionHelper.DeleteShapesForElement(con);
         this.factoryHelper.AddRSShapesForElement(con);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Called whenever a model element's property value is changed.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notifications that the value of an attribute has changed</param>
        private void OnRolePlayerChanged(object sender, RolePlayerChangedEventArgs args)
        {
            if (!ModelData.DoSendModelEvents)
            {
                return;
            }

            EventManager.GetEvent <ModelRolePlayerChangedEvent>().Publish(args);
        }
Esempio n. 11
0
        private void OnElementLinkChanged(RolePlayerChangedEventArgs args)
        {
            if (this.Store.InSerializationTransaction)
            {
                return;
            }

            Set(modelElements);
        }
 /// <summary>
 /// Called whenever a role player changed ever has occured.
 /// </summary>
 /// <param name="e"></param>
 public void OnRolePlayerChanged(RolePlayerChangedEventArgs e)
 {
     DomainModelLink con = e.ElementLink as DomainModelLink;
     if (con != null)
         if (con.IsEmbedding)
         {
             this.factoryHelper.AddShapesForElement(con);
         }
 }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            ConfigurationElementCollectionHasItemType link = e.ElementLink as ConfigurationElementCollectionHasItemType;

            if (link != null && !link.Store.TransactionManager.CurrentTransaction.IsSerializing)
            {
                // When the item type changes, set the XML item name to the new item type's name but camelCased.
                link.ConfigurationElementCollection.XmlItemName = NamingHelper.ToCamelCase(link.ConfigurationElement.Name);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.EntityTypeHasPreferredIdentifier), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.AddShapeRulePriority;
        /// </summary>
        private static void PreferredIdentifierRolePlayerChangeRule(RolePlayerChangedEventArgs e)
        {
            UniquenessConstraint oldPreferredIdentifier = null;

            if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierDomainRoleId)
            {
                oldPreferredIdentifier = (UniquenessConstraint)e.OldRolePlayer;
            }
            ProcessPreferredIdentifier(e.ElementLink as EntityTypeHasPreferredIdentifier, oldPreferredIdentifier);
        }
            /// <summary>
            /// Called whenever a role player changed ever has occured.
            /// </summary>
            /// <param name="e"></param>
            public void OnRolePlayerChanged(RolePlayerChangedEventArgs e)
            {
                DomainModelLink con = e.ElementLink as DomainModelLink;

                if (con != null)
                {
                    this.deletionHelper.DeleteShapesForElement(con);
                    this.factoryHelper.AddRSShapesForElement(con);
                }
            }
Esempio n. 16
0
            /// <summary>
            /// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.EntityTypeHasPreferredIdentifier)
            /// Changing the preferred identifier for an <see cref="ObjectType"/> is considered to
            /// be a significant change until we support full incremental tracking.
            /// </summary>
            private static void PreferredIdentifierRolePlayerChangedRule(RolePlayerChangedEventArgs e)
            {
                // UNDONE: Incremental changes, propagate changes to Uniqueness.IsPreferred property
                EntityTypeHasPreferredIdentifier link = (EntityTypeHasPreferredIdentifier)e.ElementLink;

                if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierForDomainRoleId)
                {
                    SignificantObjectTypeChange((ObjectType)e.OldRolePlayer);
                }
                SignificantObjectTypeChange(link.PreferredIdentifierFor);
            }
Esempio n. 17
0
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnTypeChanged(RolePlayerChangedEventArgs args)
        {
            DomainPropertyReferencesType con = args.ElementLink as DomainPropertyReferencesType;

            if (con != null)
            {
                if (con.DomainProperty.Id == this.DomainProperty.Id)
                {
                    OnPropertyChanged("PropertyType");
                }
            }
        }
        /// <summary>
        /// Called on role player changes.
        /// </summary>
        /// <param name="e"></param>
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            base.RolePlayerChanged(e);

            if (e.ElementLink == null)
                return;

            if (e.ElementLink.Store.InSerializationTransaction)
                return;

            this.rpHelper.OnRolePlayerChanged(e);
        }
            /// <summary>
            /// Called whenever a role player changed ever has occured.
            /// </summary>
            /// <param name="e"></param>
            public void OnRolePlayerChanged(RolePlayerChangedEventArgs e)
            {
                DomainModelLink con = e.ElementLink as DomainModelLink;

                if (con != null)
                {
                    if (con.IsEmbedding)
                    {
                        this.factoryHelper.AddShapesForElement(con);
                    }
                }
            }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ElementLink == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
                return;

            ShapeClassReferencesDomainClass shapeCon = e.ElementLink as ShapeClassReferencesDomainClass;
            if (shapeCon != null)
            {
                PresentationDomainClassElement shapeClass = shapeCon.ShapeClass;
                ShapeClassNode node = shapeClass.ShapeClassNode;

                // delete old                
                DomainClass domainClass = e.OldRolePlayer as DomainClass;
                if (node != null)
                {
                    foreach (TreeNode n in domainClass.DomainModelTreeNodes)
                    {
                        if (n.IsElementHolder)
                        {
                            if (n.ShapeClassNodes.Contains(node))
                                n.ShapeClassNodes.Remove(node);
                            break;
                        }
                    }
                }

                // add new
                domainClass = e.NewRolePlayer as DomainClass;
                foreach (TreeNode n in domainClass.DomainModelTreeNodes)
                {
                    if (n.IsElementHolder)
                    {
                        ShapeClassNode shapeNode = new ShapeClassNode(shapeCon.Store);
                        shapeClass.ShapeClassNode = shapeNode;

                        n.ShapeClassNodes.Add(shapeNode);
                        domainClass.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(shapeNode);
                        break;
                    }
                }
                if( node != null )
                    node.Delete();
            }
        }
Esempio n. 21
0
 /// <summary>
 /// </summary>
 /// <param name="e">Provides data for the RolePlayerChanged event.</param>
 public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
 {
     // Modification de la superClass
     if (e.DomainRole.Id == Generalization.SuperClassDomainRoleId)
     {
         Generalization link = e.ElementLink as Generalization;
         if (link.SuperClass.SubClasses.Count > 0)
         {
             link.SuperClass.SubClasses.RemoveAt(0);
         }
         link.SuperClass.SubClasses.Add(link.SubClass);
     }
 }
Esempio n. 22
0
        /// <summary>
        /// RolePlayerChangeRule: typeof(ReadingOrderHasReading), FireTime=LocalCommit, Priority=ORMCoreDomainModel.BeforeDelayValidateRulePriority;
        /// </summary>
        private static void EnforceNoEmptyReadingOrderRolePlayerChangeRule(RolePlayerChangedEventArgs e)
        {
            ReadingOrderHasReading link = e.ElementLink as ReadingOrderHasReading;

            if (e.DomainRole.Id == ReadingOrderHasReading.ReadingOrderDomainRoleId)
            {
                ReadingOrder order = (ReadingOrder)e.OldRolePlayer;
                if (!order.IsDeleted && order.ReadingCollection.Count == 0)
                {
                    order.Delete();
                }
            }
        }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnRSShapeElementChanged(RolePlayerChangedEventArgs args)
        {
            RelationshipShapeClassReferencesReferenceRelationship con = args.ElementLink as RelationshipShapeClassReferencesReferenceRelationship;

            if (con != null)
            {
                if (con.RelationshipShapeClass == this.DiagramTreeNode.PresentationElementClass)
                {
                    DeleteElement();

                    AddRSShapeElement(con.DomainRelationship);
                }
            }
        }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnShapeElementChanged(RolePlayerChangedEventArgs args)
        {
            ShapeClassReferencesDomainClass con = args.ElementLink as ShapeClassReferencesDomainClass;

            if (con != null)
            {
                if (con.ShapeClass == this.DiagramTreeNode.PresentationElementClass)
                {
                    DeleteElement();

                    AddShapeElement(con.DomainClass);
                }
            }
        }
Esempio n. 25
0
        private void OnRolePlayerChanged(RolePlayerChangedEventArgs args)
        {
            ElementLink relationship = args.ElementLink as ElementLink;

            if (args.OldRolePlayer == Element)
            {
                // remove VModellvariante from children collection
                RemoveChildElement(DomainRoleInfo.GetTargetRolePlayer(relationship));
            }
            if (args.NewRolePlayer == Element)
            {
                AddChildElement(relationship, DomainRoleInfo.GetTargetRolePlayer(relationship), false);
            }
        }
Esempio n. 26
0
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            ShapeElementContainsChildShapes con = e.ElementLink as ShapeElementContainsChildShapes;

            if (con == null)
            {
                return;
            }

            if (e.DomainRole.Id == ShapeElementContainsChildShapes.DomainClassId)
            {
                NodeShape childShape = con.ChildShape;

                NodeShape parentShapeOld = e.OldRolePlayer as NodeShape;
                NodeShape parentShapeNew = e.NewRolePlayer as NodeShape;

                // delete from old parent shape
                if (childShape != null && parentShapeOld != null)
                {
                    if (childShape.IsDeleted)
                    {
                        return;
                    }

                    parentShapeOld.RemoveFromShapeMapping(childShape);
                }

                // add to new parent shape
                if (childShape != null && parentShapeNew != null)
                {
                    if (childShape.IsDeleted)
                    {
                        return;
                    }

                    parentShapeNew.AddToShapeMapping(childShape);

                    if (childShape.IsRelativeChildShape && childShape.MovementBehaviour == ShapeMovementBehaviour.PositionOnEdgeOfParent)
                    {
                        childShape.CorrectLocation();
                    }

                    if (!childShape.IsRelativeChildShape)
                    {
                        childShape.ResizeParentIfRequired();
                    }
                }
            }
        }
Esempio n. 27
0
 /// <summary>
 /// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ValueTypeHasDataType)
 /// </summary>
 private static void DataTypeChangedRule(RolePlayerChangedEventArgs e)
 {
     if (e.DomainRole.Id == ValueTypeHasDataType.DataTypeDomainRoleId)
     {
         if (e.OldRolePlayer is AutoCounterNumericDataType || e.NewRolePlayer is AutoCounterNumericDataType)
         {
             SignificantObjectTypeChange(((ValueTypeHasDataType)e.ElementLink).ValueType);
         }
     }
     else if (((ValueTypeHasDataType)e.ElementLink).DataType is AutoCounterNumericDataType)
     {
         SignificantObjectTypeChange((ObjectType)e.OldRolePlayer);
         SignificantObjectTypeChange((ObjectType)e.NewRolePlayer);
     }
 }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            // we only need to update is the role player changed in the "parent" in the
            // embedding relationship.
            ViewPoint oldValue = e.OldRolePlayer as ViewPoint;
            ViewPoint newValue = e.NewRolePlayer as ViewPoint;

            CompartmentRuleHelper.HandleRolePlayerChangedRule(e.ElementLink,
                                                              oldValue, newValue);
        }
        /// <summary>
        /// Called on role player changes.
        /// </summary>
        /// <param name="e"></param>
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            base.RolePlayerChanged(e);

            if (e.ElementLink == null)
            {
                return;
            }

            if (e.ElementLink.Store.InSerializationTransaction)
            {
                return;
            }

            this.rpHelper.OnRolePlayerChanged(e);
        }
Esempio n. 30
0
            /// <summary>
            /// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ObjectTypePlaysRole)
            /// Revalidate the model when the <see cref="ObjectType">role player</see> of a <see cref="Role"/>
            /// is changed.
            /// </summary>
            private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e)
            {
                // UNDONE: Incremental changes will not be as severe here. Note that adding
                // and deleting role players already triggers the correct actions in the
                // gateway rules. However, a change where none of the parties are excluded
                // simply needs to regenerate for now.
                ObjectTypePlaysRole link = (ObjectTypePlaysRole)e.ElementLink;

                if (e.DomainRole.Id == ObjectTypePlaysRole.PlayedRoleDomainRoleId)
                {
                    SignificantFactTypeChange(((Role)e.OldRolePlayer).BinarizedFactType);
                }
                else
                {
                    SignificantObjectTypeChange((ObjectType)e.OldRolePlayer);
                }
                SignificantObjectTypeChange(link.RolePlayer);
                SignificantFactTypeChange(link.PlayedRole.BinarizedFactType);
            }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnRootDiagramNodeChanged(RolePlayerChangedEventArgs args)
        {
            DiagramClassViewHasRootDiagramNodes con = args.ElementLink as DiagramClassViewHasRootDiagramNodes;

            if (con != null)
            {
                if (args.DomainRole.Id == DiagramClassViewHasRootDiagramNodes.DiagramClassViewDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.DiagramClassView.Id)
                    {
                        DeleteRootDiagramNode(con.RootDiagramNode);
                    }

                    if (args.NewRolePlayerId == this.DiagramClassView.Id)
                    {
                        AddRootDiagramNode(con.RootDiagramNode);
                    }
                }
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnEmbeddingDiagramNodeChanged(RolePlayerChangedEventArgs args)
        {
            EmbeddingDiagramNodeHasEmbeddingDiagramNodes con = args.ElementLink as EmbeddingDiagramNodeHasEmbeddingDiagramNodes;

            if (con != null)
            {
                if (args.DomainRole.Id == EmbeddingDiagramNodeHasEmbeddingDiagramNodes.SourceEmbeddingDiagramNodeDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.EmbeddingDiagramNode.Id)
                    {
                        DeleteEmbeddingDiagramNode(con.TargetEmbeddingDiagramNode);
                    }

                    if (args.NewRolePlayerId == this.EmbeddingDiagramNode.Id)
                    {
                        AddEmbeddingDiagramNode(con.TargetEmbeddingDiagramNode);
                    }
                }
            }
        }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ElementLink == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
                return;

            DomainRoleReferencesCustomPropertyGridEditor con = e.ElementLink as DomainRoleReferencesCustomPropertyGridEditor;
            if (con != null)
            {
                if (con.DomainRole.Relationship is EmbeddingRelationship)
                    (con.DomainRole.Relationship as EmbeddingRelationship).SerializedEmbeddingRelationship.IsTargetIncludedSubmodel = true;
            }
        }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            ShapeElementContainsChildShapes con = e.ElementLink as ShapeElementContainsChildShapes;
            if (con == null)
                return;

            if (e.DomainRole.Id == ShapeElementContainsChildShapes.DomainClassId)
            {
                NodeShape childShape = con.ChildShape;

                NodeShape parentShapeOld = e.OldRolePlayer as NodeShape;
                NodeShape parentShapeNew = e.NewRolePlayer as NodeShape;

                // delete from old parent shape
                if (childShape != null && parentShapeOld != null)
                {
                    if (childShape.IsDeleted)
                        return;

                    parentShapeOld.RemoveFromShapeMapping(childShape);
                }

                // add to new parent shape
                if (childShape != null && parentShapeNew != null)
                {
                    if (childShape.IsDeleted)
                        return;

                    parentShapeNew.AddToShapeMapping(childShape);

                    if (childShape.IsRelativeChildShape && childShape.MovementBehaviour == ShapeMovementBehaviour.PositionOnEdgeOfParent)
                        childShape.CorrectLocation();

                    if (!childShape.IsRelativeChildShape)
                        childShape.ResizeParentIfRequired();
                }
            }
        }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
            {
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                {
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                    {
                        return;
                    }
                }
            }

            if (e.ElementLink == null)
            {
                return;
            }

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
            {
                return;
            }

            DomainClassReferencesBaseClass inhRelationship = e.ElementLink as DomainClassReferencesBaseClass;

            if (inhRelationship != null)
            {
                SerializationHelper.UpdateDerivedElementsSerializationProperties(inhRelationship.DerivedClass);
                SerializationHelper.UpdateDerivedElementsSerializationDomainRoles(inhRelationship.DerivedClass);
            }

            DomainRelationshipReferencesBaseRelationship inhRelationshipRel = e.ElementLink as DomainRelationshipReferencesBaseRelationship;

            if (inhRelationshipRel != null)
            {
                SerializationHelper.UpdateDerivedElementsSerializationProperties(inhRelationshipRel.DerivedRelationship);
            }
        }
Esempio n. 36
0
 private void ReferenceModeHasKindChangeEvent(object sender, RolePlayerChangedEventArgs e)
 {
     if (myModify != null)
     {
         ReferenceModeHasReferenceModeKind link = e.ElementLink as ReferenceModeHasReferenceModeKind;
         if (link != null)
         {
             ReferenceModeKind referenceModeKind = link.Kind;
             if (referenceModeKind.Model == this.myModel && !link.IsDeleted)
             {
                 foreach (ReferenceMode refMode in referenceModeKind.ReferenceModeCollection)
                 {
                     CustomReferenceMode custRefMode = refMode as CustomReferenceMode;
                     if (custRefMode != null)
                     {
                         int row = this.FindReferenceMode(custRefMode);
                         myModify(this, BranchModificationEventArgs.DisplayDataChanged(new DisplayDataChangedData(VirtualTreeDisplayDataChanges.Text, this, row, -1, 1)));
                     }
                 }
             }
         }
     }
 }
            /// <summary>
            /// RolePlayerChangeRule: typeof(ObjectTypePlaysRole)
            /// </summary>
            private static void ObjectTypePlaysRoleRolePlayerChangedRule(RolePlayerChangedEventArgs e)
            {
                bool       rolePlayerRoleChanged = e.DomainRole.Id == ObjectTypePlaysRole.RolePlayerDomainRoleId;
                ObjectType rolePlayer            = rolePlayerRoleChanged ? (ObjectType)e.OldRolePlayer : ((ObjectTypePlaysRole)e.ElementLink).RolePlayer;

                if (rolePlayer.IsImplicitBooleanValue)
                {
                    throw new InvalidOperationException(ResourceStrings.ModelExceptionFactTypeEnforceNoImplicitBooleanValueTypeRolePlayerChange);
                }
                if (!rolePlayerRoleChanged)
                {
                    FactType factType = ((Role)e.OldRolePlayer).FactType;
                    if (factType != null)
                    {
                        FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
                    }
                    factType = ((Role)e.NewRolePlayer).FactType;
                    if (factType != null)
                    {
                        FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
                    }
                }
            }
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ElementLink == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
                return;

            DomainClassReferencesBaseClass con = e.ElementLink as DomainClassReferencesBaseClass;
            if (con != null)
                if (con.BaseClass != null)
                {
                    TreeNode elementHolderNode = null;
                    foreach (TreeNode node in con.BaseClass.DomainModelTreeNodes)
                        if (node.IsElementHolder)
                        {
                            elementHolderNode = node;
                            break;
                        }

                    if (elementHolderNode == null)
                        throw new ArgumentNullException("elementHolderNode");

                    // we need to delte the old inheritance node and add a new one for the changed inheritance relationship
                    InheritanceNode inhNodeOld = con.Store.ElementDirectory.FindElement(con.InhNodeId) as InheritanceNode;
                    if (inhNodeOld == null)
                        return;

                    // create new inheritance node
                    InheritanceNode inhNode = new InheritanceNode(con.Store);
                    inhNode.DomainElement = con.DerivedClass;
                    inhNode.IsElementHolder = inhNodeOld.IsElementHolder;
                    inhNode.IsExpanded = inhNodeOld.IsExpanded;
                    inhNode.InhRelationshipId = con.Id;
                    inhNode.IsEmbeddingTreeExpanded = inhNodeOld.IsEmbeddingTreeExpanded;
                    inhNode.IsInheritanceTreeExpanded = inhNodeOld.IsInheritanceTreeExpanded;
                    inhNode.IsReferenceTreeExpanded = inhNodeOld.IsReferenceTreeExpanded;
                    inhNode.IsShapeMappingTreeExpanded = inhNodeOld.IsShapeMappingTreeExpanded;
                    con.InhNodeId = inhNode.Id;

                    // copy sub tree
                    for (int i = inhNodeOld.EmbeddingRSNodes.Count - 1; i >= 0; i--)
                        inhNodeOld.EmbeddingRSNodes[i].TreeNode = inhNode;

                    for (int i = inhNodeOld.ReferenceRSNodes.Count - 1; i >= 0; i--)
                        inhNodeOld.ReferenceRSNodes[i].TreeNode = inhNode;

                    for (int i = inhNodeOld.InheritanceNodes.Count - 1; i >= 0; i--)
                        inhNodeOld.InheritanceNodes[i].TreeNode = inhNode;

                    for (int i = inhNodeOld.ShapeClassNodes.Count - 1; i >= 0; i--)
                        inhNodeOld.ShapeClassNodes[i].TreeNode = inhNode;

                    elementHolderNode.InheritanceNodes.Add(inhNode);
                    con.DerivedClass.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(inhNode);

                    inhNodeOld.Delete();
                }
        }
Esempio n. 39
0
		/// <summary>
		/// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ValueTypeHasDataType)
		/// Update table size when a column datatype is changed.
		/// </summary>
		private static void DataTypeChangedRule(RolePlayerChangedEventArgs e)
		{
			if (e.DomainRole.Id == ValueTypeHasDataType.DataTypeDomainRoleId)
			{
				UpdateTablesOnDataTypeChange((ValueTypeHasDataType)e.ElementLink);
			}
		}
        /// <summary>
        /// Called whenever a model element's property value is changed.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notifications that the value of an attribute has changed</param>
        private void OnRolePlayerChanged(object sender, RolePlayerChangedEventArgs args)
        {
            if (!ModelData.DoSendModelEvents)
                return;

            EventManager.GetEvent<ModelRolePlayerChangedEvent>().Publish(args);
        }
        private void OnElementLinkChanged(RolePlayerChangedEventArgs args)
        {
            if (this.Store.InSerializationTransaction)
                return;

            Set(modelElements);
        }
 /// <summary>
 /// Called whenever a model element's property value is changed.
 /// </summary>
 /// <param name="sender">ViewModelStore</param>
 /// <param name="args">Event Arguments for notifications that the value of an attribute has changed</param>
 protected virtual void OnRolePlayerChanged(object sender, RolePlayerChangedEventArgs args)
 {
     EventManager.GetEvent<ModelRolePlayerChangedEvent>().Publish(args);
 }
Esempio n. 43
0
			/// <summary>
			/// RolePlayerChangeRule: typeof(ObjectTypePlaysRole)
			/// </summary>
			private static void ObjectTypePlaysRoleRolePlayerChangedRule(RolePlayerChangedEventArgs e)
			{
				bool rolePlayerRoleChanged = e.DomainRole.Id == ObjectTypePlaysRole.RolePlayerDomainRoleId;
				ObjectType rolePlayer = rolePlayerRoleChanged ? (ObjectType)e.OldRolePlayer : ((ObjectTypePlaysRole)e.ElementLink).RolePlayer;
				if (rolePlayer.IsImplicitBooleanValue)
				{
					throw new InvalidOperationException(ResourceStrings.ModelExceptionFactTypeEnforceNoImplicitBooleanValueTypeRolePlayerChange);
				}
				if (!rolePlayerRoleChanged)
				{
					FactType factType = ((Role)e.OldRolePlayer).FactType;
					if (factType != null)
					{
						FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
					}
					factType = ((Role)e.NewRolePlayer).FactType;
					if (factType != null)
					{
						FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
					}
				}
			}
Esempio n. 44
0
					private void ReferenceModeHasKindChangeEvent(object sender, RolePlayerChangedEventArgs e)
					{
						if (myModify != null)
						{
							ReferenceModeHasReferenceModeKind link = e.ElementLink as ReferenceModeHasReferenceModeKind;
							if (link != null)
							{
								ReferenceModeKind referenceModeKind = link.Kind;
								if (referenceModeKind.Model == this.myModel && !link.IsDeleted)
								{
									foreach (ReferenceMode refMode in referenceModeKind.ReferenceModeCollection)
									{
										CustomReferenceMode custRefMode = refMode as CustomReferenceMode;
										if (custRefMode != null)
										{
											int row = this.FindReferenceMode(custRefMode);
											myModify(this, BranchModificationEventArgs.DisplayDataChanged(new DisplayDataChangedData(VirtualTreeDisplayDataChanges.Text, this, row, -1, 1)));
										}
									}
								}
							}
						}
					}
Esempio n. 45
0
			/// <summary>
			/// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ObjectTypePlaysRole)
			/// </summary>
			private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e)
			{
				ObjectTypePlaysRole link = e.ElementLink as ObjectTypePlaysRole;
				Guid changedRoleGuid = e.DomainRole.Id;
				if (changedRoleGuid == ObjectTypePlaysRole.PlayedRoleDomainRoleId)
				{
					ProcessRolePlayerDeleted(link, null, (Role)e.OldRolePlayer);
					ProcessRolePlayerAdded(link);
				}
				else
				{
					ProcessRolePlayerDeleted(link, (ObjectType)e.OldRolePlayer, null);
					ProcessRolePlayerAdded(link);
				}
			}
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnShapeClassNodeChanged(RolePlayerChangedEventArgs args)
        {
            TreeNodeReferencesShapeClassNodes con = args.ElementLink as TreeNodeReferencesShapeClassNodes;
            if (con != null)
            {
                if (args.DomainRole.Id == TreeNodeReferencesShapeClassNodes.TreeNodeDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.TreeNode.Id)
                    {
                        DeleteShapeClassNode(con.ShapeClassNode);
                    }

                    if (args.NewRolePlayerId == this.TreeNode.Id)
                    {
                        AddShapeClassNode(con.ShapeClassNode);
                    }
                }
            }
        }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnRSShapeElementChanged(RolePlayerChangedEventArgs args)
        {
            RelationshipShapeClassReferencesReferenceRelationship con = args.ElementLink as RelationshipShapeClassReferencesReferenceRelationship;
            if (con != null)
            {
                if (con.RelationshipShapeClass == this.DiagramTreeNode.PresentationElementClass)
                {
                    DeleteElement();

                    AddRSShapeElement(con.DomainRelationship);
                }
            }

        }
Esempio n. 48
0
		private static void PreferredIdentifierRolePlayerChangedEvent(object sender, RolePlayerChangedEventArgs e)
		{
			if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierDomainRoleId)
			{
				InvalidateForPreferredIdentifier((UniquenessConstraint)e.OldRolePlayer);
				InvalidateForPreferredIdentifier((UniquenessConstraint)e.NewRolePlayer);
			}
		}
        public override void RolePlayerChanged(RolePlayerChangedEventArgs e)
        {
            if (e.ElementLink != null)
                if (e.ElementLink.Store.TransactionManager.CurrentTransaction != null)
                    if (e.ElementLink.Store.TransactionManager.CurrentTransaction.IsSerializing)
                        return;

            if (e.ElementLink == null)
                return;

            if (ImmutabilityExtensionMethods.GetLocks(e.ElementLink) != Locks.None)
                return;

            RelationshipShapeClassReferencesReferenceRelationship con = e.ElementLink as RelationshipShapeClassReferencesReferenceRelationship;
            if (con != null)
            {
                RelationshipShapeClass shape = con.RelationshipShapeClass;
                ShapeRelationshipNode node = shape.ShapeRelationshipNode;

                // delete old
                ReferenceRelationship relOld = e.OldRolePlayer as ReferenceRelationship;
                if (relOld != null)
                {
                    ReferenceRSNode nodeOld = relOld.ReferenceRSNode;
                    if (nodeOld != null)
                    {
                        node.RelationshipShapeClass = null;

                        if (nodeOld.ShapeRelationshipNodes.Contains(node))
                            nodeOld.ShapeRelationshipNodes.Remove(node);
                    }
                    node.Delete();
                }

                // create new
                ReferenceRelationship rel = e.NewRolePlayer as ReferenceRelationship;
                if (rel != null)
                {
                    ReferenceRSNode n = rel.ReferenceRSNode;

                    // create new shape relationship node
                    ShapeRelationshipNode shapeNode = new ShapeRelationshipNode(con.Store);
                    shape.ShapeRelationshipNode = shapeNode;

                    n.ShapeRelationshipNodes.Add(shapeNode);
                    rel.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(shapeNode);

                    if (rel.SerializedReferenceRelationship != null)
                        if (!rel.SerializedReferenceRelationship.IsInFullSerialization)
                        {
                            if (System.Windows.MessageBox.Show("Shape mapping has been defined for the ReferenceRelationship '" +
                                rel.Name + "'. The Relationship is not serialized in full form. Would you like to change the serialization of this relationship to full form (strongly adviced)?",
                                "Serialization",
                                System.Windows.MessageBoxButton.YesNo,
                                System.Windows.MessageBoxImage.Question) == System.Windows.MessageBoxResult.Yes)
                            {
                                rel.SerializedReferenceRelationship.IsInFullSerialization = true;
                            }
                        }
                }
            }
        }
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnShapeElementChanged(RolePlayerChangedEventArgs args)
        {
            ShapeClassReferencesDomainClass con = args.ElementLink as ShapeClassReferencesDomainClass;
            if (con != null)
            {
                if (con.ShapeClass == this.DiagramTreeNode.PresentationElementClass)
                {
                    DeleteElement();

                    AddShapeElement(con.DomainClass);
                }
            }
            
        }
 private void OnRolePlayerChanged(RolePlayerChangedEventArgs args)
 {
     OnPropertyChanged("PropertyValue");
 }
Esempio n. 52
0
			/// <summary>
			/// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification)
			/// </summary>
			private static void ObjectificationRolePlayerChangedRule(RolePlayerChangedEventArgs e)
			{
				Objectification link = (Objectification)e.ElementLink;
				if (e.DomainRole.Id == Objectification.NestedFactTypeDomainRoleId)
				{
					ProcessFactTypeForObjectificationDeleted((FactType)e.OldRolePlayer);
					ProcessFactTypeForObjectificationAdded(link.NestedFactType);
				}
			}
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnReferenceChanged(RolePlayerChangedEventArgs args)
        {
            SpecificElementsDiagramReferencesDomainClasses con = args.ElementLink as SpecificElementsDiagramReferencesDomainClasses;
            if (con != null)
            {
                if (args.DomainRole.Id == SpecificElementsDiagramReferencesDomainClasses.SpecificElementsDiagramDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.DiagramClassView.DiagramClass.Id)
                        RemoveReference(con.DomainClass);

                    if (args.NewRolePlayerId == this.DiagramClassView.DiagramClass.Id)
                        AddReference(con.DomainClass);
                }
                else if (args.DomainRole.Id == SpecificElementsDiagramReferencesDomainClasses.DomainClassId)
                {
                    if (args.OldRolePlayer != null)
                        RemoveReference(args.OldRolePlayer as DomainClass);

                    if (args.NewRolePlayer != null)
                        AddReference(args.NewRolePlayer as DomainClass);
                }
            }
        }
Esempio n. 54
0
		/// <summary>
		/// RolePlayerChangeRule: typeof(ReadingOrderHasReading), FireTime=LocalCommit, Priority=ORMCoreDomainModel.BeforeDelayValidateRulePriority;
		/// </summary>
		private static void EnforceNoEmptyReadingOrderRolePlayerChangeRule(RolePlayerChangedEventArgs e)
		{
			ReadingOrderHasReading link = e.ElementLink as ReadingOrderHasReading;
			if (e.DomainRole.Id == ReadingOrderHasReading.ReadingOrderDomainRoleId)
			{
				ReadingOrder order = (ReadingOrder)e.OldRolePlayer;
				if (!order.IsDeleted && order.ReadingCollection.Count == 0)
				{
					order.Delete();
				}
			}
		}
Esempio n. 55
0
		/// <summary>
		/// Survey event handler for a change in the <see cref="Objectification"/> <see cref="ObjectType"/>
		/// </summary>
		private static void ObjectificationRolePlayerChangedEvent(object sender, RolePlayerChangedEventArgs e)
		{
			ModelElement rolePlayer = e.NewRolePlayer;
			INotifySurveyElementChanged eventNotify;
			if (null != (eventNotify = (rolePlayer.Store as IORMToolServices).NotifySurveyElementChanged))
			{
				bool nestingTypeChanged = e.DomainRole.Id == Objectification.NestingTypeDomainRoleId;
				// We notify the same for both the NestedFactType and NestingType roles
				if (!rolePlayer.IsDeleted)
				{
					eventNotify.ElementChanged(rolePlayer, SurveyGlyphQuestionTypes);
					if (nestingTypeChanged)
					{
						foreach (Role role in ((ObjectType)rolePlayer).PlayedRoleCollection)
						{
							eventNotify.ElementChanged(role, SurveyGlyphQuestionTypes);
						}
					}
				}
				if (!(rolePlayer = e.OldRolePlayer).IsDeleted)
				{
					eventNotify.ElementChanged(rolePlayer, SurveyGlyphQuestionTypes);
					if (nestingTypeChanged)
					{
						foreach (Role role in ((ObjectType)rolePlayer).PlayedRoleCollection)
						{
							eventNotify.ElementChanged(role, SurveyGlyphQuestionTypes);
						}
					}
				}
			}
		}
Esempio n. 56
0
		/// <summary>
		/// Survey event handler for changes to a <see cref="ModelElement">ModelElement</see>'s error state
		/// that occurs due to a role player change.
		/// </summary>
		private static void ModelElementErrorStateOwnerPathChangedEvent(object sender, RolePlayerChangedEventArgs e)
		{
			INotifySurveyElementChanged eventNotify;
			ModelElement element;
			if (null != (eventNotify = ((element = e.ElementLink).Store as IORMToolServices).NotifySurveyElementChanged))
			{
				NotifyErrorStateChanged(eventNotify, element as IModelErrorOwnerPath);
			}
		}
Esempio n. 57
0
		/// <summary>
		/// Survey event handler for a role player change
		/// </summary>
		private static void RolePlayerRolePlayerChangedEvent(object sender, RolePlayerChangedEventArgs e)
		{
			ModelElement element = e.ElementLink;
			INotifySurveyElementChanged eventNotify;
			if (null != (eventNotify = (element.Store as IORMToolServices).NotifySurveyElementChanged))
			{
				ObjectTypePlaysRole link = (ObjectTypePlaysRole)element;
				Role role = link.PlayedRole;
				if (!role.IsDeleted)
				{
					NotifyRoleChanged(eventNotify, role);
				}
				if (e.DomainRole.Id == ObjectTypePlaysRole.PlayedRoleDomainRoleId &&
					!(role = (Role)e.OldRolePlayer).IsDeleted)
				{
					NotifyRoleChanged(eventNotify, role);
				}
			}
		}
Esempio n. 58
0
		/// <summary>
		/// RolePlayerChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.EntityTypeHasPreferredIdentifier), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.AddShapeRulePriority;
		/// </summary>
		private static void PreferredIdentifierRolePlayerChangeRule(RolePlayerChangedEventArgs e)
		{
			UniquenessConstraint oldPreferredIdentifier = null;
			if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierDomainRoleId)
			{
				oldPreferredIdentifier = (UniquenessConstraint)e.OldRolePlayer;
			}
			ProcessPreferredIdentifier(e.ElementLink as EntityTypeHasPreferredIdentifier, oldPreferredIdentifier);
		}
Esempio n. 59
0
		/// <summary>
		/// Verify that error glyphs for the remote entity type update on role player changes
		/// </summary>
		private static void PreferredIdentifierRolePlayerChangedEvent(object sender, RolePlayerChangedEventArgs e)
		{
			INotifySurveyElementChanged eventNotify;
			ModelElement element;
			if (null != (eventNotify = ((element = e.ElementLink).Store as IORMToolServices).NotifySurveyElementChanged))
			{
				NotifyErrorStateChanged(eventNotify, element as IModelErrorOwnerPath);
				ObjectType objectType;
				if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierForDomainRoleId &&
					!(objectType = (ObjectType)e.OldRolePlayer).IsDeleted)
				{
					eventNotify.ElementChanged(objectType, SurveyErrorQuestionTypes);
				}
			}
		}
        /// <summary>
        /// Called on a role player changing.
        /// </summary>
        /// <param name="args"></param>
        private void OnEmbeddingDiagramNodeChanged(RolePlayerChangedEventArgs args)
        {
            EmbeddingDiagramNodeHasEmbeddingDiagramNodes con = args.ElementLink as EmbeddingDiagramNodeHasEmbeddingDiagramNodes;
            if (con != null)
            {
                if (args.DomainRole.Id == EmbeddingDiagramNodeHasEmbeddingDiagramNodes.SourceEmbeddingDiagramNodeDomainRoleId)
                {
                    if (args.OldRolePlayerId == this.EmbeddingDiagramNode.Id)
                    {
                        DeleteEmbeddingDiagramNode(con.TargetEmbeddingDiagramNode);
                    }

                    if (args.NewRolePlayerId == this.EmbeddingDiagramNode.Id)
                    {
                        AddEmbeddingDiagramNode(con.TargetEmbeddingDiagramNode);
                    }
                }
            }
        }