/// <summary> /// Called by the Merge process to create a relationship between /// this target element and the specified source element. /// Typically, a parent-child relationship is established /// between the target element (the parent) and the source element /// (the child), but any relationship can be established. /// </summary> /// <param name="sourceElement">The element that is to be related to this model element.</param> /// <param name="elementGroup">The group of source ModelElements that have been rehydrated into the target store.</param> /// <remarks> /// This method is overriden to create the relationship between the target element and the specified source element. /// The base method does nothing. /// </remarks> protected override void MergeRelate(DslModeling::ModelElement sourceElement, DslModeling::ElementGroup elementGroup) { // In general, sourceElement is allowed to be null, meaning that the elementGroup must be parsed for special cases. // However this is not supported in generated code. Use double-deriving on this class and then override MergeRelate completely if you // need to support this case. if (sourceElement == null) { throw new global::System.ArgumentNullException("sourceElement"); } global::ORMSolutions.ORMArchitect.ORMAbstraction.InformationTypeFormat sourceInformationTypeFormat1 = sourceElement as global::ORMSolutions.ORMArchitect.ORMAbstraction.InformationTypeFormat; if (sourceInformationTypeFormat1 != null) { // Create link for path AbstractionModelHasInformationTypeFormat.InformationTypeFormatCollection this.InformationTypeFormatCollection.Add(sourceInformationTypeFormat1); return; } global::ORMSolutions.ORMArchitect.ORMAbstraction.ConceptType sourceConceptType2 = sourceElement as global::ORMSolutions.ORMArchitect.ORMAbstraction.ConceptType; if (sourceConceptType2 != null) { // Create link for path AbstractionModelHasConceptType.ConceptTypeCollection this.ConceptTypeCollection.Add(sourceConceptType2); return; } // Sdk workaround to runtime bug #879350 (DSL: can't copy and paste a MEL that has a MEX). Avoid MergeRelate on ModelElementExtension // during a "Paste". if (sourceElement is DslModeling::ExtensionElement && sourceElement.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo.ContainsKey("{9DAFD42A-DC0E-4d78-8C3F-8266B2CF8B33}")) { return; } // Fall through to base class if this class hasn't handled the merge. base.MergeRelate(sourceElement, elementGroup); }
/// <summary> /// Called by the Merge process to create a relationship between /// this target element and the specified source element. /// Typically, a parent-child relationship is established /// between the target element (the parent) and the source element /// (the child), but any relationship can be established. /// </summary> /// <param name="sourceElement">The element that is to be related to this model element.</param> /// <param name="elementGroup">The group of source ModelElements that have been rehydrated into the target store.</param> /// <remarks> /// This method is overriden to create the relationship between the target element and the specified source element. /// The base method does nothing. /// </remarks> protected override void MergeRelate(DslModeling::ModelElement sourceElement, DslModeling::ElementGroup elementGroup) { // In general, sourceElement is allowed to be null, meaning that the elementGroup must be parsed for special cases. // However this is not supported in generated code. Use double-deriving on this class and then override MergeRelate completely if you // need to support this case. if (sourceElement == null) { throw new global::System.ArgumentNullException("sourceElement"); } global::CompanyName.LanguageSm.ExampleElement sourceExampleElement1 = sourceElement as global::CompanyName.LanguageSm.ExampleElement; if (sourceExampleElement1 != null) { // Create link for path ExampleModelHasElements.Elements this.Elements.Add(sourceExampleElement1); return; } // Fall through to base class if this class hasn't handled the merge. base.MergeRelate(sourceElement, elementGroup); }
/// <summary> /// Creates an ElementGroupPrototype for the element tool corresponding to the given domain class id. /// Default behavior is to create a prototype containing an instance of the domain class. /// Derived classes may override this to add additional information to the prototype. /// </summary> protected virtual DslModeling::ElementGroupPrototype CreateElementToolPrototype(DslModeling::Store store, global::System.Guid domainClassId) { DslModeling::ModelElement element = store.ElementFactory.CreateElement(domainClassId); DslModeling::ElementGroup elementGroup = new DslModeling::ElementGroup(store.DefaultPartition); elementGroup.AddGraph(element, true); return elementGroup.CreatePrototype(); }
/// <summary> /// Helper method to create and initialize a new AsyncDslDiagram. /// </summary> internal protected virtual AsyncDslDiagram CreateDiagramHelper(DslModeling::Partition diagramPartition, DslModeling::ModelElement modelRoot) { AsyncDslDiagram diagram = new AsyncDslDiagram(diagramPartition); // If model root has not children, create initial elements mapped to swimlanes, and merge them into the root. if (DslModeling::DomainRoleInfo.GetAllElementLinks(modelRoot).Count == 0) { DslModeling::ElementGroup elementGroup = new DslModeling::ElementGroup(diagramPartition); DslModeling::ModelElement mappedElement; mappedElement = new Process(diagramPartition); elementGroup.Add(mappedElement); elementGroup.MarkAsRoot(mappedElement); if(diagram.ElementOperations.CanMergeElementGroupPrototype(modelRoot, elementGroup.CreatePrototype())) { diagram.ElementOperations.MergeElementGroup(modelRoot, elementGroup); } else { global::System.Diagnostics.Debug.Fail("Cannot merge swimlane-mapped element(s) into the root model element. Initial swimlanes will not be created."); } } // If we have unmapped swimlanes then Initialize them also diagram.InitializeSwimlanes(); return diagram; }