コード例 #1
0
        private void exportRoundTripPackage(EA.Repository Repository, EA.Package package, DiagramCache diagramCache)
        {
            foreach (object obj in package.Diagrams)
            {
                EA.Diagram samplediagram = (EA.Diagram)obj;


                //DiagramManager.exportDiagram(Repository, samplediagram, diagramCache);
                if (samplediagram.Stereotype == RoundTripAddInClass.EA_STEREOTYPE_POPULATIONDIAGRAM)
                {
                    PopulationManager.exportPopulation(Repository, samplediagram, diagramCache);
                }
                else if (samplediagram.Stereotype == RoundTripAddInClass.EA_STEREOTYPE_MAPPINGDIAGRAM)
                {
                    MappingManager.exportMapping(Repository, samplediagram, diagramCache);
                }
                else if (samplediagram.Stereotype == RoundTripAddInClass.EA_STEREOTYPE_HIERARCHYDIAGRAM)
                {
                    HierarchyManager.exportHierarchy(Repository, samplediagram, diagramCache);
                }
            }
        }
コード例 #2
0
        ///
        /// Called when user makes a selection in the menu.
        /// This is your main exit point to the rest of your Add-in
        ///
        /// <param name="Repository" />the repository
        /// <param name="Location" />the location of the menu
        /// <param name="MenuName" />the name of the menu
        /// <param name="ItemName" />the name of the selected menu item
        public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName)
        {
            logger.enable(Repository);

            DiagramCache diagramCache = new DiagramCache();

            EA.Diagram diagram = null;
            if (Repository.GetContextItemType() == ObjectType.otDiagram)
            {
                diagram = Repository.GetContextObject();
            }

            switch (ItemName)
            {
            case menuExportMapping:
                MappingManager.exportMapping(Repository, diagram, diagramCache);
                break;

            case menuSyncMapping:
                MappingManager.syncMapping(Repository, diagram, diagramCache);
                break;

            case menuExportHierarchy:
                logger.log("Menu Export Hierarchy");
                HierarchyManager.exportHierarchy(Repository, diagram, diagramCache);

                break;

            case menuExportPopulation:
                PopulationManager.exportPopulation(Repository, diagram, diagramCache);

                break;

            case menuSyncPopulation:
                PopulationManager.syncPopulation(Repository, diagram, diagramCache);
                break;

            case menuSyncHierarchy:
                HierarchyManager.syncHierarchy(Repository, diagram, diagramCache);
                break;


            case menuExportConstraint:
                ConstraintManager.exportConstraint(Repository, diagram, diagramCache);
                break;

            case menuSyncConstraint:
                ConstraintManager.syncConstraint(Repository, diagram, diagramCache);
                break;

            case menuExportAll:
                exportAll(Repository, diagramCache);
                break;

            case menuExportPackage:
                exportPackage(Repository, diagramCache);
                break;

            case menuExportDiagram:
                exportDiagram(Repository);
                break;

            case menuExportSchema:
                try
                {
                    SchemaManager.exportSchema(Repository, diagram, diagramCache);
                    MetaDataManager.setAsSchemaDiagram(Repository, diagram);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            //case menuExportCanonical:
            //    try
            //    {
            //        SchemaManager.exportCanonical(Repository, diagram);
            //        //MetaDataManager.setAsCanonicalDiagram(Repository, diagram);
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message);
            //    }
            //    break;

            case menuExportSample:
                SampleManager.exportSample(Repository, diagram, diagramCache);
                MetaDataManager.setAsSampleDiagram(Repository, diagram);
                break;

            case menuSyncSample:
                SampleManager.syncSample(Repository, diagram, diagramCache);
                break;

            case menuCreateSample:
                SchemaManager.generateSample(Repository, diagramCache);
                break;

            case menuUpdateClassFromInstance:
                SchemaManager.updateClassFromInstance(Repository);
                break;

            case menuUpdateInstanceFromClass:
                SchemaManager.operateOnSample(Repository, SchemaManager.updateSampleFromClass);
                break;

            case menuValidateDiagram:
                if (diagram != null)
                {
                    if (diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_SAMPLEDIAGRAM))
                    {
                        SampleManager.validateDiagram(Repository, diagram, diagramCache);
                    }
                    else if (diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_SCHEMADIAGRAM))
                    {
                        SchemaManager.validateDiagram(Repository, diagram, diagramCache);
                    }
                }

                break;



            case menuToggleLogging:
                logger.toggleLogging(Repository);
                break;

            case menuWeb:
                this.callWeb(Repository);
                break;
            }
        }