コード例 #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)
            {
                IModelElementExtension extensionsCasted = item.As <IModelElementExtension>();

                if ((extensionsCasted != null))
                {
                    this._parent.Extensions.Add(extensionsCasted);
                }
                if ((this._parent.Parent == null))
                {
                    NMF.Models.Meta.IModelElement parentCasted = item.As <NMF.Models.Meta.IModelElement>();
                    if ((parentCasted != null))
                    {
                        this._parent.Parent = parentCasted;
                        return;
                    }
                }
                if ((this._parent.Type == null))
                {
                    IReferenceType typeCasted = item.As <IReferenceType>();
                    if ((typeCasted != null))
                    {
                        this._parent.Type = typeCasted;
                        return;
                    }
                }
            }
コード例 #2
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.Meta.IModelElement rootElementsCasted = item.As <NMF.Models.Meta.IModelElement>();
     if ((rootElementsCasted != null))
     {
         this._parent.RootElements.Add(rootElementsCasted);
     }
 }
コード例 #3
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.Meta.IModelElement oldExtendedElement = ModelHelper.CastAs <NMF.Models.Meta.IModelElement>(oldParent);
            NMF.Models.Meta.IModelElement newExtendedElement = ModelHelper.CastAs <NMF.Models.Meta.IModelElement>(newParent);
            ValueChangedEventArgs         e = new ValueChangedEventArgs(oldExtendedElement, newExtendedElement);

            this.OnExtendedElementChanging(e);
            this.OnPropertyChanging("ExtendedElement");
        }
コード例 #4
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.Meta.IModelElement modelElementItem = item.As <NMF.Models.Meta.IModelElement>();
     if (((modelElementItem != null) &&
          this._parent.RootElements.Remove(modelElementItem)))
     {
         return(true);
     }
     return(false);
 }
コード例 #5
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.ExtendedElement == null))
     {
         NMF.Models.Meta.IModelElement extendedElementCasted = item.As <NMF.Models.Meta.IModelElement>();
         if ((extendedElementCasted != null))
         {
             this._parent.ExtendedElement = extendedElementCasted;
             return;
         }
     }
 }
コード例 #6
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.Meta.IModelElement oldExtendedElement = ModelHelper.CastAs <NMF.Models.Meta.IModelElement>(oldParent);
            NMF.Models.Meta.IModelElement newExtendedElement = ModelHelper.CastAs <NMF.Models.Meta.IModelElement>(newParent);
            if ((oldExtendedElement != null))
            {
                oldExtendedElement.Extensions.Remove(this);
            }
            if ((newExtendedElement != null))
            {
                newExtendedElement.Extensions.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldExtendedElement, newExtendedElement);

            this.OnExtendedElementChanged(e);
            this.OnPropertyChanged("ExtendedElement", e);
        }