public static void Serialize(this IModelSerializer serializer, IModelElement element, string path, Uri uri) { using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write)) { serializer.Serialize(element, fs, uri); } }
public ElementCreation(IModelElement createdElement) { if (createdElement == null) throw new ArgumentNullException(nameof(createdElement)); Element = createdElement; }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); shortcutTreeView.RefreshModel(modelElement); return retVal; }
public ModelPropertyChange(IModelElement element, string reference, object value) { if (element == null) throw new ArgumentNullException("element"); if (reference == null) throw new ArgumentNullException("reference"); Element = element; Reference = reference; NewValue = value; }
public static void Serialize(this IModelSerializer serializer, IModelElement element, string path) { Uri uri; if (!Uri.TryCreate(path, UriKind.Absolute, out uri)) { var file = new FileInfo(path); uri = new Uri(file.FullName); } serializer.Serialize(element, path, uri); }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { usageTreeView.Root = DisplayedModel; } return retVal; }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { RefreshRequirements(); } return retVal; }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { SetMoreInfo(); } return retVal; }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { propertyGrid.Refresh(); } return retVal; }
public static void Serialize(this IModelSerializer serializer, IModelElement element, Stream target, Uri uri) { if (element == null) throw new ArgumentNullException("element"); if (uri == null) throw new ArgumentNullException("uri"); var model = element.Model; if (model == null) { model = new Model(); model.RootElements.Add(element); } model.ModelUri = uri; serializer.Serialize(model, target); }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { usageTreeView.Root = DisplayedModel; if (usageTreeView.Nodes.Count > 0) { usageTreeView.Nodes[0].EnsureVisible(); } } return retVal; }
public static void Serialize(this IModelSerializer serializer, IModelElement element, string path) { Uri uri; Model model = element.Model; if (model == null || model.ModelUri == null) { if (!Uri.TryCreate(path, UriKind.Absolute, out uri)) { uri = new Uri(Path.GetFullPath(path)); } } else { uri = model.ModelUri; } serializer.Serialize(element, path, uri); }
/// <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 oldEnvironment = ModelHelper.CastAs <IEnvironment>(oldParent); IEnvironment newEnvironment = ModelHelper.CastAs <IEnvironment>(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); }
/// <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) { IResourceRepository oldResourceRepository__ResourceInterface = ModelHelper.CastAs <IResourceRepository>(oldParent); IResourceRepository newResourceRepository__ResourceInterface = ModelHelper.CastAs <IResourceRepository>(newParent); if ((oldResourceRepository__ResourceInterface != null)) { oldResourceRepository__ResourceInterface.ResourceInterfaces__ResourceRepository.Remove(this); } if ((newResourceRepository__ResourceInterface != null)) { newResourceRepository__ResourceInterface.ResourceInterfaces__ResourceRepository.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldResourceRepository__ResourceInterface, newResourceRepository__ResourceInterface); this.OnResourceRepository__ResourceInterfaceChanged(e); this.OnPropertyChanged("ResourceRepository__ResourceInterface", e, _resourceRepository__ResourceInterfaceReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IEOperation oldEOperation = ModelHelper.CastAs <IEOperation>(oldParent); IEOperation newEOperation = ModelHelper.CastAs <IEOperation>(newParent); if ((oldEOperation != null)) { oldEOperation.EParameters.Remove(this); } if ((newEOperation != null)) { newEOperation.EParameters.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldEOperation, newEOperation); this.OnEOperationChanged(e); this.OnPropertyChanged("EOperation", e); base.OnParentChanged(newParent, oldParent); }
/// <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) { IInfrastructureInterface oldInfrastructureInterface__InfrastructureSignature = ModelHelper.CastAs <IInfrastructureInterface>(oldParent); IInfrastructureInterface newInfrastructureInterface__InfrastructureSignature = ModelHelper.CastAs <IInfrastructureInterface>(newParent); if ((oldInfrastructureInterface__InfrastructureSignature != null)) { oldInfrastructureInterface__InfrastructureSignature.InfrastructureSignatures__InfrastructureInterface.Remove(this); } if ((newInfrastructureInterface__InfrastructureSignature != null)) { newInfrastructureInterface__InfrastructureSignature.InfrastructureSignatures__InfrastructureInterface.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldInfrastructureInterface__InfrastructureSignature, newInfrastructureInterface__InfrastructureSignature); this.OnInfrastructureInterface__InfrastructureSignatureChanged(e); this.OnPropertyChanged("InfrastructureInterface__InfrastructureSignature", e, _infrastructureInterface__InfrastructureSignatureReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IVariableUsage oldVariableUsage_VariableCharacterisation = ModelHelper.CastAs <IVariableUsage>(oldParent); IVariableUsage newVariableUsage_VariableCharacterisation = ModelHelper.CastAs <IVariableUsage>(newParent); if ((oldVariableUsage_VariableCharacterisation != null)) { oldVariableUsage_VariableCharacterisation.VariableCharacterisation_VariableUsage.Remove(this); } if ((newVariableUsage_VariableCharacterisation != null)) { newVariableUsage_VariableCharacterisation.VariableCharacterisation_VariableUsage.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldVariableUsage_VariableCharacterisation, newVariableUsage_VariableCharacterisation); this.OnVariableUsage_VariableCharacterisationChanged(e); this.OnPropertyChanged("VariableUsage_VariableCharacterisation", e, _variableUsage_VariableCharacterisationReference); base.OnParentChanged(newParent, oldParent); }
/// <summary> /// Adds a model element in this model element /// </summary> /// <param name="element"></param> public override void AddModelElement(IModelElement element) { if (element is Action) { Action item = element as Action; if (item != null) { appendActions(item); } } else if (element is Expectation) { Expectation item = element as Expectation; if (item != null) { appendExpectations(item); } } }
/// <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) { IEPackage oldESuperPackage = ModelHelper.CastAs <IEPackage>(oldParent); IEPackage newESuperPackage = ModelHelper.CastAs <IEPackage>(newParent); if ((oldESuperPackage != null)) { oldESuperPackage.ESubpackages.Remove(this); } if ((newESuperPackage != null)) { newESuperPackage.ESubpackages.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldESuperPackage, newESuperPackage); this.OnESuperPackageChanged(e); this.OnPropertyChanged("ESuperPackage", e); base.OnParentChanged(newParent, oldParent); }
/// <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) { IComposedStructure oldParentStructure__AssemblyContext = ModelHelper.CastAs <IComposedStructure>(oldParent); IComposedStructure newParentStructure__AssemblyContext = ModelHelper.CastAs <IComposedStructure>(newParent); if ((oldParentStructure__AssemblyContext != null)) { oldParentStructure__AssemblyContext.AssemblyContexts__ComposedStructure.Remove(this); } if ((newParentStructure__AssemblyContext != null)) { newParentStructure__AssemblyContext.AssemblyContexts__ComposedStructure.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldParentStructure__AssemblyContext, newParentStructure__AssemblyContext); this.OnParentStructure__AssemblyContextChanged(e); this.OnPropertyChanged("ParentStructure__AssemblyContext", e, _parentStructure__AssemblyContextReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { ISensor oldSensor = ModelHelper.CastAs <ISensor>(oldParent); ISensor newSensor = ModelHelper.CastAs <ISensor>(newParent); if ((oldSensor != null)) { oldSensor.Elements.Remove(this); } if ((newSensor != null)) { newSensor.Elements.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldSensor, newSensor); this.OnSensorChanged(e); this.OnPropertyChanged("Sensor", e, _sensorReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IRoute oldRoute = ModelHelper.CastAs <IRoute>(oldParent); IRoute newRoute = ModelHelper.CastAs <IRoute>(newParent); if ((oldRoute != null)) { oldRoute.Follows.Remove(this); } if ((newRoute != null)) { newRoute.Follows.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldRoute, newRoute); this.OnRouteChanged(e); this.OnPropertyChanged("Route", e, _routeReference); base.OnParentChanged(newParent, oldParent); }
protected override string GetRelativePathForNonIdentifiedChild(IModelElement child) { if (RootElements.Count == 1 && PromoteSingleRootElement) { return(null); } else { var index = RootElements.IndexOf(child); if (index != -1) { return("/" + index.ToString()); } else { return(null); } } }
/// <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) { IForkAction oldForkAction_SynchronisationPoint = ModelHelper.CastAs <IForkAction>(oldParent); IForkAction newForkAction_SynchronisationPoint = ModelHelper.CastAs <IForkAction>(newParent); if ((oldForkAction_SynchronisationPoint != null)) { oldForkAction_SynchronisationPoint.SynchronisingBehaviours_ForkAction = null; } if ((newForkAction_SynchronisationPoint != null)) { newForkAction_SynchronisationPoint.SynchronisingBehaviours_ForkAction = this; } ValueChangedEventArgs e = new ValueChangedEventArgs(oldForkAction_SynchronisationPoint, newForkAction_SynchronisationPoint); this.OnForkAction_SynchronisationPointChanged(e); this.OnPropertyChanged("ForkAction_SynchronisationPoint", e, _forkAction_SynchronisationPointReference); base.OnParentChanged(newParent, oldParent); }
/// <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); base.OnParentChanged(newParent, oldParent); }
/// <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) { IInterface oldInterface_RequiredCharacterisation = ModelHelper.CastAs <IInterface>(oldParent); IInterface newInterface_RequiredCharacterisation = ModelHelper.CastAs <IInterface>(newParent); if ((oldInterface_RequiredCharacterisation != null)) { oldInterface_RequiredCharacterisation.RequiredCharacterisations.Remove(this); } if ((newInterface_RequiredCharacterisation != null)) { newInterface_RequiredCharacterisation.RequiredCharacterisations.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldInterface_RequiredCharacterisation, newInterface_RequiredCharacterisation); this.OnInterface_RequiredCharacterisationChanged(e); this.OnPropertyChanged("Interface_RequiredCharacterisation", e, _interface_RequiredCharacterisationReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IComposedStructure oldParentStructure_ResourceRequiredDelegationConnector = ModelHelper.CastAs <IComposedStructure>(oldParent); IComposedStructure newParentStructure_ResourceRequiredDelegationConnector = ModelHelper.CastAs <IComposedStructure>(newParent); if ((oldParentStructure_ResourceRequiredDelegationConnector != null)) { oldParentStructure_ResourceRequiredDelegationConnector.ResourceRequiredDelegationConnectors_ComposedStructure.Remove(this); } if ((newParentStructure_ResourceRequiredDelegationConnector != null)) { newParentStructure_ResourceRequiredDelegationConnector.ResourceRequiredDelegationConnectors_ComposedStructure.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldParentStructure_ResourceRequiredDelegationConnector, newParentStructure_ResourceRequiredDelegationConnector); this.OnParentStructure_ResourceRequiredDelegationConnectorChanged(e); this.OnPropertyChanged("ParentStructure_ResourceRequiredDelegationConnector", e, _parentStructure_ResourceRequiredDelegationConnectorReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IEClass oldEContainingClass = ModelHelper.CastAs <IEClass>(oldParent); IEClass newEContainingClass = ModelHelper.CastAs <IEClass>(newParent); if ((oldEContainingClass != null)) { oldEContainingClass.EStructuralFeatures.Remove(this); } if ((newEContainingClass != null)) { newEContainingClass.EStructuralFeatures.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldEContainingClass, newEContainingClass); this.OnEContainingClassChanged(e); this.OnPropertyChanged("EContainingClass", e); base.OnParentChanged(newParent, oldParent); }
/// <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) { IQoSAnnotations oldQosAnnotations_SpecifiedOutputParameterAbstraction = ModelHelper.CastAs <IQoSAnnotations>(oldParent); IQoSAnnotations newQosAnnotations_SpecifiedOutputParameterAbstraction = ModelHelper.CastAs <IQoSAnnotations>(newParent); if ((oldQosAnnotations_SpecifiedOutputParameterAbstraction != null)) { oldQosAnnotations_SpecifiedOutputParameterAbstraction.SpecifiedOutputParameterAbstractions_QoSAnnotations.Remove(this); } if ((newQosAnnotations_SpecifiedOutputParameterAbstraction != null)) { newQosAnnotations_SpecifiedOutputParameterAbstraction.SpecifiedOutputParameterAbstractions_QoSAnnotations.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldQosAnnotations_SpecifiedOutputParameterAbstraction, newQosAnnotations_SpecifiedOutputParameterAbstraction); this.OnQosAnnotations_SpecifiedOutputParameterAbstractionChanged(e); this.OnPropertyChanged("QosAnnotations_SpecifiedOutputParameterAbstraction", e, _qosAnnotations_SpecifiedOutputParameterAbstractionReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IAbstractInternalControlFlowAction oldAction_ParametricResourceDemand = ModelHelper.CastAs <IAbstractInternalControlFlowAction>(oldParent); IAbstractInternalControlFlowAction newAction_ParametricResourceDemand = ModelHelper.CastAs <IAbstractInternalControlFlowAction>(newParent); if ((oldAction_ParametricResourceDemand != null)) { oldAction_ParametricResourceDemand.ResourceDemand_Action.Remove(this); } if ((newAction_ParametricResourceDemand != null)) { newAction_ParametricResourceDemand.ResourceDemand_Action.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldAction_ParametricResourceDemand, newAction_ParametricResourceDemand); this.OnAction_ParametricResourceDemandChanged(e); this.OnPropertyChanged("Action_ParametricResourceDemand", e, _action_ParametricResourceDemandReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IBDD oldOwner = ModelHelper.CastAs <IBDD>(oldParent); IBDD newOwner = ModelHelper.CastAs <IBDD>(newParent); if ((oldOwner != null)) { oldOwner.Ports.Remove(this); } if ((newOwner != null)) { newOwner.Ports.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldOwner, newOwner); this.OnOwnerChanged(e); this.OnPropertyChanged("Owner", e, _ownerReference); base.OnParentChanged(newParent, oldParent); }
/// <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) { IUsageModel oldUsageModel_UserData = ModelHelper.CastAs <IUsageModel>(oldParent); IUsageModel newUsageModel_UserData = ModelHelper.CastAs <IUsageModel>(newParent); if ((oldUsageModel_UserData != null)) { oldUsageModel_UserData.UserData_UsageModel.Remove(this); } if ((newUsageModel_UserData != null)) { newUsageModel_UserData.UserData_UsageModel.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldUsageModel_UserData, newUsageModel_UserData); this.OnUsageModel_UserDataChanged(e); this.OnPropertyChanged("UsageModel_UserData", e, _usageModel_UserDataReference); base.OnParentChanged(newParent, oldParent); }
public static IWorkspaceContext GetMasterDatabaseWorkspaceContext( [NotNull] IModelElement modelElement, bool allowAlways = false) { Assert.ArgumentNotNull(modelElement, nameof(modelElement)); Model model = modelElement.Model as Model; if (model == null) { return(null); } if (!allowAlways && model.UseDefaultDatabaseOnlyForSchema) { return(null); } return(model.MasterDatabaseWorkspaceContext); }
/// <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) { IEEnum oldEEnum = ModelHelper.CastAs <IEEnum>(oldParent); IEEnum newEEnum = ModelHelper.CastAs <IEEnum>(newParent); if ((oldEEnum != null)) { oldEEnum.ELiterals.Remove(this); } if ((newEEnum != null)) { newEEnum.ELiterals.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldEEnum, newEEnum); this.OnEEnumChanged(e); this.OnPropertyChanged("EEnum", e, _eEnumReference); base.OnParentChanged(newParent, oldParent); }
public static void ConstrainReference(this IClass @class, string name, IModelElement value = null) { var refinedReference = @class.LookupReference(name); if (refinedReference == null) { throw new ArgumentOutOfRangeException(); } var refConst = new ReferenceConstraint() { Constrains = refinedReference }; if (value != null) { refConst.References.Add(value); } @class.ReferenceConstraints.Add(refConst); }
/// <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) { IResourceDemandingBehaviour oldResourceDemandingBehaviour_AbstractAction = ModelHelper.CastAs <IResourceDemandingBehaviour>(oldParent); IResourceDemandingBehaviour newResourceDemandingBehaviour_AbstractAction = ModelHelper.CastAs <IResourceDemandingBehaviour>(newParent); if ((oldResourceDemandingBehaviour_AbstractAction != null)) { oldResourceDemandingBehaviour_AbstractAction.Steps_Behaviour.Remove(this); } if ((newResourceDemandingBehaviour_AbstractAction != null)) { newResourceDemandingBehaviour_AbstractAction.Steps_Behaviour.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldResourceDemandingBehaviour_AbstractAction, newResourceDemandingBehaviour_AbstractAction); this.OnResourceDemandingBehaviour_AbstractActionChanged(e); this.OnPropertyChanged("ResourceDemandingBehaviour_AbstractAction", e, _resourceDemandingBehaviour_AbstractActionReference); base.OnParentChanged(newParent, oldParent); }
/// <summary> /// Saves the given model element to the specified stream /// </summary> /// <param name="element">The model element</param> /// <param name="stream">The stream to save the model element to</param> /// <param name="uri">The uri under which the model element shall be retrievable</param> public void Save(IModelElement element, Stream stream, Uri uri) { if (element == null) { throw new ArgumentNullException(nameof(element)); } var model = element.Model; if (model != null) { model.EnsureAllElementsContained(); Serializer.Serialize(model, stream, uri); EnsureModelIsKnown(model); } else { Serializer.Serialize(element, stream, uri); } }
/// <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) { IPersonRegister oldPersonsInverse = ModelHelper.CastAs <IPersonRegister>(oldParent); IPersonRegister newPersonsInverse = ModelHelper.CastAs <IPersonRegister>(newParent); if ((oldPersonsInverse != null)) { oldPersonsInverse.Persons.Remove(this); } if ((newPersonsInverse != null)) { newPersonsInverse.Persons.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldPersonsInverse, newPersonsInverse); this.OnPersonsInverseChanged(e); this.OnPropertyChanged("PersonsInverse", e, _personsInverseReference); base.OnParentChanged(newParent, oldParent); }
protected override string GetRelativePathForNonIdentifiedChild(IModelElement child) { if (RootElements.Count == 1) { return string.Empty; } else { var index = RootElements.IndexOf(child); if (index != -1) { return ModelHelper.CreatePath("#", index); } else { return null; } } }
/// <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) { IBasicComponent oldBasicComponent_PassiveResource = ModelHelper.CastAs <IBasicComponent>(oldParent); IBasicComponent newBasicComponent_PassiveResource = ModelHelper.CastAs <IBasicComponent>(newParent); if ((oldBasicComponent_PassiveResource != null)) { oldBasicComponent_PassiveResource.PassiveResource_BasicComponent.Remove(this); } if ((newBasicComponent_PassiveResource != null)) { newBasicComponent_PassiveResource.PassiveResource_BasicComponent.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldBasicComponent_PassiveResource, newBasicComponent_PassiveResource); this.OnBasicComponent_PassiveResourceChanged(e); this.OnPropertyChanged("BasicComponent_PassiveResource", e, _basicComponent_PassiveResourceReference); base.OnParentChanged(newParent, oldParent); }
/// <summary> /// Allows to refresh the view, when the selected model changed /// </summary> /// <param name="context"></param> /// <returns>true if refresh should be performed</returns> public override bool HandleSelectionChange(Context.SelectionContext context) { bool retVal = base.HandleSelectionChange(context); if (retVal) { messagesDataGridView.DataSource = null; if (DisplayedModel != null) { IModelElement current = DisplayedModel; List <MessageEntry> messages = new List <MessageEntry>(); while (current != null) { if (current.Messages != null) { foreach (ElementLog log in current.Messages) { messages.Add(new MessageEntry(log)); } } if (EfsSystem.Instance.DisplayEnclosingMessages) { current = current.Enclosing as IModelElement; } else { current = null; } } messagesDataGridView.DataSource = messages; // ReSharper disable PossibleNullReferenceException messagesDataGridView.Columns["Level"].FillWeight = 10F; messagesDataGridView.Columns["Message"].FillWeight = 90F; // ReSharper restore PossibleNullReferenceException } } return(retVal); }
/// <summary> /// Gets the relative URI fragment for the given child model element /// </summary> /// <returns>A fragment of the relative URI</returns> /// <param name="element">The element that should be looked for</param> protected override string GetRelativePathForNonIdentifiedChild(IModelElement element) { if ((element == this.System)) { return(ModelHelper.CreatePath("System")); } if ((element == this.Repository)) { return(ModelHelper.CreatePath("Repository")); } if ((element == this.Allocation)) { return(ModelHelper.CreatePath("Allocation")); } if ((element == this.Environment)) { return(ModelHelper.CreatePath("Environment")); } return(base.GetRelativePathForNonIdentifiedChild(element)); }
private void EditionTextBox_MouseClick(object sender, MouseEventArgs mouseEventArgs) { if (ModifierKeys == Keys.Control) { INamable instance = GetInstance(mouseEventArgs.Location); if (instance != null) { IModelElement modelElement = instance as IModelElement; if (modelElement != null) { Context.SelectionCriteria criteria = GuiUtils.SelectionCriteriaBasedOnMouseEvent(mouseEventArgs); if ((criteria & Context.SelectionCriteria.Ctrl) != 0) { EfsSystem.Instance.Context.SelectElement(modelElement, this, Context.SelectionCriteria.DoubleClick); } } } } }
/// <summary> /// Adds a model element in this model element /// </summary> /// <param name="copy"></param> public override void AddModelElement(IModelElement element) { { Step item = element as Step; if (item != null) { appendSteps(item); } } base.AddModelElement(element); }
private void EnsureModelIsKnown(IModelElement element) { var model = element.Model; Model existingModel; if (models.TryGetValue(model.ModelUri, out existingModel)) { if (model != existingModel) { throw new InvalidOperationException(string.Format("This repository already contains a different model with the Uri {0}", model.ModelUri)); } } else { models.Add(model.ModelUri, model); } }
/// <summary> /// Saves the given model element to the specified stream /// </summary> /// <param name="element">The model element</param> /// <param name="stream">The stream to save the model element to</param> /// <param name="uri">The uri under which the model element shall be retrievable</param> public void Save(IModelElement element, Stream stream, Uri uri) { Serializer.Serialize(element, stream, uri); EnsureModelIsKnown(element); }
/// <summary> /// Saves the given model element to the specified stream /// </summary> /// <param name="element">The model element</param> /// <param name="path">The path where to save the model element</param> /// <param name="uri">The uri under which the model element can be retrieved</param> public void Save(IModelElement element, string path, Uri uri) { Serializer.Serialize(element, path, uri); EnsureModelIsKnown(element); }
public bool IsParent(IModelElement element) { return StructureElement.IsParent(element); }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { if (Variable != null) { Expression expression = new Parser().Expression( EnclosingFinder<Dictionary>.find(Variable), Variable.FullName); IVariable variable = expression.GetVariable(new InterpretationContext()); if (variable != Variable) { SetVariable(variable); } else { structureTreeListView.RefreshObject(Variable); structureTreeListView.Refresh(); } } } return retVal; }
/// <summary> /// Allows to refresh the view, when the value of a model changed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns>True if the view should be refreshed</returns> public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind) { bool retVal = base.HandleValueChange(modelElement, changeKind); if (retVal) { testBrowserTreeView.RefreshModel(modelElement); Refresh(); } if (testDescriptionTimeLineControl.ShouldDisplayModelElement(modelElement)) { testDescriptionTimeLineControl.Refresh(); } if (testExecutionTimeLineControl.ShouldDisplayModelElement(modelElement)) { testExecutionTimeLineControl.Refresh(); } if (changeKind == Context.ChangeKind.EndOfCycle) { tabControl1.SelectedTab = testExecutionTabPage; } return retVal; }
/// <summary> /// Adds a model element in this model element /// </summary> /// <param name="element"></param> public override void AddModelElement(IModelElement element) { StateMachine.AddModelElement(element); }
/// <summary> /// Adds a model element in this model element /// </summary> /// <param name="copy"></param> public override void AddModelElement(IModelElement element) { Folder folder = element as Folder; if (folder != null) { appendFolders(folder); } else { Translation translation = element as Translation; if (translation != null) { appendTranslations(translation); } } }
protected BubbledChangeFetcher(IModelElement element, Type type) { Element = element; Type = type; }
public void AddModelElement(IModelElement element) { // Nothing to do }
public int CompareTo(IModelElement other) { int retVal = -1; if (other != null) { retVal = Name.CompareTo(other.Name); } return retVal; }
/// <summary> /// Indicates that a change event should be displayed /// </summary> /// <param name="modelElement"></param> /// <param name="changeKind"></param> /// <returns></returns> protected override bool ShouldDisplayChange(IModelElement modelElement, Context.ChangeKind changeKind) { // There is no smart way to determine whether the change should be taken into account or not return true; }
/// <summary> /// Indicates that the model element should be displayed /// </summary> /// <param name="modelElement"></param> /// <returns></returns> protected override bool ShouldTrackSelectionChange(IModelElement modelElement) { return true; }
/// <summary> /// Indicates that the model element should be displayed /// </summary> /// <param name="modelElement"></param> /// <returns></returns> protected override bool ShouldTrackSelectionChange(IModelElement modelElement) { // Once created, this view does not change displayed model return false; }
/// <summary> /// Indicates that coloring should be taken into consideration /// </summary> /// <param name="modelElement"></param> /// <returns></returns> public override bool ShouldUpdateColoring(IModelElement modelElement) { // This view do not use coloring return false; }
public StandardValuesCollection GetValues(IModelElement element) { FinderRepository.INSTANCE.ClearCache(); Dictionary dictionary = EnclosingFinder<Dictionary>.find(element); NameSpace nameSpace = EnclosingNameSpaceFinder.find(element); List<string> retVal = new List<string>(); if (nameSpace != null) { OverallTypeFinder.INSTANCE.findAllValueNames("", nameSpace, true, retVal); } else { OverallTypeFinder.INSTANCE.findAllValueNames("", dictionary, false, retVal); } retVal.Sort(); foreach (string name in dictionary.EFSSystem.PredefinedTypes.Keys) { retVal.Add(name); } return new StandardValuesCollection(retVal); }