Ejemplo n.º 1
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     NMF.Models.Meta.IParameter parametersCasted = item.As <NMF.Models.Meta.IParameter>();
     if ((parametersCasted != null))
     {
         this._parent.Parameters.Add(parametersCasted);
     }
     if ((this._parent.DeclaringType == null))
     {
         NMF.Models.Meta.IStructuredType declaringTypeCasted = item.As <NMF.Models.Meta.IStructuredType>();
         if ((declaringTypeCasted != null))
         {
             this._parent.DeclaringType = declaringTypeCasted;
             return;
         }
     }
     if ((this._parent.Refines == null))
     {
         NMF.Models.Meta.IOperation refinesCasted = item.As <NMF.Models.Meta.IOperation>();
         if ((refinesCasted != null))
         {
             this._parent.Refines = refinesCasted;
             return;
         }
     }
 }
Ejemplo n.º 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(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IOperation oldOperation = ModelHelper.CastAs <NMF.Models.Meta.IOperation>(oldParent);
            NMF.Models.Meta.IOperation newOperation = ModelHelper.CastAs <NMF.Models.Meta.IOperation>(newParent);
            ValueChangedEventArgs      e            = new ValueChangedEventArgs(oldOperation, newOperation);

            this.OnOperationChanging(e);
            this.OnPropertyChanging("Operation", e, _operationReference);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     if ((this._parent.Operation == null))
     {
         NMF.Models.Meta.IOperation operationCasted = item.As <NMF.Models.Meta.IOperation>();
         if ((operationCasted != null))
         {
             this._parent.Operation = operationCasted;
             return;
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     NMF.Models.Meta.IOperation operationsCasted = item.As <NMF.Models.Meta.IOperation>();
     if ((operationsCasted != null))
     {
         this._parent.Operations.Add(operationsCasted);
     }
     NMF.Models.Meta.IAttribute attributesCasted = item.As <NMF.Models.Meta.IAttribute>();
     if ((attributesCasted != null))
     {
         this._parent.Attributes.Add(attributesCasted);
     }
 }
Ejemplo n.º 5
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(NMF.Models.IModelElement item)
 {
     NMF.Models.Meta.IOperation operationItem = item.As <NMF.Models.Meta.IOperation>();
     if (((operationItem != null) &&
          this._parent.Operations.Remove(operationItem)))
     {
         return(true);
     }
     NMF.Models.Meta.IAttribute attributeItem = item.As <NMF.Models.Meta.IAttribute>();
     if (((attributeItem != null) &&
          this._parent.Attributes.Remove(attributeItem)))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 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(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IOperation oldOperation = ModelHelper.CastAs <NMF.Models.Meta.IOperation>(oldParent);
            NMF.Models.Meta.IOperation newOperation = ModelHelper.CastAs <NMF.Models.Meta.IOperation>(newParent);
            if ((oldOperation != null))
            {
                oldOperation.Parameters.Remove(this);
            }
            if ((newOperation != null))
            {
                newOperation.Parameters.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldOperation, newOperation);

            this.OnOperationChanged(e);
            this.OnPropertyChanged("Operation", e, _operationReference);
            base.OnParentChanged(newParent, oldParent);
        }