コード例 #1
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)
        {
            IEnvironment_MM06     oldEnvironment = ModelHelper.CastAs <IEnvironment_MM06>(oldParent);
            IEnvironment_MM06     newEnvironment = ModelHelper.CastAs <IEnvironment_MM06>(newParent);
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEnvironment, newEnvironment);

            this.OnEnvironmentChanging(e);
            this.OnPropertyChanging("Environment", e, _environmentReference);
        }
コード例 #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)
            {
                ILink linksCasted = item.As <ILink>();

                if ((linksCasted != null))
                {
                    this._parent.Links.Add(linksCasted);
                }
                if ((this._parent.Environment == null))
                {
                    IEnvironment_MM06 environmentCasted = item.As <IEnvironment_MM06>();
                    if ((environmentCasted != null))
                    {
                        this._parent.Environment = environmentCasted;
                        return;
                    }
                }
            }
コード例 #3
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)
        {
            IEnvironment_MM06 oldEnvironment = ModelHelper.CastAs <IEnvironment_MM06>(oldParent);
            IEnvironment_MM06 newEnvironment = ModelHelper.CastAs <IEnvironment_MM06>(newParent);

            if ((oldEnvironment != null))
            {
                oldEnvironment.Containers.Remove(this);
            }
            if ((newEnvironment != null))
            {
                newEnvironment.Containers.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEnvironment, newEnvironment);

            this.OnEnvironmentChanged(e);
            this.OnPropertyChanged("Environment", e, _environmentReference);
            base.OnParentChanged(newParent, oldParent);
        }
コード例 #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.System == null))
     {
         ISystem_MM06 systemCasted = item.As <ISystem_MM06>();
         if ((systemCasted != null))
         {
             this._parent.System = systemCasted;
             return;
         }
     }
     if ((this._parent.Repository == null))
     {
         IRepository_MM06 repositoryCasted = item.As <IRepository_MM06>();
         if ((repositoryCasted != null))
         {
             this._parent.Repository = repositoryCasted;
             return;
         }
     }
     if ((this._parent.Allocation == null))
     {
         IAllocation allocationCasted = item.As <IAllocation>();
         if ((allocationCasted != null))
         {
             this._parent.Allocation = allocationCasted;
             return;
         }
     }
     if ((this._parent.Environment == null))
     {
         IEnvironment_MM06 environmentCasted = item.As <IEnvironment_MM06>();
         if ((environmentCasted != null))
         {
             this._parent.Environment = environmentCasted;
             return;
         }
     }
 }