/// <summary> /// Called to ask the filter if a particular relationship from a source element should be included in the traversal /// </summary> /// <param name="walker">ElementWalker traversing the model</param> /// <param name="sourceElement">Model Element playing the source role</param> /// <param name="sourceRoleInfo">DomainRoleInfo of the role that the source element is playing in the relationship</param> /// <param name="domainRelationshipInfo">DomainRelationshipInfo for the ElementLink in question</param> /// <param name="targetRelationship">Relationship in question</param> /// <returns>Yes if the relationship should be traversed</returns> public virtual DslModeling::VisitorFilterResult ShouldVisitRelationship(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::DomainRoleInfo sourceRoleInfo, DslModeling::DomainRelationshipInfo domainRelationshipInfo, DslModeling::ElementLink targetRelationship) { return(this.DomainRoles.ContainsKey(sourceRoleInfo.Id) ? DslModeling::VisitorFilterResult.Yes : DslModeling::VisitorFilterResult.DoNotCare); }
/// <summary> /// Called to ask the filter if a particular relationship from a source element should be included in the traversal /// </summary> /// <param name="walker">ElementWalker that is traversing the model</param> /// <param name="sourceElement">Model Element playing the source role</param> /// <param name="sourceRoleInfo">DomainRoleInfo of the role that the source element is playing in the relationship</param> /// <param name="domainRelationshipInfo">DomainRelationshipInfo for the ElementLink in question</param> /// <param name="targetRelationship">Relationship in question</param> /// <returns>Yes if the relationship should be traversed</returns> public virtual DslModeling::VisitorFilterResult ShouldVisitRelationship(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::DomainRoleInfo sourceRoleInfo, DslModeling::DomainRelationshipInfo domainRelationshipInfo, DslModeling::ElementLink targetRelationship) { return(DslModeling::VisitorFilterResult.Yes); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::nHydrate.Dsl.Entity) { if (candidateTarget is global::nHydrate.Dsl.Entity) { return(true); } } } return(false); }
protected virtual bool SkipFixup(DslModeling::ModelElement childElement) { return(childElement.IsDeleted); }
internal static global::System.Collections.IList GetElementsFromTableForColumnsCompartment(DslModeling::ModelElement element) { global::ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.Table root = (global::ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.Table)element; // Segments 0 and 1 DslModeling::LinkedElementCollection <global::ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.Column> result = root.ColumnCollection; return(result); }
/// <summary> /// This method is called during deserialization to convert a given value to a specific typed value (Int32?). /// </summary> /// <param name="serializationContext">The current serialization context instance.</param> /// <param name="modelELement">ModdelElement, to which the property belongs to.</param> /// <param name="propertyName">The Property name, which value is to be converted.</param> /// <param name="value">Value to convert.</param> /// <param name="targetType">Type, the object is to be converted to.</param> /// <param name="isRequired">True if this property is marked as required in the domain model. Can be null.</param> /// <returns>Converted value.</returns> public override global::System.Int32?ConvertTypedObjectInt32From(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement modelELement, string propertyName, object value, System.Type targetType, bool?isRequired) { if (value is string) { if (String.IsNullOrEmpty(value as string)) { return(null); } if (String.IsNullOrWhiteSpace(value as string)) { return(null); } try { System.Int32?d = Convert.ToInt32(value, System.Globalization.CultureInfo.InvariantCulture); return(d); } catch (Exception ex) { serializationContext.Result.AddMessage(new DslModeling::SerializationMessage( DslModeling::SerializationMessageKind.Error, "Couldnt convert " + value + " to Int: " + ex.ToString(), "", 0, 0, null)); } } return(null); }
public override DslEditorViewModelModelTree::BaseModelElementTreeViewModel CreateModelElementTreeViewModel(DslModeling::ModelElement modelElement, bool bHookUpEvents, bool bCreateContextMenus, DslEditorViewModel::MainModelTreeViewModel mainModelTreeVm) { if (modelElement is DslEditorModeling::IDomainModelOwnable) { if (global::Tum.TestLanguage.TestLanguageDomainModel.DomainModelId == (modelElement as DslEditorModeling::IDomainModelOwnable).GetDomainModelTypeId()) { return(new Tum.TestLanguage.ViewModel.ModelTree.ModelTreeTestLanguageViewModel(this.Store, modelElement, null, System.Guid.Empty, null, bHookUpEvents, bCreateContextMenus, mainModelTreeVm)); } } return(new DslEditorViewModelModelTree::ModelElementTreeViewModel(this.Store, modelElement, null, System.Guid.Empty, null, bHookUpEvents, bCreateContextMenus, mainModelTreeVm)); }
/// <summary> /// Removes a specific key. /// </summary> /// <param name="modelElement">Domain model element to remove the key for.</param> public virtual void RemoveKey(DslModeling::ModelElement modelElement) { RemoveKey(modelElement, new System.Collections.Generic.List <DslEditorModeling::IDomainModelServices>()); }
/// <summary> /// Write an element as the root of XML. /// </summary> /// <param name="serializationContext">Serialization context.</param> /// <param name="rootElement">Root element instance that will be serialized.</param> /// <param name="writer">XmlWriter to write serialized data to.</param> public override void WriteRootElement(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement rootElement, global::System.Xml.XmlWriter writer) { #region Check Parameters global::System.Diagnostics.Debug.Assert(serializationContext != null); if (serializationContext == null) { throw new global::System.ArgumentNullException("serializationContext"); } global::System.Diagnostics.Debug.Assert(rootElement != null); if (rootElement == null) { throw new global::System.ArgumentNullException("rootElement"); } global::System.Diagnostics.Debug.Assert(writer != null); if (writer == null) { throw new global::System.ArgumentNullException("writer"); } #endregion DslModeling::DomainXmlSerializerDirectory directory = this.GetDirectory(rootElement.Store); DslModeling::DomainClassXmlSerializer rootSerializer = null; if (rootElement is DslDiagrams::Diagram) { rootSerializer = directory.GetSerializer(PatternModelSchemaDiagram.DomainClassId); } else { rootSerializer = directory.GetSerializer(rootElement.GetDomainClass().Id); } global::System.Diagnostics.Debug.Assert(rootSerializer != null, "Cannot find serializer for " + rootElement.GetDomainClass().Name + "!"); // Set up root element settings DslModeling::RootElementSettings rootElementSettings = new DslModeling::RootElementSettings(); if (!(rootElement is DslDiagrams::Diagram)) { // Only model has schema, diagram has no schema. rootElementSettings.SchemaTargetNamespace = "http://schemas.microsoft.com/visualstudio/patterning/runtime/patternmodel"; } rootElementSettings.Version = new global::System.Version("1.3.0.0"); // Carry out the normal serialization. rootSerializer.Write(serializationContext, rootElement, writer, rootElementSettings); }
public ModelTreeVSPluginDSLViewModel(DslEditorViewModelData::ViewModelStore viewModelStore, DslModeling::ModelElement element, DslModeling::ElementLink link, System.Guid domainRoleId, DslEditorTreeViewModel::ModelElementTreeViewModel parent, bool bHookUpEvents, bool bCreateContextMenus, DslEditorViewModel::MainModelTreeViewModel mainModelTreeVm) : base(viewModelStore, element, link, domainRoleId, parent, bHookUpEvents, bCreateContextMenus, mainModelTreeVm) { }
internal static global::System.Collections.IList GetElementsFromContainerForAssets(DslModeling::ModelElement rootElement) { global::JA.Risk.Container root = (global::JA.Risk.Container)rootElement; // Segments 0 and 1 DslModeling::LinkedElementCollection <global::JA.Risk.Asset> result = root.Assets; return(result); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion) { if (candidateTarget is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion) { global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion sourceRelacion = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion)candidateSource; global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion targetAtributoRelacion = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.AtributoRelacion)candidateTarget; if (targetAtributoRelacion == null || global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.RelacionReferencesAtributoRelacion.GetLinkToRelacion(targetAtributoRelacion) != null) { return(false); } if (targetAtributoRelacion == null || sourceRelacion == null || global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.RelacionReferencesAtributoRelacion.GetLinks(sourceRelacion, targetAtributoRelacion).Count > 0) { return(false); } return(true); } } } return(false); }
public static DslModeling::ElementLink Connect(DslModeling::ModelElement source, DslModeling::ModelElement target) { if (source == null) { throw new global::System.ArgumentNullException("source"); } if (target == null) { throw new global::System.ArgumentNullException("target"); } if (CanAcceptSourceAndTarget(source, target)) { if (source is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion) { if (target is global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Entidad) { global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion sourceAccepted = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Relacion)source; global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Entidad targetAccepted = (global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.Entidad)target; DslModeling::ElementLink result = new global::UPM_IPS.DRQPJPFMAMPracticaDSLTools.RelacionDerechaReferencesEntidadIzquierda(sourceAccepted, targetAccepted); if (DslModeling::DomainClassInfo.HasNameProperty(result)) { DslModeling::DomainClassInfo.SetUniqueName(result); } return(result); } } } global::System.Diagnostics.Debug.Fail("Having agreed that the connection can be accepted we should never fail to make one."); throw new global::System.InvalidOperationException(); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::Sawczyn.Sequencer.Comment) { if (candidateTarget is global::Sawczyn.Sequencer.FlowElement) { global::Sawczyn.Sequencer.Comment sourceComment = (global::Sawczyn.Sequencer.Comment)candidateSource; global::Sawczyn.Sequencer.FlowElement targetFlowElement = (global::Sawczyn.Sequencer.FlowElement)candidateTarget; if (targetFlowElement == null || sourceComment == null || global::Sawczyn.Sequencer.CommentReferencesSubjects.GetLinks(sourceComment, targetFlowElement).Count > 0) { return(false); } return(true); } } } return(false); }
public override DslEditorViewModelModelTree::ModelElementTreeViewModel CreateModelElementTreeViewModel(DslModeling::ModelElement element, DslModeling::ElementLink link, System.Guid domainRoleId, DslEditorViewModelModelTree::ModelElementTreeViewModel parent, bool bHookUpEvents, bool bCreateContextMenus, DslEditorViewModel::MainModelTreeViewModel mainModelTreeVm) { if (element is DslEditorModeling::IDomainModelOwnable) { if (global::Tum.TestLanguage.TestLanguageDomainModel.DomainModelId == (element as DslEditorModeling::IDomainModelOwnable).GetDomainModelTypeId()) { return(new Tum.TestLanguage.ViewModel.ModelTree.ModelTreeTestLanguageViewModel(this.Store, element, link, domainRoleId, parent, bHookUpEvents, bCreateContextMenus, mainModelTreeVm)); } } return(new DslEditorViewModelModelTree::ModelElementTreeViewModel(this.Store, element, link, domainRoleId, parent, bHookUpEvents, bCreateContextMenus, mainModelTreeVm)); }
internal static global::System.Collections.IList GetElementsFromEntityForProperties(DslModeling::ModelElement rootElement) { global::EPAM.NHModelingLanguage.Entity root = (global::EPAM.NHModelingLanguage.Entity)rootElement; // Segments 0 and 1 DslModeling::LinkedElementCollection <global::EPAM.NHModelingLanguage.Property> result = root.Properties; return(result); }
/// <summary> /// Returns a collection of property view models for the given selected elements. /// </summary> /// <param name="models">Already gathered models.</param> /// <param name="modelElement">ModelElement.</param> /// <param name="handledStores">Stores that have already been processed.</param> /// <returns>Collection of property view models. Can be empty.</returns> public override bool AddPropertyEditorViewModels(System.Collections.Generic.List <DslEditorViewModelPropertyGrid::PropertyGridViewModel> models, DslModeling::ModelElement modelElement, System.Collections.Generic.List <DslEditorViewModelData::ViewModelStore> handledStores) { if (handledStores.Contains(this.Store)) { return(false); } else { handledStores.Add(this.Store); } if (modelElement.GetDomainClass().Id == global::Tum.TestLanguage.Test.DomainClassId) { models.Add(new PropertyGridTestViewModel(this.Store, modelElement as global::Tum.TestLanguage.Test)); return(true); } else { foreach (DslEditorViewModelData::ViewModelStore eS in this.Store.ExternStores) { if (eS.Factory.AddPropertyEditorViewModels(models, modelElement, handledStores)) { return(true); } } } return(false); }
internal static global::System.Collections.IList GetElementsFromSimboloForSinonimoCompartment(DslModeling::ModelElement rootElement) { global::Maxsys.VisualLAL.Simbolo root = (global::Maxsys.VisualLAL.Simbolo)rootElement; // Segments 0 and 1 DslModeling::LinkedElementCollection <global::Maxsys.VisualLAL.Sinonimo> result = root.Sinonimos; return(result); }
public static void FixUp(DslDiagrams::Diagram diagram, DslModeling::ModelElement existingParent, DslModeling::ModelElement newChild) { if (existingParent == null) { throw new global::System.ArgumentNullException("existingParent"); } if (newChild == null) { throw new global::System.ArgumentNullException("newChild"); } if (!existingParent.IsDeleted && !newChild.IsDeleted) { foreach (var subject in DslModeling::DomainRoleInfo.GetElementLinks <DslDiagrams::PresentationViewsSubject>(existingParent, DslDiagrams::PresentationViewsSubject.SubjectDomainRoleId)) { var l_presentation = subject.Presentation as DslDiagrams::ShapeElement; if (l_presentation != null && l_presentation.Diagram == diagram) { var newChildShape = l_presentation.FixUpChildShapes(newChild); if (newChildShape != null) { var l_diagram = newChildShape.Diagram; if (l_diagram != null && l_diagram == diagram) { l_diagram.FixUpDiagramSelection(newChildShape); } } } } } }
/// <summary> /// This method is called during serialization to convert a given typed value (Double?) to a specific value (string). /// </summary> /// <param name="serializationContext">The current serialization context instance.</param> /// <param name="modelELement">ModdelElement, to which the property belongs to.</param> /// <param name="propertyName">The Property name, which value is to be converted.</param> /// <param name="value">Typed value to convert.</param> /// <param name="sourceType">Type of the value.</param> /// <param name="isRequired">True if this property is marked as required in the domain model. Can be null.</param> /// <returns>Converted value.</returns> public override object ConvertTypedObjectDoubleTo(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement modelELement, string propertyName, object value, System.Type sourceType, bool?isRequired) { if (value != null) { if (value is Double) { return(((Double)value).ToString(System.Globalization.CultureInfo.InvariantCulture)); } } return(""); }
/// <summary> /// Create a shape of the given link shape type. /// </summary> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="modelElement">Model element.</param> /// <param name="sourceShape">Source shape.</param> /// <param name="targetShape">Target shape.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling::ModelElement CreateShapeForElementLink(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, DslModeling::ModelElement sourceShape, DslModeling::ModelElement targetShape, params DslModeling::PropertyAssignment[] assignments) { if (!(sourceShape is DslEditorDiagrams::NodeShape) || !(targetShape is DslEditorDiagrams::NodeShape)) { return(null); } DslEditorDiagrams::LinkShape nodeShape = CreateShapeForElementLink(shapeTypeId, modelElement, assignments) as DslEditorDiagrams::LinkShape; if (nodeShape == null) { return(nodeShape); } nodeShape.SourceAnchor = new DslEditorDiagrams::SourceAnchor(modelElement.Store); nodeShape.SourceAnchor.FromShape = sourceShape as DslEditorDiagrams::NodeShape; nodeShape.TargetAnchor = new DslEditorDiagrams::TargetAnchor(modelElement.Store); nodeShape.TargetAnchor.ToShape = targetShape as DslEditorDiagrams::NodeShape; return(nodeShape); }
public static DslModeling::ElementLink Connect(DslModeling::ModelElement source, DslModeling::ModelElement target) { if (source == null) { throw new global::System.ArgumentNullException("source"); } if (target == null) { throw new global::System.ArgumentNullException("target"); } if (CanAcceptSourceAndTarget(source, target)) { if (source is global::nHydrate.Dsl.Entity) { if (target is global::nHydrate.Dsl.Entity) { global::nHydrate.Dsl.Entity sourceAccepted = (global::nHydrate.Dsl.Entity)source; global::nHydrate.Dsl.Entity targetAccepted = (global::nHydrate.Dsl.Entity)target; DslModeling::ElementLink result = new global::nHydrate.Dsl.EntityHasEntities(sourceAccepted, targetAccepted); if (DslModeling::DomainClassInfo.HasNameProperty(result)) { DslModeling::DomainClassInfo.SetUniqueName(result); } return(result); } } } global::System.Diagnostics.Debug.Fail("Having agreed that the connection can be accepted we should never fail to make one."); throw new global::System.InvalidOperationException(); }
/// <summary> /// Create a shape of the given link shape type. /// </summary> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="modelElement">Model element.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling::ModelElement CreateShapeForElementLink(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { DslEditorDiagrams::LinkShape nodeShape = null; if (createRSShapeMap == null) { createRSShapeMap = new global::System.Collections.Generic.Dictionary <global::System.Guid, int>(2); createRSShapeMap.Add(global::Tum.PDE.ModelingDSL.ReferenceShape.DomainClassId, 0); createRSShapeMap.Add(global::Tum.PDE.ModelingDSL.EmbeddingShape.DomainClassId, 1); } int index; if (!createRSShapeMap.TryGetValue(shapeTypeId, out index)) { throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString()); } switch (index) { case 0: nodeShape = new global::Tum.PDE.ModelingDSL.ReferenceShape(modelElement.Store, assignments); break; case 1: nodeShape = new global::Tum.PDE.ModelingDSL.EmbeddingShape(modelElement.Store, assignments); break; } if (nodeShape == null) { throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for element link " + modelElement.ToString()); } nodeShape.Element = modelElement; return(nodeShape); }
/// <summary> /// Called during view fixup to ask the parent whether a shape should be created for the given child element. /// </summary> /// <remarks> /// Always return true, since we assume there is only one diagram per model file for DSL scenarios. /// </remarks> protected override bool ShouldAddShapeForElement(DslModeling::ModelElement element) { return(true); }
/// <summary> /// Create a dependency shape for the given element type. /// </summary> /// <param name="modelElementTypeId">Model element type.</param> /// <param name="modelElement">Model element.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling::ModelElement CreateDependenciesShapeForElement(System.Guid modelElementTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { System.Guid id; if ((modelElement as DslEditorModeling::DomainModelElement).Store.DomainDataAdvDirectory.ResolveExtensionDirectory <DslEditorDiagrams::DiagramDomainDataDirectory>().ClassShapesDependenciesMapping.TryGetValue(modelElementTypeId, out id)) { return(CreateShapeForElement(id, modelElement, assignments)); } return(null); }
/// <summary> /// Invoked when the Name property of the model element /// is changed. /// </summary> /// <param name="modelElement">Model element being /// changed.</param> private void HandleOrderPropertyChanged(ModelElement modelElement) { var property = modelElement as Property; if (property.AggregateState != null) { global::System.Collections.IEnumerable elements = new DslModeling::ModelElement[] { property.AggregateState }; UpdateCompartments(elements, typeof(global::FourDeep.Dizzle.AggregateStateShape), "Properties", false); } if (property.DomainCommand != null) { global::System.Collections.IEnumerable elements = new DslModeling::ModelElement[] { property.DomainCommand }; UpdateCompartments(elements, typeof(global::FourDeep.Dizzle.DomainCommandShape), "Properties", false); } if (property.DomainEvent != null) { global::System.Collections.IEnumerable elements = new DslModeling::ModelElement[] { property.DomainEvent }; UpdateCompartments(elements, typeof(global::FourDeep.Dizzle.DomainEventShape), "Properties", false); } if (property.Entity != null) { global::System.Collections.IEnumerable elements = new DslModeling::ModelElement[] { property.Entity }; UpdateCompartments(elements, typeof(global::FourDeep.Dizzle.EntityShape), "Properties", false); } if (property.View != null) { global::System.Collections.IEnumerable elements = new DslModeling::ModelElement[] { property.View }; UpdateCompartments(elements, typeof(global::FourDeep.Dizzle.ViewShape), "Properties", false); } }
internal static global::System.Collections.IList GetElementsFromNestedClassForProperties(DslModeling::ModelElement element) { global::Castle.ActiveWriter.NestedClass root = (global::Castle.ActiveWriter.NestedClass)element; // Segments 0 and 1 DslModeling::LinkedElementCollection <global::Castle.ActiveWriter.ModelProperty> result = root.Properties; return(result); }
/// <summary> /// Called to ask the filter if a particular role player should be Visited during traversal /// </summary> /// <param name="walker">ElementWalker that is traversing the model</param> /// <param name="sourceElement">Model Element playing the source role</param> /// <param name="elementLink">Element Link that forms the relationship to the role player in question</param> /// <param name="targetDomainRole">DomainRoleInfo of the target role</param> /// <param name="targetRolePlayer">Model Element that plays the target role in the relationship</param> /// <returns></returns> public virtual DslModeling::VisitorFilterResult ShouldVisitRolePlayer(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::ElementLink elementLink, DslModeling::DomainRoleInfo targetDomainRole, DslModeling::ModelElement targetRolePlayer) { if (targetDomainRole == null) { throw new global::System.ArgumentNullException("targetDomainRole"); } return(this.DomainRoles.Contains(targetDomainRole.Id) ? DslModeling::VisitorFilterResult.Yes : DslModeling::VisitorFilterResult.DoNotCare); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::CodeGeneration.DSL.Class) { if (candidateTarget is global::CodeGeneration.DSL.Class) { global::CodeGeneration.DSL.Class sourceClass = (global::CodeGeneration.DSL.Class)candidateSource; global::CodeGeneration.DSL.Class targetClass = (global::CodeGeneration.DSL.Class)candidateTarget; if (targetClass == null || global::CodeGeneration.DSL.ClassReferencesDerivedClasses.GetLinkToBaseClass(targetClass) != null) { return(false); } if (targetClass == null || sourceClass == null || global::CodeGeneration.DSL.ClassReferencesDerivedClasses.GetLinks(sourceClass, targetClass).Count > 0) { return(false); } return(true); } } } return(false); }
/// <summary> /// Called to ask the filter if a particular role player should be Visited during traversal /// </summary> /// <param name="walker">ElementWalker that is traversing the model</param> /// <param name="sourceElement">Model Element playing the source role</param> /// <param name="elementLink">Element Link that forms the relationship to the role player in question</param> /// <param name="targetDomainRole">DomainRoleInfo of the target role</param> /// <param name="targetRolePlayer">Model Element that plays the target role in the relationship</param> /// <returns></returns> public virtual DslModeling::VisitorFilterResult ShouldVisitRolePlayer(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::ElementLink elementLink, DslModeling::DomainRoleInfo targetDomainRole, DslModeling::ModelElement targetRolePlayer) { return(this.DomainRoles.ContainsKey(targetDomainRole.Id) ? DslModeling::VisitorFilterResult.Yes : DslModeling::VisitorFilterResult.DoNotCare); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType) { if (candidateTarget is global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType) { global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType sourceEntityType = (global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)candidateSource; global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType targetEntityType = (global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.EntityType)candidateTarget; if (targetEntityType == null || global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.GetLinkToBaseType(targetEntityType) != null) { return(false); } if (targetEntityType == null || sourceEntityType == null || global::Microsoft.Data.Entity.Design.EntityDesigner.ViewModel.Inheritance.GetLinks(sourceEntityType, targetEntityType).Count > 0) { return(false); } return(true); } } } return(false); }