/// <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) { IUsageScenario oldUsageScenario_Workload = ModelHelper.CastAs <IUsageScenario>(oldParent); IUsageScenario newUsageScenario_Workload = ModelHelper.CastAs <IUsageScenario>(newParent); ValueChangedEventArgs e = new ValueChangedEventArgs(oldUsageScenario_Workload, newUsageScenario_Workload); this.OnUsageScenario_WorkloadChanging(e); this.OnPropertyChanging("UsageScenario_Workload", e, _usageScenario_WorkloadReference); }
/// <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.UsageScenario_Workload == null)) { IUsageScenario usageScenario_WorkloadCasted = item.As <IUsageScenario>(); if ((usageScenario_WorkloadCasted != null)) { this._parent.UsageScenario_Workload = usageScenario_WorkloadCasted; return; } } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IUsageScenario usageScenario_UsageModelCasted = item.As <IUsageScenario>(); if ((usageScenario_UsageModelCasted != null)) { this._parent.UsageScenario_UsageModel.Add(usageScenario_UsageModelCasted); } IUserData userData_UsageModelCasted = item.As <IUserData>(); if ((userData_UsageModelCasted != null)) { this._parent.UserData_UsageModel.Add(userData_UsageModelCasted); } }
/// <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) { IUsageScenario usageScenarioItem = item.As <IUsageScenario>(); if (((usageScenarioItem != null) && this._parent.UsageScenario_UsageModel.Remove(usageScenarioItem))) { return(true); } IUserData userDataItem = item.As <IUserData>(); if (((userDataItem != null) && this._parent.UserData_UsageModel.Remove(userDataItem))) { return(true); } return(false); }
/// <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) { IUsageScenario oldUsageScenario_Workload = ModelHelper.CastAs <IUsageScenario>(oldParent); IUsageScenario newUsageScenario_Workload = ModelHelper.CastAs <IUsageScenario>(newParent); if ((oldUsageScenario_Workload != null)) { oldUsageScenario_Workload.Workload_UsageScenario = null; } if ((newUsageScenario_Workload != null)) { newUsageScenario_Workload.Workload_UsageScenario = this; } ValueChangedEventArgs e = new ValueChangedEventArgs(oldUsageScenario_Workload, newUsageScenario_Workload); this.OnUsageScenario_WorkloadChanged(e); this.OnPropertyChanged("UsageScenario_Workload", e, _usageScenario_WorkloadReference); base.OnParentChanged(newParent, oldParent); }
/// <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.UsageScenario_SenarioBehaviour == null)) { IUsageScenario usageScenario_SenarioBehaviourCasted = item.As <IUsageScenario>(); if ((usageScenario_SenarioBehaviourCasted != null)) { this._parent.UsageScenario_SenarioBehaviour = usageScenario_SenarioBehaviourCasted; return; } } if ((this._parent.BranchTransition_ScenarioBehaviour == null)) { IBranchTransition branchTransition_ScenarioBehaviourCasted = item.As <IBranchTransition>(); if ((branchTransition_ScenarioBehaviourCasted != null)) { this._parent.BranchTransition_ScenarioBehaviour = branchTransition_ScenarioBehaviourCasted; return; } } if ((this._parent.Loop_ScenarioBehaviour == null)) { ILoop loop_ScenarioBehaviourCasted = item.As <ILoop>(); if ((loop_ScenarioBehaviourCasted != null)) { this._parent.Loop_ScenarioBehaviour = loop_ScenarioBehaviourCasted; return; } } IAbstractUserAction actions_ScenarioBehaviourCasted = item.As <IAbstractUserAction>(); if ((actions_ScenarioBehaviourCasted != null)) { this._parent.Actions_ScenarioBehaviour.Add(actions_ScenarioBehaviourCasted); } }