Example #1
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     NMF.Models.Tests.Architecture.IClass classesCasted = item.As <NMF.Models.Tests.Architecture.IClass>();
     if ((classesCasted != null))
     {
         this._parent.Classes.Add(classesCasted);
     }
 }
Example #2
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)
        {
            NMF.Models.Tests.Architecture.IClass oldIsEncapsulatedBy = ModelHelper.CastAs <NMF.Models.Tests.Architecture.IClass>(oldParent);
            NMF.Models.Tests.Architecture.IClass newIsEncapsulatedBy = ModelHelper.CastAs <NMF.Models.Tests.Architecture.IClass>(newParent);
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldIsEncapsulatedBy, newIsEncapsulatedBy);

            this.OnIsEncapsulatedByChanging(e);
            this.OnPropertyChanging("IsEncapsulatedBy", e, _isEncapsulatedByReference);
        }
Example #3
0
 /// <summary>
 /// Removes the given item from the collection
 /// </summary>
 /// <returns>True, if the item was removed, otherwise False</returns>
 /// <param name="item">The item that should be removed</param>
 public override bool Remove(IModelElement item)
 {
     NMF.Models.Tests.Architecture.IClass classItem = item.As <NMF.Models.Tests.Architecture.IClass>();
     if (((classItem != null) &&
          this._parent.Classes.Remove(classItem)))
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.IsEncapsulatedBy == null))
     {
         NMF.Models.Tests.Architecture.IClass isEncapsulatedByCasted = item.As <NMF.Models.Tests.Architecture.IClass>();
         if ((isEncapsulatedByCasted != null))
         {
             this._parent.IsEncapsulatedBy = isEncapsulatedByCasted;
             return;
         }
     }
 }
Example #5
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)
        {
            NMF.Models.Tests.Architecture.IClass oldIsEncapsulatedBy = ModelHelper.CastAs <NMF.Models.Tests.Architecture.IClass>(oldParent);
            NMF.Models.Tests.Architecture.IClass newIsEncapsulatedBy = ModelHelper.CastAs <NMF.Models.Tests.Architecture.IClass>(newParent);
            if ((oldIsEncapsulatedBy != null))
            {
                oldIsEncapsulatedBy.Encapsulates.Remove(this);
            }
            if ((newIsEncapsulatedBy != null))
            {
                newIsEncapsulatedBy.Encapsulates.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldIsEncapsulatedBy, newIsEncapsulatedBy);

            this.OnIsEncapsulatedByChanged(e);
            this.OnPropertyChanged("IsEncapsulatedBy", e, _isEncapsulatedByReference);
            base.OnParentChanged(newParent, oldParent);
        }
Example #6
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IFeature encapsulatesCasted = item.As <IFeature>();

                if ((encapsulatesCasted != null))
                {
                    this._parent.Encapsulates.Add(encapsulatesCasted);
                }
                if ((this._parent.BaseType == null))
                {
                    NMF.Models.Tests.Architecture.IClass baseTypeCasted = item.As <NMF.Models.Tests.Architecture.IClass>();
                    if ((baseTypeCasted != null))
                    {
                        this._parent.BaseType = baseTypeCasted;
                        return;
                    }
                }
            }