예제 #1
0
        /// <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.FamilyTreeDSL.FamilyTreePerson.DomainClassId)
            {
                models.Add(new PropertyGridFamilyTreePersonViewModel(this.Store, modelElement as global::Tum.FamilyTreeDSL.FamilyTreePerson));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.FamilyTreeDSL.ParentOf.DomainClassId)
            {
                models.Add(new PropertyGridParentOfViewModel(this.Store, modelElement as global::Tum.FamilyTreeDSL.ParentOf));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.FamilyTreeDSL.MarriedTo.DomainClassId)
            {
                models.Add(new PropertyGridMarriedToViewModel(this.Store, modelElement as global::Tum.FamilyTreeDSL.MarriedTo));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.FamilyTreeDSL.Person.DomainClassId)
            {
                models.Add(new PropertyGridPersonViewModel(this.Store, modelElement as global::Tum.FamilyTreeDSL.Person));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.FamilyTreeDSL.Pet.DomainClassId)
            {
                models.Add(new PropertyGridPetViewModel(this.Store, modelElement as global::Tum.FamilyTreeDSL.Pet));
                return(true);
            }
            else
            {
                foreach (DslEditorViewModelData::ViewModelStore eS in this.Store.ExternStores)
                {
                    if (eS.Factory.AddPropertyEditorViewModels(models, modelElement, handledStores))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <summary>
        /// Method to supply the name for ModelElementTreeNode object in the TreeView.
        /// </summary>
        /// <param name="modelElement">Element to be displayed in the tree node</param>
        /// <returns>Name shown in the Model Explorer</returns>
        private string GetModelElementDisplayName(DslModeling::ModelElement modelElement)
        {
            string treeNodeDisplayName = null;
            DslModeling::DomainDataDirectory directory          = modelElement.Store.DomainDataDirectory;
            DslModeling::DomainPropertyInfo  domainPropertyInfo = null;
            DslModeling::ModelElement        redirectedElement  = null;

            switch (modelElement.GetDomainClass().Id.ToString("D", System.Globalization.CultureInfo.InvariantCulture))
            {
            case "e2c13b26-0944-4b6c-89b5-bb95c500f515":                // Comment.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Sawczyn.EFDesigner.EFModel.Comment.ShortTextDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;
            }

            if (domainPropertyInfo != null && redirectedElement != null)
            {
                // Get the name based on the designated domian property
                treeNodeDisplayName = domainPropertyInfo.GetValue(redirectedElement) as string;
            }
            else
            {
                // The passed in modelElement does not have a DomainPath specified. Try access the default name from the element.
                DslModeling::DomainClassInfo.TryGetName(modelElement, out treeNodeDisplayName);
            }
            return(treeNodeDisplayName);
        }
예제 #4
0
        /// <summary>
        /// Method to supply the name for ModelElementTreeNode object in the TreeView.
        /// </summary>
        /// <param name="modelElement">Element to be displayed in the tree node</param>
        /// <returns>Name shown in the Model Explorer</returns>
        private string GetModelElementDisplayName(DslModeling::ModelElement modelElement)
        {
            string treeNodeDisplayName = null;
            DslModeling::DomainDataDirectory directory          = modelElement.Store.DomainDataDirectory;
            DslModeling::DomainPropertyInfo  domainPropertyInfo = null;
            DslModeling::ModelElement        redirectedElement  = null;

            switch (modelElement.GetDomainClass().Id.ToString("D", System.Globalization.CultureInfo.InvariantCulture))
            {
            case "6881cfb0-e300-4d8b-8343-e1824c44c35a":                        // DomainType.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::TXSoftware.DataObjectsNetEntityModel.Dsl.DomainType.FullNameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;
            }

            if (domainPropertyInfo != null && redirectedElement != null)
            {
                // Get the name based on the designated domian property
                treeNodeDisplayName = domainPropertyInfo.GetValue(redirectedElement) as string;
            }
            else
            {
                // The passed in modelElement does not have a DomainPath specified. Try access the default name from the element.
                DslModeling::DomainClassInfo.TryGetName(modelElement, out treeNodeDisplayName);
            }
            return(treeNodeDisplayName);
        }
예제 #5
0
        /// <summary>
        /// Method to supply the name for ModelElementTreeNode object in the TreeView.
        /// </summary>
        /// <param name="modelElement">Element to be displayed in the tree node</param>
        /// <returns>Name shown in the Model Explorer</returns>
        private string GetModelElementDisplayName(DslModeling::ModelElement modelElement)
        {
            string treeNodeDisplayName = null;
            DslModeling::DomainDataDirectory directory          = modelElement.Store.DomainDataDirectory;
            DslModeling::DomainPropertyInfo  domainPropertyInfo = null;
            DslModeling::ModelElement        redirectedElement  = null;

            switch (modelElement.GetDomainClass().Id.ToString("D", System.Globalization.CultureInfo.InvariantCulture))
            {
            case "3d71fb67-1375-4f99-8206-12a78e514a4a":                        // AggregateIdentifier.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::CQRSAzure.CQRSdsl.Dsl.AggregateIdentifier.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "a88729a0-1121-458a-b5c7-32ef0714b62a":                        // EventDefinition.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::CQRSAzure.CQRSdsl.Dsl.EventDefinition.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "feed9883-9553-42cc-8b70-12dcd5032804":                        // CommandDefinition.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::CQRSAzure.CQRSdsl.Dsl.CommandDefinition.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "a506bd6f-43f3-44ea-b88e-66d3aaa85077":                        // ProjectionDefinition.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::CQRSAzure.CQRSdsl.Dsl.ProjectionDefinition.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "4b891bb8-8eb6-41d0-8d6a-79125b91b74b":                        // QueryDefinition.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::CQRSAzure.CQRSdsl.Dsl.QueryDefinition.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;
            }

            if (domainPropertyInfo != null && redirectedElement != null)
            {
                // Get the name based on the designated domian property
                treeNodeDisplayName = domainPropertyInfo.GetValue(redirectedElement) as string;
            }
            else
            {
                // The passed in modelElement does not have a DomainPath specified. Try access the default name from the element.
                DslModeling::DomainClassInfo.TryGetName(modelElement, out treeNodeDisplayName);
            }
            return(treeNodeDisplayName);
        }
예제 #6
0
        /// <summary>
        /// Method to supply the name for ModelElementTreeNode object in the TreeView.
        /// </summary>
        /// <param name="modelElement">Element to be displayed in the tree node</param>
        /// <returns>Name shown in the Model Explorer</returns>
        private string GetModelElementDisplayName(DslModeling::ModelElement modelElement)
        {
            string treeNodeDisplayName = null;
            DslModeling::DomainDataDirectory directory          = modelElement.Store.DomainDataDirectory;
            DslModeling::DomainPropertyInfo  domainPropertyInfo = null;
            DslModeling::ModelElement        redirectedElement  = null;

            switch (modelElement.GetDomainClass().Id.ToString("D", System.Globalization.CultureInfo.InvariantCulture))
            {
            case "eaad73c4-a652-4596-b575-39e82c2f525a":                        // Concept.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Bb.ApplicationCooperationViewPoint.Concept.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "3aba6490-0175-4397-b4b4-8ba4dd8df1d1":                        // ConceptElement.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Bb.ApplicationCooperationViewPoint.ConceptElement.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "a3a13452-14ee-4fe8-adcb-fd5c2f06ff68":                        // ConceptSubElement.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Bb.ApplicationCooperationViewPoint.ConceptSubElement.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "403a7c63-3a36-4881-b0d5-0eaf0dcad50e":                        // ModelElement.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Bb.ApplicationCooperationViewPoint.ModelElement.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "e39ae37f-7927-4be7-a99c-94d0deb846f7":                        // SubElement.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::Bb.ApplicationCooperationViewPoint.SubElement.NameDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;
            }

            if (domainPropertyInfo != null && redirectedElement != null)
            {
                // Get the name based on the designated domian property
                treeNodeDisplayName = domainPropertyInfo.GetValue(redirectedElement) as string;
            }
            else
            {
                // The passed in modelElement does not have a DomainPath specified. Try access the default name from the element.
                DslModeling::DomainClassInfo.TryGetName(modelElement, out treeNodeDisplayName);
            }
            return(treeNodeDisplayName);
        }
예제 #7
0
        /// <summary>
        /// Method to supply the name for ModelElementTreeNode object in the TreeView.
        /// </summary>
        /// <param name="modelElement">Element to be displayed in the tree node</param>
        /// <returns>Name shown in the Model Explorer</returns>
        private string GetModelElementDisplayName(DslModeling::ModelElement modelElement)
        {
            string treeNodeDisplayName = null;
            DslModeling::DomainDataDirectory directory          = modelElement.Store.DomainDataDirectory;
            DslModeling::DomainPropertyInfo  domainPropertyInfo = null;
            DslModeling::ModelElement        redirectedElement  = null;

            switch (modelElement.GetDomainClass().Id.ToString("D", System.Globalization.CultureInfo.InvariantCulture))
            {
            case "8022b63d-c856-4a0e-9881-c24888e718c5":                        // EntityMetadata.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::nHydrate.Dsl.EntityMetadata.KeyDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "e4d98918-02cc-4cb0-94fc-2da89080f5be":                        // FieldMetadata.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::nHydrate.Dsl.FieldMetadata.KeyDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "ced4ceba-e07d-4396-b2fe-a981c60933d0":                        // Index.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::nHydrate.Dsl.Index.DefinitionDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;

            case "06e94c72-d866-4c92-b5a9-624fdbebdf9e":                        // IndexColumn.DomainClassId
            {
                domainPropertyInfo = directory.FindDomainProperty(global::nHydrate.Dsl.IndexColumn.DefinitionDomainPropertyId);
                redirectedElement  = modelElement;
            }
            break;
            }

            if (domainPropertyInfo != null && redirectedElement != null)
            {
                // Get the name based on the designated domian property
                treeNodeDisplayName = domainPropertyInfo.GetValue(redirectedElement) as string;
            }
            else
            {
                // The passed in modelElement does not have a DomainPath specified. Try access the default name from the element.
                DslModeling::DomainClassInfo.TryGetName(modelElement, out treeNodeDisplayName);
            }
            return(treeNodeDisplayName);
        }
예제 #8
0
        /// <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);
        }
예제 #9
0
        /// <summary>
        /// Read an element from the root of XML.
        /// </summary>
        /// <param name="serializationContext">Serialization context.</param>
        /// <param name="rootElement">In-memory element instance that will get the deserialized data.</param>
        /// <param name="reader">XmlReader to read serialized data from.</param>
        /// <param name="schemaResolver">An ISchemaResolver that allows the serializer to do schema validation on the root element (and everything inside it).</param>
        protected override void ReadRootElement(DslModeling::SerializationContext serializationContext, DslModeling::ModelElement rootElement, global::System.Xml.XmlReader reader, DslModeling::ISchemaResolver schemaResolver)
        {
            #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(reader != null);
            if (reader == null)
            {
                throw new global::System.ArgumentNullException("reader");
            }
            #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 + @"!");

            // Version check.
            this.CheckVersion(serializationContext, reader);

            if (!serializationContext.Result.Failed)
            {
                // Use a validating reader if possible
                using (reader = TryCreateValidatingReader(schemaResolver, reader, serializationContext))
                {
                    rootSerializer.Read(serializationContext, rootElement, reader);
                }
            }
        }
예제 #10
0
        private void WriteChildElementsExtended(DslModeling::SerializationContext serializationContext, MetaModel element, global::System.Xml.XmlWriter writer)
        {
            // MetaModelHasDomainTypes
            global::System.Collections.ObjectModel.ReadOnlyCollection <MetaModelHasDomainTypes> allMetaModelHasDomainTypesInstances = MetaModelHasDomainTypes.GetLinksToDomainTypes(element);
            if (!serializationContext.Result.Failed && allMetaModelHasDomainTypesInstances.Count > 0)
            {
                writer.WriteStartElement("domainTypes");
                global::System.Type typeofMetaModelHasDomainTypes = typeof(MetaModelHasDomainTypes);
                foreach (MetaModelHasDomainTypes eachMetaModelHasDomainTypesInstance in allMetaModelHasDomainTypesInstances)
                {
                    if (serializationContext.Result.Failed)
                    {
                        break;
                    }

                    if (eachMetaModelHasDomainTypesInstance.GetType() != typeofMetaModelHasDomainTypes)
                    {                           // Derived relationships will be serialized in full-form.
                        DslModeling::DomainClassXmlSerializer derivedRelSerializer = serializationContext.Directory.GetSerializer(eachMetaModelHasDomainTypesInstance.GetDomainClass().Id);
                        global::System.Diagnostics.Debug.Assert(derivedRelSerializer != null, "Cannot find serializer for " + eachMetaModelHasDomainTypesInstance.GetDomainClass().Name + "!");
                        derivedRelSerializer.Write(serializationContext, eachMetaModelHasDomainTypesInstance, writer);
                    }
                    else
                    {                           // No need to serialize the relationship itself, just serialize the role-player directly.
                        DslModeling::ModelElement             targetElement    = eachMetaModelHasDomainTypesInstance.DomainType;
                        DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
                        global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");
                        targetSerializer.Write(serializationContext, targetElement, writer);
                    }
                }
                writer.WriteEndElement();
            }

            // MetaModelHasValidation
            MetaModelHasValidation theMetaModelHasValidationInstance = MetaModelHasValidation.GetLinkToValidation(element);

            if (!serializationContext.Result.Failed && theMetaModelHasValidationInstance != null)
            {
                writer.WriteStartElement("validation");
                DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theMetaModelHasValidationInstance.GetDomainClass().Id);
                global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theMetaModelHasValidationInstance.GetDomainClass().Name + "!");
                relSerializer.Write(serializationContext, theMetaModelHasValidationInstance, writer);
                writer.WriteEndElement();
            }

            // MetaModelHasAdditionalInformation
            MetaModelHasAdditionalInformation theMetaModelHasAdditionalInformationInstance = MetaModelHasAdditionalInformation.GetLinkToAdditionalInformation(element);

            if (!serializationContext.Result.Failed && theMetaModelHasAdditionalInformationInstance != null)
            {
                writer.WriteStartElement("additionalInformation");
                DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theMetaModelHasAdditionalInformationInstance.GetDomainClass().Id);
                global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theMetaModelHasAdditionalInformationInstance.GetDomainClass().Name + "!");
                relSerializer.Write(serializationContext, theMetaModelHasAdditionalInformationInstance, writer);
                writer.WriteEndElement();
            }

            // MetaModelHasMetaModelLibraries
            global::System.Collections.ObjectModel.ReadOnlyCollection <MetaModelHasMetaModelLibraries> allMetaModelHasMetaModelLibrariesInstances = MetaModelHasMetaModelLibraries.GetLinksToMetaModelLibraries(element);
            if (!serializationContext.Result.Failed && allMetaModelHasMetaModelLibrariesInstances.Count > 0)
            {
                writer.WriteStartElement("metaModelLibraries");
                foreach (MetaModelHasMetaModelLibraries eachMetaModelHasMetaModelLibrariesInstance in allMetaModelHasMetaModelLibrariesInstances)
                {
                    if (serializationContext.Result.Failed)
                    {
                        break;
                    }

                    DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachMetaModelHasMetaModelLibrariesInstance.GetDomainClass().Id);
                    global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachMetaModelHasMetaModelLibrariesInstance.GetDomainClass().Name + "!");
                    relSerializer.Write(serializationContext, eachMetaModelHasMetaModelLibrariesInstance, writer);
                }
                writer.WriteEndElement();
            }

            /*
             *          // MetaModelHasView
             *          MetaModelHasView theMetaModelHasViewInstance = MetaModelHasView.GetLinkToView(element);
             *          if (!serializationContext.Result.Failed && theMetaModelHasViewInstance != null)
             *          {
             *                  DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(theMetaModelHasViewInstance.GetDomainClass().Id);
             *                  global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + theMetaModelHasViewInstance.GetDomainClass().Name + "!");
             *                  relSerializer.Write(serializationContext, theMetaModelHasViewInstance, writer);
             *          }*/

            // MetaModelHasModelContexts
            global::System.Collections.ObjectModel.ReadOnlyCollection <MetaModelHasModelContexts> allMetaModelHasModelContextsInstances = MetaModelHasModelContexts.GetLinksToModelContexts(element);
            if (!serializationContext.Result.Failed && allMetaModelHasModelContextsInstances.Count > 0)
            {
                writer.WriteStartElement("modelContexts");
                foreach (MetaModelHasModelContexts eachMetaModelHasModelContextsInstance in allMetaModelHasModelContextsInstances)
                {
                    if (serializationContext.Result.Failed)
                    {
                        break;
                    }

                    DslModeling::DomainClassXmlSerializer relSerializer = serializationContext.Directory.GetSerializer(eachMetaModelHasModelContextsInstance.GetDomainClass().Id);
                    global::System.Diagnostics.Debug.Assert(relSerializer != null, "Cannot find serializer for " + eachMetaModelHasModelContextsInstance.GetDomainClass().Name + "!");
                    relSerializer.Write(serializationContext, eachMetaModelHasModelContextsInstance, writer);
                }
                writer.WriteEndElement();
            }

            // MetaModelHasPropertyGridEditors
            global::System.Collections.ObjectModel.ReadOnlyCollection <MetaModelHasPropertyGridEditors> allMetaModelHasPropertyGridEditorsInstances = MetaModelHasPropertyGridEditors.GetLinksToPropertyGridEditors(element);
            if (!serializationContext.Result.Failed && allMetaModelHasPropertyGridEditorsInstances.Count > 0)
            {
                writer.WriteStartElement("propertyGridEditors");
                global::System.Type typeofMetaModelHasPropertyGridEditors = typeof(MetaModelHasPropertyGridEditors);
                foreach (MetaModelHasPropertyGridEditors eachMetaModelHasPropertyGridEditorsInstance in allMetaModelHasPropertyGridEditorsInstances)
                {
                    if (serializationContext.Result.Failed)
                    {
                        break;
                    }

                    if (eachMetaModelHasPropertyGridEditorsInstance.GetType() != typeofMetaModelHasPropertyGridEditors)
                    {                           // Derived relationships will be serialized in full-form.
                        DslModeling::DomainClassXmlSerializer derivedRelSerializer = serializationContext.Directory.GetSerializer(eachMetaModelHasPropertyGridEditorsInstance.GetDomainClass().Id);
                        global::System.Diagnostics.Debug.Assert(derivedRelSerializer != null, "Cannot find serializer for " + eachMetaModelHasPropertyGridEditorsInstance.GetDomainClass().Name + "!");
                        derivedRelSerializer.Write(serializationContext, eachMetaModelHasPropertyGridEditorsInstance, writer);
                    }
                    else
                    {                           // No need to serialize the relationship itself, just serialize the role-player directly.
                        DslModeling::ModelElement             targetElement    = eachMetaModelHasPropertyGridEditorsInstance.PropertyGridEditor;
                        DslModeling::DomainClassXmlSerializer targetSerializer = serializationContext.Directory.GetSerializer(targetElement.GetDomainClass().Id);
                        global::System.Diagnostics.Debug.Assert(targetSerializer != null, "Cannot find serializer for " + targetElement.GetDomainClass().Name + "!");
                        targetSerializer.Write(serializationContext, targetElement, writer);
                    }
                }
                writer.WriteEndElement();
            }
        }
예제 #11
0
        /// <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.VModellXT.VModellvariante.DomainClassId)
            {
                models.Add(new PropertyGridVModellvarianteViewModel(this.Store, modelElement as global::Tum.VModellXT.VModellvariante));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.VModell.DomainClassId)
            {
                models.Add(new PropertyGridVModellViewModel(this.Store, modelElement as global::Tum.VModellXT.VModell));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.ReferenzmodellReferencesVModellvariante.DomainClassId)
            {
                models.Add(new PropertyGridReferenzmodellReferencesVModellvarianteViewModel(this.Store, modelElement as global::Tum.VModellXT.ReferenzmodellReferencesVModellvariante));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Variante.DomainClassId)
            {
                models.Add(new PropertyGridVarianteViewModel(this.Store, modelElement as global::Tum.VModellXT.Variante));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.ThemenmusterReferencesThema.DomainClassId)
            {
                models.Add(new PropertyGridThemenmusterReferencesThemaViewModel(this.Store, modelElement as global::Tum.VModellXT.ThemenmusterReferencesThema));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.VarianteSourceReferencesVarianteTarget.DomainClassId)
            {
                models.Add(new PropertyGridVarianteSourceReferencesVarianteTargetViewModel(this.Store, modelElement as global::Tum.VModellXT.VarianteSourceReferencesVarianteTarget));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.ThemenmusterReferencesUnterthema.DomainClassId)
            {
                models.Add(new PropertyGridThemenmusterReferencesUnterthemaViewModel(this.Store, modelElement as global::Tum.VModellXT.ThemenmusterReferencesUnterthema));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Zusatzthema.DomainClassId)
            {
                models.Add(new PropertyGridZusatzthemaViewModel(this.Store, modelElement as global::Tum.VModellXT.Zusatzthema));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Musterbibliothek.DomainClassId)
            {
                models.Add(new PropertyGridMusterbibliothekViewModel(this.Store, modelElement as global::Tum.VModellXT.Musterbibliothek));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Referenzmodell.DomainClassId)
            {
                models.Add(new PropertyGridReferenzmodellViewModel(this.Store, modelElement as global::Tum.VModellXT.Referenzmodell));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Mustergruppe.DomainClassId)
            {
                models.Add(new PropertyGridMustergruppeViewModel(this.Store, modelElement as global::Tum.VModellXT.Mustergruppe));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Mustertext.DomainClassId)
            {
                models.Add(new PropertyGridMustertextViewModel(this.Store, modelElement as global::Tum.VModellXT.Mustertext));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.VModellXT.Themenmuster.DomainClassId)
            {
                models.Add(new PropertyGridThemenmusterViewModel(this.Store, modelElement as global::Tum.VModellXT.Themenmuster));
                return(true);
            }
            else
            {
                foreach (DslEditorViewModelData::ViewModelStore eS in this.Store.ExternStores)
                {
                    if (eS.Factory.AddPropertyEditorViewModels(models, modelElement, handledStores))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #12
0
        /// <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.PDE.ModelingDSL.DomainElement.DomainClassId)
            {
                models.Add(new PropertyGridDomainElementViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DomainElement));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.ReferencingDRType.DomainClassId)
            {
                models.Add(new PropertyGridReferencingDRTypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.ReferencingDRType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.EmbeddingDRType.DomainClassId)
            {
                models.Add(new PropertyGridEmbeddingDRTypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.EmbeddingDRType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DEType.DomainClassId)
            {
                models.Add(new PropertyGridDETypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DEType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.ReferenceRelationship.DomainClassId)
            {
                models.Add(new PropertyGridReferenceRelationshipViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.ReferenceRelationship));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.EmbeddingRelationship.DomainClassId)
            {
                models.Add(new PropertyGridEmbeddingRelationshipViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.EmbeddingRelationship));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.ExternalType.DomainClassId)
            {
                models.Add(new PropertyGridExternalTypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.ExternalType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DomainEnumeration.DomainClassId)
            {
                models.Add(new PropertyGridDomainEnumerationViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DomainEnumeration));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DomainElementReferencesDEType.DomainClassId)
            {
                models.Add(new PropertyGridDomainElementReferencesDETypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DomainElementReferencesDEType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DomainPropertyReferencesDomainType.DomainClassId)
            {
                models.Add(new PropertyGridDomainPropertyReferencesDomainTypeViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DomainPropertyReferencesDomainType));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DRTypeReferencesDETypeTarget.DomainClassId)
            {
                models.Add(new PropertyGridDRTypeReferencesDETypeTargetViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DRTypeReferencesDETypeTarget));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DRTypeReferencesDETypeSource.DomainClassId)
            {
                models.Add(new PropertyGridDRTypeReferencesDETypeSourceViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DRTypeReferencesDETypeSource));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DRTypeReferencesBaseElementSourceReferencesBaseElementTarget.DomainClassId)
            {
                models.Add(new PropertyGridDRTypeReferencesBaseElementSourceReferencesBaseElementTargetViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DRTypeReferencesBaseElementSourceReferencesBaseElementTarget));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.DomainProperty.DomainClassId)
            {
                models.Add(new PropertyGridDomainPropertyViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.DomainProperty));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.EnumerationLiteral.DomainClassId)
            {
                models.Add(new PropertyGridEnumerationLiteralViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.EnumerationLiteral));
                return(true);
            }
            else if (modelElement.GetDomainClass().Id == global::Tum.PDE.ModelingDSL.ConversionModelInfo.DomainClassId)
            {
                models.Add(new PropertyGridConversionModelInfoViewModel(this.Store, modelElement as global::Tum.PDE.ModelingDSL.ConversionModelInfo));
                return(true);
            }
            else
            {
                foreach (DslEditorViewModelData::ViewModelStore eS in this.Store.ExternStores)
                {
                    if (eS.Factory.AddPropertyEditorViewModels(models, modelElement, handledStores))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }