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

            //if (mocaTreeTag == null)
            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);

                foreach (SQLElement childClass in eaPackage.Elements)
                {
                    this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.ClassesChildNodeName);
                    if (childClass.Stereotype.ToLower() == ECOREModelingMain.EClassStereotype.ToLower())
                    {
                        processEClass(childClass);
                    }
                }

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

                return(ePackageMocaNode);
            }
            return(null);
        }
示例#2
0
        private MocaNode processEPackage(SQLPackage eaPackage)
        {
            SQLTaggedValue mocaTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonExportTreeTaggedValueName);

            if (mocaTreeTag != null)
            {
                EPackage ePackage         = new EPackage(eaPackage, repository);
                MocaNode ePackageMocaNode = MocaTreeUtil.mocaNodeFromXmlString(mocaTreeTag.Notes);

                SQLTaggedValue changesTreeTag = EAEcoreAddin.Util.EAUtil.findTaggedValue(eaPackage, Main.MoflonChangesTreeTaggedValueName);
                if (changesTreeTag != null)
                {
                    MocaNode ePackageChangesMocaNode = MocaTreeUtil.mocaNodeFromXmlString(changesTreeTag.Notes);
                    if (ePackageChangesMocaNode.hasAllAttributes(new List <string>(
                                                                     new string[] { ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME, ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME })))
                    {
                        ePackage.addChangesAttributesDuringExport(ePackageMocaNode, changesTreeTag);

                        CachedPackage temp = new CachedPackage();
                        temp.getPackage(eaPackage.PackageGUID, repository);
                        temp.name         = eaPackage.Name;
                        temp.previousName = eaPackage.Name;
                        temp.packageName  = ePackageChangesMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PACKAGE_NAME).Value;
                        temp.projectName  = ePackageChangesMocaNode.getAttribute(ChangesTreeConstants.ATTRIBUTE_KEY_PROJECT_NAME).Value;
                        temp.savePackageToEATaggedValue(true);
                    }
                }

                ePackage.addAttributesDuringExport(ePackageMocaNode);
                this.currentNode.appendChildNode(ePackageMocaNode);

                foreach (SQLElement childClass in eaPackage.Elements)
                {
                    this.currentNode = ePackageMocaNode.getChildNodeWithName(EPackageHelper.ClassesChildNodeName);
                    if (childClass.Stereotype.ToLower() == ECOREModelingMain.EClassStereotype.ToLower())
                    {
                        processEClass(childClass);
                    }
                }

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

                return(ePackageMocaNode);
            }
            return(null);
        }
示例#3
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);
        }