Пример #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)
            {
                IEStringToStringMapEntry detailsCasted = item.As <IEStringToStringMapEntry>();

                if ((detailsCasted != null))
                {
                    this._parent.Details.Add(detailsCasted);
                }
                if ((this._parent.EModelElement == null))
                {
                    IEModelElement eModelElementCasted = item.As <IEModelElement>();
                    if ((eModelElementCasted != null))
                    {
                        this._parent.EModelElement = eModelElementCasted;
                        return;
                    }
                }
                IEObject contentsCasted = item.As <IEObject>();

                if ((contentsCasted != null))
                {
                    this._parent.Contents.Add(contentsCasted);
                }
                IEObject referencesCasted = item.As <IEObject>();

                if ((referencesCasted != null))
                {
                    this._parent.References.Add(referencesCasted);
                }
            }
Пример #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)
        {
            IEModelElement        oldEModelElement = ModelHelper.CastAs <IEModelElement>(oldParent);
            IEModelElement        newEModelElement = ModelHelper.CastAs <IEModelElement>(newParent);
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEModelElement, newEModelElement);

            this.OnEModelElementChanging(e);
            this.OnPropertyChanging("EModelElement");
        }
Пример #3
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.EModelElement == null))
     {
         IEModelElement eModelElementCasted = item.As <IEModelElement>();
         if ((eModelElementCasted != null))
         {
             this._parent.EModelElement = eModelElementCasted;
             return;
         }
     }
 }
Пример #4
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)
        {
            IEModelElement oldEModelElement = ModelHelper.CastAs <IEModelElement>(oldParent);
            IEModelElement newEModelElement = ModelHelper.CastAs <IEModelElement>(newParent);

            if ((oldEModelElement != null))
            {
                oldEModelElement.EAnnotations.Remove(this);
            }
            if ((newEModelElement != null))
            {
                newEModelElement.EAnnotations.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEModelElement, newEModelElement);

            this.OnEModelElementChanged(e);
            this.OnPropertyChanged("EModelElement", e);
        }