Ejemplo n.º 1
0
        private static void SetRightRelationship(Relationship sh, DslModeling.ModelElement element)
        {
            if (element is Concept co)
            {
                sh.RightConcept = co;
            }

            else if (element is ConceptElement ce)
            {
                sh.RightConceptElement = ce;
            }

            else if (element is ConceptSubElement cse)
            {
                sh.RightConceptSubElement = cse;
            }

            else if (element is ModelElement me)
            {
                sh.RightModelElement = me;
            }

            else if (element is SubElement se)
            {
                sh.RightSubElement = se;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This methods serializes 1) properties serialized as nested XML elements and 2) child model elements into XML.
 /// </summary>
 /// <param name="serializationContext">Serialization context.</param>
 /// <param name="element">NodeShape instance to be serialized.</param>
 /// <param name="writer">XmlWriter to write serialized data to.</param>
 protected override void WriteElements(DslModeling.SerializationContext serializationContext, DslModeling.ModelElement element, System.Xml.XmlWriter writer)
 {
     base.WriteElements(serializationContext, element, writer);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This methods deserializes nested XML elements inside the passed-in element.
        /// </summary>
        /// <remarks>
        /// The caller will guarantee that the current element does have nested XML elements, and the call will position the
        /// reader at the open tag of the first child XML element.
        /// This method will read as many child XML elements as it can. It returns under three circumstances:
        /// 1) When an unknown child XML element is encountered. In this case, this method will position the reader at the open
        ///    tag of the unknown element. This implies that if the first child XML element is unknown, this method should return
        ///    immediately and do nothing.
        /// 2) When all child XML elemnets are read. In this case, the reader will be positioned at the end tag of the parent element.
        /// 3) EOF.
        /// </remarks>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="element">In-memory NodeShape instance that will get the deserialized data.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        protected override void ReadElements(DslModeling.SerializationContext serializationContext, DslModeling.ModelElement element, System.Xml.XmlReader reader)
        {
            base.ReadElements(serializationContext, element, reader);

            while (!serializationContext.Result.Failed && !reader.EOF && reader.NodeType == global::System.Xml.XmlNodeType.Element)
            {
                switch (reader.LocalName)
                {
                default:
                    return;                              // Don't know this element.
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// This method deserializes all properties that are serialized as XML attributes.
 /// </summary>
 /// <remarks>
 /// Because this method only handles properties serialized as XML attributes, the passed-in reader shouldn't be moved inside this method.
 /// The caller will guarantee that the reader is positioned on the open XML tag of the current element being deserialized.
 /// </remarks>
 /// <param name="serializationContext">Serialization context.</param>
 /// <param name="element">In-memory NodeShape instance that will get the deserialized data.</param>
 /// <param name="reader">XmlReader to read serialized data from.</param>
 protected override void ReadPropertiesFromAttributes(DslModeling.SerializationContext serializationContext, DslModeling.ModelElement element, System.Xml.XmlReader reader)
 {
     base.ReadPropertiesFromAttributes(serializationContext, element, reader);
 }
Ejemplo n.º 5
0
 public static global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement GetLink(global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShape source, global::Microsoft.VisualStudio.Modeling.ModelElement target)
 {
     global::System.Collections.Generic.IList <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement> links = DslModeling::DomainRoleInfo.GetElementLinks <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement>(source, global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement.ExtendedElementDomainRoleId);
     foreach (global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement link in links)
     {
         if (target.Equals(link.Extension))
         {
             return(link);
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
 public static global::System.Collections.ObjectModel.ReadOnlyCollection <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement> GetLinks(global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShape source, global::Microsoft.VisualStudio.Modeling.ModelElement target)
 {
     global::System.Collections.Generic.List <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement>  outLinks = new global::System.Collections.Generic.List <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement>();
     global::System.Collections.Generic.IList <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement> links    = DslModeling::DomainRoleInfo.GetElementLinks <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement>(source, global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement.ExtendedElementDomainRoleId);
     foreach (global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement link in links)
     {
         if (target.Equals(link.Extension))
         {
             outLinks.Add(link);
         }
     }
     return(outLinks.AsReadOnly());
 }
Ejemplo n.º 7
0
 public static global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement GetLinkToExtendedElement(global::Microsoft.VisualStudio.Modeling.ModelElement extensionInstance)
 {
     global::System.Collections.Generic.IList <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement> links = DslModeling::DomainRoleInfo.GetElementLinks <global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement>(extensionInstance, global::ORMSolutions.ORMArchitect.Core.ShapeModel.ORMBaseShapeHasExtensionElement.ExtensionDomainRoleId);
     global::System.Diagnostics.Debug.Assert(links.Count <= 1, "Multiplicity of Extension not obeyed.");
     if (links.Count == 0)
     {
         return(null);
     }
     else
     {
         return(links[0]);
     }
 }
Ejemplo n.º 8
0
 public static void SetExtendedElement(global::Microsoft.VisualStudio.Modeling.ModelElement element, ORMBaseShape newExtendedElement)
 {
     DslModeling::DomainRoleInfo.SetLinkedElement(element, ExtensionDomainRoleId, newExtendedElement);
 }
Ejemplo n.º 9
0
 public static ORMBaseShape GetExtendedElement(global::Microsoft.VisualStudio.Modeling.ModelElement element)
 {
     return(DslModeling::DomainRoleInfo.GetLinkedElement(element, ExtensionDomainRoleId) as ORMBaseShape);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// Creates a ORMBaseShapeHasExtensionElement link in the same Partition as the given ORMBaseShape
 /// </summary>
 /// <param name="source">ORMBaseShape to use as the source of the relationship.</param>
 /// <param name="target">ModelElement to use as the target of the relationship.</param>
 public ORMBaseShapeHasExtensionElement(ORMBaseShape source, global::Microsoft.VisualStudio.Modeling.ModelElement target)
     : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[] { new DslModeling::RoleAssignment(ORMBaseShapeHasExtensionElement.ExtendedElementDomainRoleId, source), new DslModeling::RoleAssignment(ORMBaseShapeHasExtensionElement.ExtensionDomainRoleId, target) }, null)
 {
 }
Ejemplo n.º 11
0
        static string GetDisplayPropertyFromDomainCommandForProperties(DslModeling.ModelElement element)
        {
            global::FourDeep.PDizzle.Property root = (global::FourDeep.PDizzle.Property)element;

            return(root.Order + " " + root.Name + " : " + (string.IsNullOrEmpty(root.Namespace) ? "" : root.Namespace + ".") + root.Type);
        }
Ejemplo n.º 12
0
 protected override void OnCopy(DslModeling.ModelElement sourceElement)
 {
     base.OnCopy(sourceElement);
 }
Ejemplo n.º 13
0
 private bool ShouldRaiseInstantiate(DslModeling.ModelElement element)
 {
     return(!this.Store.PropertyBag.ContainsKey(element));
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Write extension element data inside the current XML element.
        /// </summary>
        /// <param name="serializationContext">The current serialization context instance.</param>
        /// <param name="element">The element whose attributes have just been written.</param>
        /// <param name="writer">XmlWriter to write serialized data to.</param>
        /// <remarks>The default implemenation is to write out all non-embedded extension elements,
        /// regardless of whether they relate to the current element or not.
        /// The additional data should be written as a series of one or more
        /// XML elements.</remarks>
        protected internal override void WriteExtensions(DslModeling.SerializationContext serializationContext, DslModeling.ModelElement element, XmlWriter writer)
        {
            Guard.NotNull(() => serializationContext, serializationContext);
            Guard.NotNull(() => element, element);
            Guard.NotNull(() => writer, writer);

            if (!(element is PatternModelSchemaDiagram))
            {
                var allExtensionElements          = element.Partition.ElementDirectory.FindElements(DslModeling.ExtensionElement.DomainClassId, true);
                var nonEmbeddedExtensionsElements =
                    allExtensionElements.Where(e => DslModeling.DomainClassInfo.FindEmbeddingElementLink(e) == null).OfType <DslModeling.ExtensionElement>();

                DslModeling.SerializationUtilities.WriteExtensions(serializationContext, writer, nonEmbeddedExtensionsElements);
            }
        }