public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            DataContractBaseCanBeContainedOnContracts link = e.ModelElement as DataContractBaseCanBeContainedOnContracts;

            Debug.Assert(link != null, "link != null");

            DataContractBase sourceDataContractBase = link.DataContractBase;
            Contract         targetContractElement  = link.Contract;

            if (targetContractElement is DataContract)
            {
                DataContract dataContractElement = targetContractElement as DataContract;

                RemoveDataElement(
                    dataContractElement.Store,
                    dataContractElement.DataMembers,
                    GetDataElement(dataContractElement.DataMembers, link.Id));
            }
            else if (targetContractElement is FaultContract)
            {
                FaultContract faultContractElement = targetContractElement as FaultContract;

                RemoveDataElement(
                    faultContractElement.Store,
                    faultContractElement.DataMembers,
                    GetDataElement(faultContractElement.DataMembers, link.Id));
            }

            base.ElementDeleted(e);
        }
        /// <summary>
        /// </summary>
        /// <param name="e">Provides data for the ElementDeleted event.</param>
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            // Test the element
            ParentShapeContainsNestedChildShapes link = e.ModelElement as ParentShapeContainsNestedChildShapes;

            if (link == null)
            {
                return;
            }

            SoftwareComponentShape shape = link.ParentShape as SoftwareComponentShape;

            if (shape != null)
            {
                shape.ArrangeShapes();
            }
            else if (link.NestedChildShapes.ModelElement is Layer)
            {
                LayerPackageShape shape2 = link.ParentShape as LayerPackageShape;
                if (shape2 != null)
                {
                    shape2.ArrangeShapes();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DeleteRule: typeof(DiagramDisplayHasDiagramOrder), FireTime=LocalCommit, Priority=FrameworkDomainModel.BeforeDelayValidateRulePriority;
        /// Make sure that deletion of a diagram order results in a reorder
        /// </summary>
        private static void DiagramOrderDeletedRule(ElementDeletedEventArgs e)
        {
            DiagramDisplayHasDiagramOrder link = (DiagramDisplayHasDiagramOrder)e.ModelElement;
            Diagram diagram = link.Diagram;

            if (!diagram.IsDeleted)
            {
                Store store = diagram.Store;
                if (diagram.Partition == store.DefaultPartition)                 // This should never happen, but it is easy to check
                {
                    if (null == DiagramDisplayHasDiagramOrder.GetDiagramDisplay(diagram))
                    {
                        DiagramDisplay displayContainer = link.DiagramDisplay;
                        if (displayContainer.IsDeleted)
                        {
                            ReadOnlyCollection <DiagramDisplay> displays = store.ElementDirectory.FindElements <DiagramDisplay>(false);
                            displayContainer = (displays.Count != 0) ? displays[0] : new DiagramDisplay(store);
                        }
                        new DiagramDisplayHasDiagramOrder(displayContainer, diagram);
                    }
                }
            }
            else
            {
                DiagramDisplay displayContainer = link.DiagramDisplay;
                if (!displayContainer.IsDeleted && displayContainer.OrderedDiagramCollection.Count == 0)
                {
                    // No more diagrams, don't need the container
                    displayContainer.Delete();
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Called whenever a model element is deleted from the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the removal of an ModelElement.</param>
        private void OnElementDeleted(object sender, ElementDeletedEventArgs args)
        {
            if (args.ModelElement is DomainModelElement)
            {
                DomainModelElement modelElement = args.ModelElement as DomainModelElement;

                List <Guid> shapes = GraphicalDependencyShapeStore.GetFromStore(modelElement.Id);
                if (shapes != null)
                {
                    if (shapes.Count > 0)
                    {
                        modelElement.Store.UndoManager.UndoState = UndoState.DisabledNoFlush;
                        using (Transaction t = modelElement.Store.TransactionManager.BeginTransaction("", true))
                        {
                            for (int i = shapes.Count - 1; i >= 0; i--)
                            {
                                ShapeElement shape = modelElement.Store.ElementDirectory.FindElement(shapes[i]) as ShapeElement;
                                if (shape != null)
                                {
                                    shape.Delete();
                                }
                            }
                            t.Commit();
                        }
                        modelElement.Store.UndoManager.UndoState = UndoState.Enabled;
                        GraphicalDependencyShapeStore.RemoveFromStore(modelElement.Id);
                    }
                }
            }
        }
Ejemplo n.º 5
0
		public override void ElementDeleted(ElementDeletedEventArgs e)
		{
			Transition transition = (Transition)e.ModelElement;
			if (!transition.Successor.IsDeleted && transition.Successor.Predecessors.Count == 0
				&& !transition.Store.TransactionManager.CurrentTransaction.IsSerializing)
				transition.Successor.Initial = true;
		}
        /// <summary>
        /// Called whenever a model element is deleted from the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the removal of an ModelElement.</param>
        protected virtual void OnElementDeleted(object sender, ElementDeletedEventArgs args)
        {
            EventManager.GetEvent<ModelElementDeletedEvent>().Publish(args);

            if( args.ModelElement is ElementLink )
                EventManager.GetEvent<ModelElementLinkDeletedEvent>().Publish(args);
        }
        /// <summary>
        /// Called whenever a model element is deleted from the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the removal of an ModelElement.</param>
        private void OnElementDeleted(object sender, ElementDeletedEventArgs args)
        {
            if (args.ModelElement is DomainModelElement)
            {
                DomainModelElement modelElement = args.ModelElement as DomainModelElement;

                List<Guid> shapes = GraphicalDependencyShapeStore.GetFromStore(modelElement.Id);
                if (shapes != null)
                    if (shapes.Count > 0)
                    {
                        modelElement.Store.UndoManager.UndoState = UndoState.DisabledNoFlush;
                        using (Transaction t = modelElement.Store.TransactionManager.BeginTransaction("", true))
                        {

                            for (int i = shapes.Count - 1; i >= 0; i--)
                            {
                                ShapeElement shape = modelElement.Store.ElementDirectory.FindElement(shapes[i]) as ShapeElement;
                                if (shape != null)
                                    shape.Delete();
                            }
                            t.Commit();
                        }
                        modelElement.Store.UndoManager.UndoState = UndoState.Enabled;
                        GraphicalDependencyShapeStore.RemoveFromStore(modelElement.Id);
                    }
            }
        }
Ejemplo n.º 8
0
 public void OnModelPropertyDeleted(ElementDeletedEventArgs e)
 {
     if (ModelPropertyDeleted != null)
     {
         ModelPropertyDeleted(e);
     }
 }
Ejemplo n.º 9
0
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            var inheritance = e.ModelElement as Inheritance;

            if (inheritance != null)
            {
                if (inheritance.TargetEntityType != null)
                {
                    // We need to invalidate the target entitytypeshape element; so base type name will be updated correctly.
                    foreach (var pe in PresentationViewsSubject.GetPresentation(inheritance.TargetEntityType))
                    {
                        var entityShape = pe as EntityTypeShape;
                        if (entityShape != null)
                        {
                            entityShape.Invalidate();
                        }
                    }
                }

                var tx = ModelUtils.GetCurrentTx(inheritance.Store);
                Debug.Assert(tx != null);
                if (tx != null &&
                    !tx.IsSerializing)
                {
                    ViewModelChangeContext.GetNewOrExistingContext(tx).ViewModelChanges.Add(new InheritanceDelete(inheritance));
                }
            }
        }
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            var inheritance = e.ModelElement as Inheritance;
            if (inheritance != null)
            {
                if (inheritance.TargetEntityType != null)
                {
                    // We need to invalidate the target entitytypeshape element; so base type name will be updated correctly.
                    foreach (var pe in PresentationViewsSubject.GetPresentation(inheritance.TargetEntityType))
                    {
                        var entityShape = pe as EntityTypeShape;
                        if (entityShape != null)
                        {
                            entityShape.Invalidate();
                        }
                    }
                }

                var tx = ModelUtils.GetCurrentTx(inheritance.Store);
                Debug.Assert(tx != null);
                if (tx != null
                    && !tx.IsSerializing)
                {
                    ViewModelChangeContext.GetNewOrExistingContext(tx).ViewModelChanges.Add(new InheritanceDelete(inheritance));
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// DeleteRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ExclusiveOrConstraintCoupler), FireTime=TopLevelCommit, Priority=DiagramFixupConstants.AddShapeRulePriority;
        /// Split a single shape into two shapes when a exclusion constraint
        /// is decoupled from a mandatory constraint
        /// </summary>
        private static void ExclusiveOrCouplerDeletedRule(ElementDeletedEventArgs e)
        {
            ExclusiveOrConstraintCoupler link      = e.ModelElement as ExclusiveOrConstraintCoupler;
            MandatoryConstraint          mandatory = link.MandatoryConstraint;
            ExclusionConstraint          exclusion = link.ExclusionConstraint;

            if (!mandatory.IsDeleted && !exclusion.IsDeleted)
            {
                LinkedElementCollection <PresentationElement> pels = PresentationViewsSubject.GetPresentation(mandatory);
                int pelCount = pels.Count;
                for (int i = 0; i < pelCount; ++i)
                {
                    ExternalConstraintShape shape = pels[i] as ExternalConstraintShape;
                    if (shape != null)
                    {
                        ORMDiagram diagram = (ORMDiagram)shape.Diagram;
                        RectangleD bounds  = shape.AbsoluteBounds;
                        double     width   = bounds.Width;
                        bounds.Offset(-width / 2, 0);
                        bounds = diagram.BoundsRules.GetCompliantBounds(shape, bounds);
                        shape.AbsoluteBounds = bounds;
                        bounds.Offset(width, 0);
                        diagram.PlaceORMElementOnDiagram(null, exclusion, bounds.Location, ORMPlacementOption.None, null, null);
                    }
                }
            }
        }
		public override void ElementDeleted(ElementDeletedEventArgs e)
		{
			DataContractBaseCanBeContainedOnContracts link = e.ModelElement as DataContractBaseCanBeContainedOnContracts;
			Debug.Assert(link != null, "link != null");

			DataContractBase sourceDataContractBase = link.DataContractBase;
			Contract targetContractElement = link.Contract;

			if(targetContractElement is DataContract)
			{
				DataContract dataContractElement = targetContractElement as DataContract;

				RemoveDataElement(
					dataContractElement.Store,
					dataContractElement.DataMembers,
					GetDataElement(dataContractElement.DataMembers, link.Id));
			}
			else if(targetContractElement is FaultContract)
			{
				FaultContract faultContractElement = targetContractElement as FaultContract;

				RemoveDataElement(
					faultContractElement.Store,
					faultContractElement.DataMembers,
					GetDataElement(faultContractElement.DataMembers, link.Id));			
			}

			base.ElementDeleted(e);
		}
        /// <summary>
        /// Called whenever a relationship of type ReferenceRSNodeReferencesShapeRelationshipNodes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnShapeNodeRemoved(ElementDeletedEventArgs args)
        {
            ReferenceRSNodeReferencesShapeRelationshipNodes con = args.ModelElement as ReferenceRSNodeReferencesShapeRelationshipNodes;

            if (con != null)
            {
                DeleteShapeNode(con.ShapeRelationshipNode);
            }
        }
        /// <summary>
        /// Called whenever a relationship of type ReferenceRSNodeReferencesReferenceNode is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnReferenceNodeRemoved(ElementDeletedEventArgs args)
        {
            ReferenceRSNodeReferencesReferenceNode con = args.ModelElement as ReferenceRSNodeReferencesReferenceNode;

            if (con != null)
            {
                DeleteReferenceNode(con.ReferenceNode);
            }
        }
        /// <summary>
        /// Called whenever a relationship of type SpecificElementsDiagramReferencesDomainClasses is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnReferenceRemoved(ElementDeletedEventArgs args)
        {
            SpecificElementsDiagramReferencesDomainClasses con = args.ModelElement as SpecificElementsDiagramReferencesDomainClasses;

            if (con != null)
            {
                RemoveReference(con.DomainClass);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Called whenever a model element is deleted from the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the removal of an ModelElement.</param>
        protected virtual void OnElementDeleted(object sender, ElementDeletedEventArgs args)
        {
            EventManager.GetEvent <ModelElementDeletedEvent>().Publish(args);

            if (args.ModelElement is ElementLink)
            {
                EventManager.GetEvent <ModelElementLinkDeletedEvent>().Publish(args);
            }
        }
        /// <summary>
        /// Called whenever a relationship of type AttributedDomainElementHasProperties is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnDomainPropertyRemoved(ElementDeletedEventArgs args)
        {
            AttributedDomainElementHasProperties con = args.ModelElement as AttributedDomainElementHasProperties;

            if (con != null)
            {
                DeleteProperty(con.DomainProperty);
            }
        }
Ejemplo n.º 18
0
            /// <summary>
            /// DeleteRule: typeof(ConstraintRoleSequenceHasRole)
            /// </summary>
            private static void ConstraintRoleSequenceHasRoleDeletedRule(ElementDeletedEventArgs e)
            {
                FactType factType = (e.ModelElement as ConstraintRoleSequenceHasRole).Role.FactType;

                if (factType != null && !factType.IsDeleted)
                {
                    FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
                }
            }
Ejemplo n.º 19
0
            public override void ElementDeleted(ElementDeletedEventArgs e)
            {
                InterfaceInheritInterfaces link = e.ModelElement as InterfaceInheritInterfaces;

                if (link != null)
                {
                    RemoveTypedEntitySetConnectionFromNavigationProperties(link);
                }
            }
Ejemplo n.º 20
0
        /// <summary>
        /// Called whenever a relationship of type DesignerDiagramClassReferencesDiagramClasses is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnImportedDCRemoved(ElementDeletedEventArgs args)
        {
            DesignerDiagramClassReferencesImportedDiagramClasses con = args.ModelElement as DesignerDiagramClassReferencesImportedDiagramClasses;

            if (con != null)
            {
                DeleteImportedDC(con);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Called whenever a relationship of type DiagramClassViewHasRootDiagramNodes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnRootDiagramNodeRemoved(ElementDeletedEventArgs args)
        {
            DiagramClassViewHasRootDiagramNodes con = args.ModelElement as DiagramClassViewHasRootDiagramNodes;

            if (con != null)
            {
                DeleteRootDiagramNode(con.RootDiagramNode);
            }
        }
Ejemplo n.º 22
0
        private void OnChildElementDeleted(ElementDeletedEventArgs args)
        {
            ElementLink relationship = args.ModelElement as ElementLink;

            if (DomainRoleInfo.GetSourceRolePlayer(relationship) == Element)
            {
                RemoveChildElement(DomainRoleInfo.GetTargetRolePlayer(relationship));
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Called whenever a relationship of type SerializationClassReferencesChildren is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnChildRemoved(ElementDeletedEventArgs args)
        {
            SerializationClassReferencesChildren con = args.ModelElement as SerializationClassReferencesChildren;

            if (con != null)
            {
                DeleteChild(con.Child);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Called whenever a relationship of type MetaModelHasModelContexts is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnModelContextRemoved(ElementDeletedEventArgs args)
        {
            MetaModelHasModelContexts con = args.ModelElement as MetaModelHasModelContexts;

            if (con != null)
            {
                DeleteModelContext(con.BaseModelContext);
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Called whenever a relationship of type SerializationClassReferencesAttributes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnAttributeRemoved(ElementDeletedEventArgs args)
        {
            SerializationClassReferencesAttributes con = args.ModelElement as SerializationClassReferencesAttributes;

            if (con != null)
            {
                DeleteAttribute(con.Child);
            }
        }
        /// <summary>
        /// Called whenever a relationship of type RelationshipShapeClassReferencesReferenceRelationship is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnRSShapeElementRemoved(ElementDeletedEventArgs args)
        {
            RelationshipShapeClassReferencesReferenceRelationship con = args.ModelElement as RelationshipShapeClassReferencesReferenceRelationship;

            if (con != null)
            {
                DeleteElement();
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Called whenever a relationship of type DiagramClassViewHasRootDiagramNodes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnReferenceRemoved(ElementDeletedEventArgs args)
        {
            ModalDiagramReferencesDomainClass con = args.ModelElement as ModalDiagramReferencesDomainClass;

            if (con != null)
            {
                RemoveReference(con.DomainClass);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Called whenever a relationship of type EmbeddingDiagramNodeHasEmbeddingDiagramNodes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnEmbeddingDiagramNodeRemoved(ElementDeletedEventArgs args)
        {
            EmbeddingDiagramNodeHasEmbeddingDiagramNodes con = args.ModelElement as EmbeddingDiagramNodeHasEmbeddingDiagramNodes;

            if (con != null)
            {
                DeleteEmbeddingDiagramNode(con.TargetEmbeddingDiagramNode);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Called whenever a relationship of type SerializationModelHasChildren is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args">Arguments.</param>
        protected virtual void OnChildRemoved(ElementDeletedEventArgs args)
        {
            SerializationModelHasChildren con = args.ModelElement as SerializationModelHasChildren;

            if (con != null)
            {
                DeleteChild(con.SerializationClass);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Called whenever a relationship of type EmbeddingRSNodeReferencesEmbeddingNode is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnEmbeddingNodeRemoved(ElementDeletedEventArgs args)
        {
            EmbeddingRSNodeReferencesEmbeddingNode con = args.ModelElement as EmbeddingRSNodeReferencesEmbeddingNode;

            if (con != null)
            {
                DeleteEmbeddingNode(con.EmbeddingNode);
            }
        }
Ejemplo n.º 31
0
            /// <summary>
            /// DeleteRule: typeof(UniquenessConstraintIsForUniqueness)
            /// Propagate deletion of a Uniqueness
            /// </summary>
            private static void UniquenessDeletedRule(ElementDeletedEventArgs e)
            {
                UniquenessConstraint constraint = ((UniquenessConstraintIsForUniqueness)e.ModelElement).UniquenessConstraint;

                if (!constraint.IsDeleted)
                {
                    constraint.Delete();
                }
            }
Ejemplo n.º 32
0
            /// <summary>
            /// DeleteRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.FactTypeHasReadingOrder)
            /// </summary>
            private static void ReadingOrderDeletedRule(ElementDeletedEventArgs e)
            {
                FactType factType;

                if (!(factType = ((FactTypeHasReadingOrder)e.ModelElement).FactType).IsDeleted)
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
        /// <summary>
        /// Called whenever a relationship of type ShapeClassReferencesDomainClass is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnShapeElementRemoved(ElementDeletedEventArgs args)
        {
            ShapeClassReferencesDomainClass con = args.ModelElement as ShapeClassReferencesDomainClass;

            if (con != null)
            {
                DeleteElement();
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Called whenever a relationship of type ExternModelContextReferencesModelContext is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args">Arguments.</param>
        protected virtual void OnModelContextRemoved(ElementDeletedEventArgs args)
        {
            ExternModelContextReferencesModelContext con = args.ModelElement as ExternModelContextReferencesModelContext;

            if (con != null)
            {
                DeleteModelContext(con.ModelContext);
            }
        }
Ejemplo n.º 35
0
            /// <summary>
            /// DeleteRule: typeof(InformationTypeFormatIsForValueType)
            /// </summary>
            private static void InformationTypeFormatBridgeDetachedRule(ElementDeletedEventArgs e)
            {
                InformationTypeFormat format = ((InformationTypeFormatIsForValueType)e.ModelElement).InformationTypeFormat;

                if (!format.IsDeleted &&
                    TestRebuildAbstractionModel(format.Model))
                {
                    AddTransactedModelElement(format, ModelElementModification.AbstractionElementDetached);
                }
            }
        /// <summary>
        /// Called whenever a child element is deleted.
        /// </summary>
        /// <param name="e"></param>
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            DiagramHasChildren con = e.ModelElement as DiagramHasChildren;
            if (con != null)
            {
                NodeShape nodeShape = con.ChildShape;
                Diagram diagram = con.Diagram;

                if (nodeShape != null && diagram != null)
                {
                    diagram.RemoveFromShapeMapping(nodeShape);
                }
            }
        }
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            ShapeElementContainsChildShapes con = e.ModelElement as ShapeElementContainsChildShapes;
            if (con != null)
            {
                NodeShape childShape = con.ChildShape;
                NodeShape parentShape = con.ParentShape;

                if (childShape != null && parentShape != null)
                {
                    parentShape.RemoveFromShapeMapping(childShape);
                }
            }
        }
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            var associationConnector = e.ModelElement as AssociationConnector;
            if (associationConnector != null)
            {
                var tx = ModelUtils.GetCurrentTx(associationConnector.Store);
                Debug.Assert(tx != null);
                if (tx != null
                    && !tx.IsSerializing)
                {
                    ViewModelChangeContext.GetNewOrExistingContext(tx)
                        .ViewModelChanges.Add(new AssociationConnectorDelete(associationConnector));
                }
            }
        }
        private void OnElementDeleted(ElementDeletedEventArgs args)
        {
            if (this.SelectedSpecificItemVM != null)
                if (this.SelectedSpecificItemVM.Element.Id == args.ElementId)
                    this.SelectedSpecificItemVM = null;

            for (int i = SpecificItemVMs.Count - 1; i >= 0; i--)
            {
                if (SpecificItemVMs[i].Element.Id == args.ElementId)
                {
                    SpecificItemVMs[i].Dispose();
                    SpecificItemVMs.RemoveAt(i);
                }
            }

            UpdateIndices();
        }
Ejemplo n.º 40
0
			/// <summary>
			/// DeleteRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ConstraintRoleSequenceHasRole)
			/// </summary>
			private static void ConstraintRoleDeletedRule(ElementDeletedEventArgs e)
			{
				ConstraintRoleSequenceHasRole link = (ConstraintRoleSequenceHasRole)e.ModelElement;
				IConstraint constraint = link.ConstraintRoleSequence.Constraint;
				if (constraint != null)
				{
					if (IsRelevantConstraint(constraint))
					{
						FactTypeConstraintPatternChanged(link.Role.BinarizedFactType);
					}
					switch (constraint.ConstraintType)
					{
						// UNDONE: Incremental uniqueness changes
						case ConstraintType.InternalUniqueness:
						case ConstraintType.ExternalUniqueness:
							SignificantObjectTypeChange(constraint.PreferredIdentifierFor);
							break;
					}
				}
			}
        public override void ElementDeleted(ElementDeletedEventArgs e)
        {
            base.ElementDeleted(e);

            ModelProperty property = e.ModelElement as ModelProperty;

            // TODO: Add nested support
            if (property != null && property.ModelClass != null)
            {
                Transaction transaction = property.Store.TransactionManager.CurrentTransaction.TopLevelTransaction;
                if (transaction != null && !transaction.IsSerializing && transaction.Context.ContextInfo.ContainsKey(property.Name))
                {
                    Model model = transaction.Context.ContextInfo[property.Name] as Model;
                    if (model != null)
                    {
                        model.OnModelPropertyDeleted(e);
                        transaction.Context.ContextInfo.Remove(property.Name);
                    }
                }
            }
        }
 /// <summary>
 /// Called whenever a relationship of type TreeNodeReferencesInheritanceNodes is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnInheritanceNodeRemoved(ElementDeletedEventArgs args)
 {
     TreeNodeReferencesInheritanceNodes con = args.ModelElement as TreeNodeReferencesInheritanceNodes;
     if (con != null)
     {
         DeleteInheritanceNode(con.InheritanceNode);
     }
 }
 public void OnModelPropertyDeleted(ElementDeletedEventArgs e)
 {
     control.Clear();
 }
 private void OnElementDeleted(ElementDeletedEventArgs args)
 {
     this.ViewModelStore.EventManager.GetEvent<ErrorListRemoveItem>().Publish(this.Id);
 }
        /// <summary>
        /// Called whenever a model element is deleted from the store.
        /// </summary>
        /// <param name="sender">ViewModelStore</param>
        /// <param name="args">Event Arguments for notification of the removal of an ModelElement.</param>
        private void OnElementDeleted(object sender, ElementDeletedEventArgs args)
        {
            if (!ModelData.DoSendModelEvents)
                return;

            EventManager.GetEvent<ModelElementDeletedEvent>().Publish(args);

            if( args.ModelElement is ElementLink )
                EventManager.GetEvent<ModelElementLinkDeletedEvent>().Publish(args);
        }
Ejemplo n.º 46
0
		/// <summary>
		/// Survey event handler for deletion of an <see cref="Objectification"/> relationship
		/// </summary>
		private static void ObjectificationDeletedEvent(object sender, ElementDeletedEventArgs e)
		{
			INotifySurveyElementChanged eventNotify;
			ModelElement element = e.ModelElement;
			if (null != (eventNotify = (element.Store as IORMToolServices).NotifySurveyElementChanged))
			{
				Objectification objectification = (Objectification)element;
				ObjectType nestingType = objectification.NestingType;
				if (!objectification.IsImplied)
				{
					FactType nestedFactType = objectification.NestedFactType;
					if (!nestingType.IsDeleted)
					{
						eventNotify.ElementChanged(nestingType, SurveyGlyphQuestionTypes);
						foreach (Role role in nestingType.PlayedRoleCollection)
						{
							eventNotify.ElementChanged(role, SurveyGlyphQuestionTypes);
						}
					}
					if (!nestedFactType.IsDeleted)
					{
						eventNotify.ElementChanged(nestedFactType, SurveyGlyphQuestionTypes);
					}
				}
				else if (!nestingType.IsDeleted)
				{
					eventNotify.ElementAdded(nestingType, null);
				}
			}
		}
Ejemplo n.º 47
0
		/// <summary>
		/// Survey event handler when a role player is deleted. Handles conversion
		/// of a unary <see cref="FactType"/> to a non-unary FactType and role display updates.
		/// </summary>
		private static void RolePlayerDeletedEvent(object sender, ElementDeletedEventArgs e)
		{
			INotifySurveyElementChanged eventNotify;
			ModelElement element = e.ModelElement;
			if (null != (eventNotify = (element.Store as IORMToolServices).NotifySurveyElementChanged))
			{
				ObjectTypePlaysRole link = (ObjectTypePlaysRole)element;
				Role role = link.PlayedRole;
				if (!role.IsDeleted)
				{
					if (link.RolePlayer.IsImplicitBooleanValue)
					{
						eventNotify.ElementAdded(role, role.FactType);
					}
					else
					{
						eventNotify.ElementChanged(role, SurveyGlyphQuestionTypes);
						eventNotify.ElementRenamed(role);
					}
				}
			}
		}
        /// <summary>
        /// Called whenever a relationship of type DomainModelTreeViewReferencesRootNodes is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnChildRootNodeRemoved(ElementDeletedEventArgs args)
        {
            DomainModelTreeViewReferencesRootNodes con = args.ModelElement as DomainModelTreeViewReferencesRootNodes;
            if (con != null)
            {
                DeleteRootNode(con.RootNode);
            }

            
        }
Ejemplo n.º 49
0
			/// <summary>
			/// DeleteRule: typeof(ConstraintRoleSequenceHasRole)
			/// </summary>
			private static void ConstraintRoleSequenceHasRoleDeletedRule(ElementDeletedEventArgs e)
			{
				FactType factType = (e.ModelElement as ConstraintRoleSequenceHasRole).Role.FactType;
				if (factType != null && !factType.IsDeleted)
				{
					FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
				}
			}
Ejemplo n.º 50
0
        /// <summary>
        /// 删除包 从而删除自动生成的文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeletePackage(object sender, ElementDeletedEventArgs e)
        {
            // Don't handle changes in undo or load from file:
            if (modelingStore.InUndoRedoOrRollback || modelingStore.InSerializationTransaction) return;

            IElement element = e.ModelElement as IElement;
            string modelName = ModelNameByType(element, 2);

            bool isExist = isExistModel(element, 2, modelName);

            if (isExist)
            {
                return;
            }

            RemoveProjectItemByType(element, 2, modelName);
        }
 /// <summary>
 /// Called whenever a relationship of type SerializationClassReferencesAttributes is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnAttributeRemoved(ElementDeletedEventArgs args)
 {
     SerializationClassReferencesAttributes con = args.ModelElement as SerializationClassReferencesAttributes;
     if (con != null)
     {
         DeleteAttribute(con.Child);
     }
 }
 /// <summary>
 /// Called whenever a relationship of type SerializationClassReferencesChildren is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnChildRemoved(ElementDeletedEventArgs args)
 {
     SerializationClassReferencesChildren con = args.ModelElement as SerializationClassReferencesChildren;
     if (con != null)
     {
         DeleteChild(con.Child);
     }
 }
Ejemplo n.º 53
0
 public void OnModelPropertyDeleted(ElementDeletedEventArgs e)
 {
     if (ModelPropertyDeleted != null)
         ModelPropertyDeleted(e);
 }
 /// <summary>
 /// Called whenever a relationship of type MetaModelHasModelContexts is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnModelContextRemoved(ElementDeletedEventArgs args)
 {
     MetaModelHasModelContexts con = args.ModelElement as MetaModelHasModelContexts;
     if (con != null)
     {
         DeleteModelContext(con.BaseModelContext);
     }
 }
Ejemplo n.º 55
0
			/// <summary>
			/// DeleteRule: typeof(ObjectTypePlaysRole)
			/// </summary>
			private static void ObjectTypePlaysRoleDeletedRule(ElementDeletedEventArgs e)
			{
				// After this point, it is unknown whether the FactType was a unary, so we just delete it for now
				ObjectTypePlaysRole link = e.ModelElement as ObjectTypePlaysRole;
				ObjectType objectType = link.RolePlayer;
				Role role;
				FactType factType;
				if (objectType.IsImplicitBooleanValue)
				{
					if (!(role = link.PlayedRole).IsDeleted &&
						null != (factType = role.FactType) &&
						!factType.IsDeleted)
					{
						factType.Delete();
					}
					if (!objectType.IsDeleted)
					{
						objectType.Delete();
					}
				}
			}
 private void OnRolePlayerDeleted(ElementDeletedEventArgs args)
 {
     OnPropertyChanged("PropertyValue");
 }
 /// <summary>
 /// Called whenever a relationship of type TreeNodeReferencesReferenceRSNodes is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnReferenceRSNodeRemoved(ElementDeletedEventArgs args)
 {
     TreeNodeReferencesReferenceRSNodes con = args.ModelElement as TreeNodeReferencesReferenceRSNodes;
     if (con != null)
     {
         DeleteReferenceRSNode(con.ReferenceRSNode);
     }
 }
Ejemplo n.º 58
0
		private void DiagramRemovedEvent(object sender, ElementDeletedEventArgs e)
		{
			ModelElement element = e.ModelElement;
			if (element.Store.DefaultPartition == element.Partition)
			{
				myDiagramSetChanged = true;
				if (element == myDiagramView.Diagram)
				{
					// Note that this is unlikely, the diagram will be disassociated first
					AdjustVisibility(false, true);
				}
			}
		}
 /// <summary>
 /// Called if the hosted element was deleted.
 /// </summary>
 /// <param name="args">Data</param>
 protected virtual void OnHostedElementDeleted(ElementDeletedEventArgs args)
 {
     this.HostedElement = null;
 }
 /// <summary>
 /// Called whenever a relationship of type TreeNodeReferencesShapeClassNodes is deleted and
 /// the element hosted by this model is the source.
 /// </summary>
 /// <param name="args"></param>
 private void OnShapeClassNodeRemoved(ElementDeletedEventArgs args)
 {
     TreeNodeReferencesShapeClassNodes con = args.ModelElement as TreeNodeReferencesShapeClassNodes;
     if (con != null)
     {
         DeleteShapeClassNode(con.ShapeClassNode);
     }
 }