示例#1
0
        private MocaNode processEPackage(SQLPackage eaPackage)
        {
            backgroundWorker.ReportProgress(0, PersistencyUtil.computePackageUri(eaPackage, repository));
            SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonExportTreeTaggedValueName);


            if (mocaTreeTag != null)
            {
                EPackage ePackage = new EPackage(eaPackage, repository);


                MocaNode ePackageMocaNode = MocaTreeUtil.mocaNodeFromXmlString(mocaTreeTag.Notes);

                ePackage.addAttributesDuringExport(ePackageMocaNode);

                this.currentNode.appendChildNode(ePackageMocaNode);
                int counter = 0;
                foreach (SQLElement childClass in eaPackage.Elements)
                {
                    if (!Export.showStatusBar)
                    {
                        Console.Out.WriteLine("SCALE:Export Classifier '" + childClass.Name + "' %" + counter + "/" + eaPackage.Elements.Count + "#");
                    }
                    counter++;
                    this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.ClassesChildNodeName);
                    if (childClass.Stereotype.ToLower() == ECOREModelingMain.EClassStereotype.ToLower())
                    {
                        processEClass(childClass);
                    }
                    else if (childClass.Stereotype.ToLower() == ECOREModelingMain.EDatatypeStereotype.ToLower())
                    {
                        processEDatatype(childClass);
                    }
                    else if (childClass.Stereotype.ToLower() == ECOREModelingMain.EEnumStereotype.ToLower())
                    {
                        processEEnum(childClass);
                    }
                }

                foreach (SQLPackage childPackage in eaPackage.Packages)
                {
                    this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.PackagesChildNodeName);
                    processEPackage(childPackage);
                }

                return(ePackageMocaNode);
            }
            return(null);
        }
示例#2
0
        public MocaNode processTggOutermostPackage(SQLPackage tggOutermostPackage)
        {
            backgroundWorker.ReportProgress(0, PersistencyUtil.computePackageUri(tggOutermostPackage, repository));


            this.currentNode = new MocaNode();

            SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(tggOutermostPackage, Main.MoflonExportTreeTaggedValueName);

            TGG tgg = new TGG(repository, tggOutermostPackage);

            tgg.loadTreeFromTaggedValue();
            XmlDocument xmlDoc = MocaTreeUtil.stringToXmlDocument(mocaTreeTag.Notes);

            MocaNode ePackageMocaNode = new MocaNode();

            ePackageMocaNode.deserializeFromXmlTree(xmlDoc.DocumentElement.FirstChild as XmlElement);

            tgg.addAttributesDuringExport(ePackageMocaNode);

            this.currentNode.appendChildNode(ePackageMocaNode);
            foreach (SQLPackage childPackage in tggOutermostPackage.Packages)
            {
                this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.PackagesChildNodeName);
                processTggPackage(childPackage);
            }
            foreach (SQLElement childClass in tggOutermostPackage.Elements)
            {
                processTGGPackageFeatures(ePackageMocaNode, childClass);
            }
            SQLTaggedValue moflonExportTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(tggOutermostPackage, MetamodelHelper.MoflonExportTaggedValueName);

            if (moflonExportTag != null)
            {
                ePackageMocaNode.appendChildAttribute(MetamodelHelper.MoflonExportTaggedValueName, moflonExportTag.Value);
            }
            else
            {
                ePackageMocaNode.appendChildAttribute(MetamodelHelper.MoflonExportTaggedValueName, "false");
            }

            return(ePackageMocaNode);
        }
示例#3
0
        override protected String computeNsUri()
        {
            SQLTaggedValue customUri = EAEcoreAddin.Util.EAUtil.findTaggedValue(package.EaPackage, MoflonCustomNsUriTaggedValueName);

            if (customUri != null)
            {
                String value = customUri.Value;

                //use default
                if (value.Equals(DEFAULT_VALUE_PLACEHOLDER))
                {
                    return(base.computeNsUri() + "#//" + PersistencyUtil.computePackageUri(package.EaPackage, package.Repository));
                }
                //otherwise custom value
                return(value);
            }
            else
            {
                return(base.computeNsUri() + "#//" + PersistencyUtil.computePackageUri(package.EaPackage, package.Repository));
            }
        }
示例#4
0
        private MocaNode processTggPackage(SQLPackage eaPackage)
        {
            backgroundWorker.ReportProgress(0, PersistencyUtil.computePackageUri(eaPackage, repository));

            EPackage ePackage = new EPackage(eaPackage, repository);

            if (eaPackage.Element.Stereotype == TGGModelingMain.TggRulePackageStereotype || eaPackage.Name == "Rules")
            {
                ePackage = new TGGRulePackage(eaPackage, repository);
            }

            ePackage.loadTreeFromTaggedValue();

            SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonExportTreeTaggedValueName);
            XmlDocument    xmlDoc      = MocaTreeUtil.stringToXmlDocument(mocaTreeTag.Notes);

            MocaNode ePackageMocaNode = new MocaNode();

            ePackageMocaNode.deserializeFromXmlTree(xmlDoc.DocumentElement.FirstChild as XmlElement);

            ePackage.addAttributesDuringExport(ePackageMocaNode);

            this.currentNode.appendChildNode(ePackageMocaNode);

            foreach (SQLPackage childPackage in eaPackage.Packages)
            {
                this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.PackagesChildNodeName);
                processTggPackage(childPackage);
            }


            foreach (SQLElement childClass in eaPackage.Elements)
            {
                processTGGPackageFeatures(ePackageMocaNode, childClass);
            }


            return(ePackageMocaNode);
        }