/// /// Called Before EA starts to check Add-In Exists /// Nothing is done here. /// This operation needs to exists for the addin to work /// /// <param name="Repository" />the EA repository /// a string public String EA_Connect(EA.Repository Repository) { logger.setRepository(Repository); try { fileManager.setBasePath(Properties.Settings.Default.BasePath); fileManager.setDiagramPath(Properties.Settings.Default.DiagramPath); } catch (Exception) { logger.log("Did not find BasePath or DiagramPath in user settings"); } MappingManager.setLogger(logger); MappingManager.setFileManager(fileManager); HierarchyManager.setLogger(logger); HierarchyManager.setFileManager(fileManager); PopulationManager.setLogger(logger); PopulationManager.setFileManager(fileManager); ConstraintManager.setLogger(logger); ConstraintManager.setFileManager(fileManager); DiagramManager.setLogger(logger); DiagramManager.setFileManager(fileManager); SchemaManager.setLogger(logger); SchemaManager.setFileManager(fileManager); SampleManager.setLogger(logger); SampleManager.setFileManager(fileManager); MetaDataManager.setLogger(logger); RepositoryHelper.setLogger(logger); ObjectManager.setLogger(logger); return("a string"); }
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); } } }
/// /// 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; } }