string _properties = "";    // the properties
        public Param(EA.Repository rep, EA.Element parTrgt) {
            _rep = rep;
            _parTrgt = parTrgt;

            // check if t_xref element is already present
            string query = @"SELECT XrefID As XREF_ID, description As DESCR
                            FROM  t_object  o inner JOIN t_xref x on (o.ea_guid = x.client)
                            where x.Name = 'CustomProperties' AND
                                  x.Type = 'element property' AND
                                  o.object_ID = " + _parTrgt.ElementID;
                        
                            
            string str = _rep.SQLQuery(query);
            var xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(str);

            // get existing t_xref and remember GUID/XrefID
            XmlNode xrefGuid = xmlDoc.SelectSingleNode("//XREF_ID");
            if (xrefGuid != null)
            {
                _xrefid = xrefGuid.InnerText;// GUID of xref

                // get description
                XmlNode xrefDesc = xmlDoc.SelectSingleNode("//DESCR");
                _properties = null;
                if (xrefDesc != null) _properties = xrefDesc.InnerText;
            }
        }
예제 #2
0
 public ReportException(String message, int code, EA.Repository r, byte b)
 {
     this.message = message;
     this.code = code;
     this.r = r;
     this.p = b;
 }
예제 #3
0
 public ModelGenerationForm(EA.Repository repository, EA.Package navigationPackage, EA.Package interactionPackage,
     List<EA.Element> useCases)
 {
     InitializeComponent();
     this.repository = repository;
     this.navigationPackage = navigationPackage;
     this.interactionPackage = interactionPackage;
     this.useCases = useCases;
 }
 public SynchronizationProgressWindow(EA.Repository repository)
 {
     InitializeComponent();
     MaximizeBox = false;
     MinimizeBox = false;
     StartPosition = FormStartPosition.CenterScreen;
     FormBorderStyle = FormBorderStyle.FixedSingle;
     this.synchronizationService = new SynchronizationService(repository);
     this.repository = repository;
 }
        // constructor
        public Svn(EA.Repository rep, EA.Package pkg)  {
            _pkg = pkg;
            _rep = rep;
            _vcPath = "";
            if (pkg.IsControlled)
            {

                _vcPath = Util.GetVccFilePath(rep, pkg);
            }

            
        }
 static void Main()
 {
 	addAddIns();
     eaRepository = getOpenedModel();
     if (eaRepository != null)
     {
     	initializeAddins();
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         form = new EAAddinTesterForm();
         Application.Run(form);
     }
 }
예제 #7
0
        /// <summary>
        /// Create a Tagged value type
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static bool DeleteTaggedValueTye(EA.Repository rep, string property)
        {
            try
            {
                string sql = $@"Delete from t_propertytypes where Property = '{property}';";

                rep.Execute(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show($@"Property: '{property}'

{e}", @"Can't delete Tagged Value Type");
                return(false);
            }

            return(true);
        }
예제 #8
0
 public override void Save(EA.Repository rep, FindAndReplaceItem.FieldType fieldType)
 {
     EA.Diagram dia = (EA.Diagram)rep.GetDiagramByGuid(Guid);
     if ((fieldType & FindAndReplaceItem.FieldType.Description) > 0)
     {
         dia.Notes = Description;
     }
     if ((fieldType & FindAndReplaceItem.FieldType.Name) > 0)
     {
         dia.Name = Name;
     }
     if ((fieldType & FindAndReplaceItem.FieldType.Stereotype) > 0)
     {
         dia.StereotypeEx = Stereotype;
     }
     IsUpdated = true;
     dia.Update();
 }
예제 #9
0
        public bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties Info)
        {
            preventCascade = true;
            SQLRepository sqlRepository = new SQLRepository(Repository, false);

            EA.Connector connector      = Repository.GetConnectorByID(int.Parse((string)Info.Get(0).Value));
            EA.Diagram   currentDiagram = sqlRepository.GetCurrentDiagram();
            sqlRepository.SaveDiagram(currentDiagram.DiagramID);

            bool modifiedBySDMModeling   = sdmModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);
            bool modifiedByTGGModeling   = tggModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);
            bool modifiedByECoreModeling = ecoreModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram);

            incrementalUpdateAdapter.EA_OnPostNewConnector(Repository, Info);

            preventCascade = false;
            return(modifiedBySDMModeling || modifiedByTGGModeling || modifiedByECoreModeling);
        }
        /// <summary>
        /// Initialize repositories
        /// </summary>
        /// <param name="rep"></param>
        void InitializeForRepository(EA.Repository rep)
        {
            _rep = rep;
            // propagate Repository to GUI
            if (_gui != null)
            {
                _gui.Rep = rep;
            }


            try
            {
            }
            catch (Exception e)
            {
                MessageBox.Show($@"{e.Message}", @"hoAddinTemplate: Error initializing repository");
            }
        }
예제 #11
0
        public void EA_OnPostNewDiagram(EA.Repository Repository, EA.EventProperties Info)
        {
            int           diagramID = int.Parse(Info.Get(0).Value.ToString());
            SQLRepository sqlRep    = new SQLRepository(Repository, false);

            EA.Diagram diagram         = Repository.GetDiagramByID(diagramID);
            String     diagramMetatype = diagram.MetaType;

            if (TGGModelingMain.TggSchemaDiagramMetatype.Contains(diagram.MetaType))
            {
                SQLPackage newTGGProject = sqlRep.GetPackageByID(diagram.PackageID);
                if (EAUtil.packageIsModel(newTGGProject, sqlRep) && newTGGProject.Diagrams.Count == 1 && newTGGProject.getRealPackage().StereotypeEx == "")
                {
                    NewTGGProjectDialog tggDialog = new NewTGGProjectDialog(sqlRep, newTGGProject);
                    tggDialog.ShowDialog();
                }
            }
        }
예제 #12
0
파일: Main.cs 프로젝트: HL7/ehrsfm-tool
 public bool EA_OnContextItemChanged(EA.Repository Repository, string GUID, EA.ObjectType ot)
 {
     if (ot == EA.ObjectType.otPackage)
     {
         if (view_ctrl != null)
         {
             view_ctrl.SetSelectedPackage(Repository.GetTreeSelectedPackage());
         }
     }
     else
     {
         if (view_ctrl != null)
         {
             view_ctrl.SetSelectedPackage(null);
         }
     }
     return(false);
 }
예제 #13
0
        /// <summary>
        /// Returns a list of strings of the query with one column.
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="sql">SQL which one column</param>
        /// <returns>List of strings</returns>
        // ReSharper disable once UnusedMember.Global
        public static List <string> GetStringsBySql(this EA.Repository rep, string sql)
        {
            var lCon = new List <string>();
            // run query into XDocument to proceed with LinQ
            string xml = rep.SQLQuery(sql);
            var    x   = new XDocument(XDocument.Parse(xml));

            // get ea_guid from descendants of
            var node = from row in x.Descendants("Row").Descendants()
                       select row;

            foreach (var row in node)
            {
                lCon.Add(row.Value);
            }

            return(lCon);
        }
예제 #14
0
        private static void sync_relationship(EA.Repository Repository, EA.Diagram diagram, EA.Element source, EA.Element target, JObject jo, EA.Package pkg)
        {
            logger.log("Adding Relationship:");

            //Add relationship  logger.log("No  parent link found");
            EA.Connector link = source.Connectors.AddNew("", "Association");
            link.SupplierID = target.ElementID;
            link.Update();
            source.Update();
            target.Update();

            EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
            dl.ConnectorID = link.ConnectorID;
            dl.Update();

            source.Connectors.Refresh();
            target.Connectors.Refresh();
        }
예제 #15
0
 public override void EA_FileOpen(EA.Repository repository)
 {
     this.model = new TSF_EA.Model(repository);
     //close the tab if still open
     this.model.closeTab(appTitle);
     this._mainControl = null;
     //get settings
     this.settings = new GlossaryManagerSettings(this.model);
     //get the logical datatypes
     this.logicalDatatypes = LogicalDatatype.getAllLogicalDatatypes(this.model);
     //(re)-initialize
     if (this.settings.showWindowAtStartup)
     {
         this.initialiseMainControl();
     }
     this.factory     = GlossaryItemFactory.getFactory(this.model, this.settings);
     this.fullyLoaded = true;
 }
예제 #16
0
        public static IList <EA.Element> diagramElements(EA.Repository Repository)
        {
            List <EA.Element> samples = new List <EA.Element>();

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


            foreach (EA.DiagramObject diagramObject in diagram.DiagramObjects)
            {
                EA.Element el = Repository.GetElementByID(diagramObject.ElementID);
                samples.Add(el);
            }
            return(samples);
        }
예제 #17
0
        public static IList <EA.Element> diagramClasses(EA.Repository Repository, EA.Diagram diagram)
        {
            List <EA.Element> samples = new List <EA.Element>();

            foreach (EA.DiagramObject diagramObject in diagram.DiagramObjects)
            {
                EA.Element el = Repository.GetElementByID(diagramObject.ElementID);
                if (el.Type == null)
                {
                    continue;
                }
                if (el.Type.Equals(APIAddinClass.EA_TYPE_CLASS) || el.Type.Equals(APIAddinClass.EA_TYPE_ENUMERATION))
                {
                    samples.Add(el);
                }
            }
            return(samples);
        }
        //---------------------------------------------------------------------------------------------
        // updateActionParameter(EA.Repository rep, EA.Element actionPin)
        //---------------------------------------------------------------------------------------------
        public static bool UpdateActionPinParameter(EA.Repository rep, EA.Element action)
        {
            foreach (EA.Element actionPin in action.EmbeddedElements)
            {
                // pin target for the return type of the action
                if (actionPin.Name == "target")
                {
                    //// return type
                    //Int32 parTypeID = Util.getTypeID(rep, m.ReturnType);
                    //if (parTypeID != 0)
                    //{
                    //    //pin.Name = par.
                    //    pin.ClassfierID = parTypeID;
                    //    EA.Element el = rep.GetElementByID(parTypeID);
                    //    pin.Update(); // do it before update table
                    //    Util.setElementPDATA1(rep, pin, el.ElementGUID);// set PDATA1

                    //}
                }
                else
                {
                    // get type of synchronized parameter
                    // if parameter isn't synchronized it will not work
                    string type = Util.GetParameterType(rep, actionPin.ElementGUID);
                    if (type == "")
                    {
                        string txt = "No type is available for action:'" + action.Name + "'";
                        rep.WriteOutput("ifm_addin", txt, 0);
                    }
                    else
                    {
                        Int32 parTypeId = Util.GetTypeId(rep, type);
                        if (parTypeId != 0)
                        {
                            //pin.Name = par.
                            EA.Element el = rep.GetElementByID(parTypeId);
                            Util.SetElementPdata1(rep, actionPin, el.ElementGUID);// PDATA1 setzen
                        }
                    }
                }
            }

            return(true);
        }
예제 #19
0
        /// <summary>
        /// Synchronization of an issue.
        /// </summary>
        /// <param name="Issue">Issue read from JIRA server that should be synchronized.</param>
        /// <param name="Repository">Sparx EA Repository.</param>
        /// <param name="Package">Packages that owns all issues that are not owned by any element withint this package.</param>
        /// <param name="Element">If it is not null then this element will be owner of the issue element instead of Package.</param>
        /// <param name="IssuesInEA">All issues that were within the packages just before the synchronization begins.</param>
        /// <returns>EA Element that represents synchronized issue.</returns>
        private static EA.Element SynchronizeItem(Atlassian.Jira.Issue Issue, EA.Repository Repository, EA.Package Package, EA.Element Element, Dictionary <string, EA.Element> IssuesInEA)
        {
            IssueOperation Operation;

            EA.Element EAElementForIssue;
            if (IssuesInEA.ContainsKey(Issue.Key.Value))
            { //this issue is already saved in EA. Let's do something with it
                Operation         = IssueOperation.Updated;
                EAElementForIssue = IssuesInEA[Issue.Key.Value];
                Repository.WriteOutput(EAGoatJira.JiraOutputWindowName, $"Updating issue {Issue.Key.Value}", EAElementForIssue.ElementID);
                if (Element == null)
                {
                    EAElementForIssue.PackageID = Package.PackageID;
                }
                else
                {
                    EAElementForIssue.ParentID = Element.ElementID;
                }

                ///TODO: I should change the stereotype, if the type of issue has been chaged.
                ///      On the other hand, some configuration of JIRA doesn't allow these changes to ordinary users.
                ///EAElementForIssue.Type = GetMetaclassFromIssueType(Issue);

                IssuesInEA.Remove(Issue.Key.Value);
            }
            else
            { //this issue is not in EA so far, let's create a new one EA.Element
                Operation = IssueOperation.Inserted;
                if (Element == null)
                {
                    EAElementForIssue = Package.Elements.AddNew(GetEAJiraIssueName(Issue), EAGoatJira.GetMetaclassFromIssueType(Issue));
                }
                else
                {
                    EAElementForIssue = Element.Elements.AddNew(GetEAJiraIssueName(Issue), EAGoatJira.GetMetaclassFromIssueType(Issue));
                }
                Repository.WriteOutput(EAGoatJira.JiraOutputWindowName, $"Inserting issue {Issue.Key.Value}", EAElementForIssue.ElementID);
            }
            FillIssue(EAElementForIssue, new JiraIssueViewModel(new AtlassianJiraIssueModelService(Issue), null), Operation);

            EAElementForIssue.Update();

            return(EAElementForIssue);
        }
예제 #20
0
        ///
        /// Called when user Clicks Add-Ins Menu item from within EA.
        /// Populates the Menu with our desired selections.
        /// Location can be "TreeView" "MainMenu" or "Diagram".
        ///
        /// <param name="Repository" />the repository
        /// <param name="Location" />the location of the menu
        /// <param name="MenuName" />the name of the menu
        ///
        public object EA_GetMenuItems(EA.Repository repository, string location, string menuName)
        {
            string[] subMenus = null;



            switch (menuName)
            {
            // defines the top level menu option
            case "":
                return(menuDPAddin);

            case menuDPAddin:
                subMenus = new string[] { menuExportDiagram, menuDesign, menuDesignLinks, menuUtils, menuReports, menuTest };
                return(subMenus);

            case menuDesign:
                subMenus = new string[] { menuPutElement, menuSetElementTags };
                return(subMenus);

            case menuPutElement:
                subMenus = new string[] { menuPutContourContour, menuPutParentDHierarchyOnDiagram, menuPutChildrenDeployHierarchy };
                return(subMenus);

            case menuDesignLinks:
                subMenus = new string[] { menuCreateLink, menuManageLinks, menuManageLinkVisibility, menuSetConnectorTags, menuSetSimilarLinksTags };
                return(subMenus);

            case menuUtils:
                subMenus = new string[] { menuSetCurrentDiagram, menuSetCurrentLibrary, menuSetDPLibratyTag, menuReloadConnectorData, menuDoOnConnectActions, menuRunSQLQuery };
                return(subMenus);

            case menuReports:
                subMenus = new string[] { menuDiagramElementsReport };
                return(subMenus);


            case menuTest:
                subMenus = new string[] { menuTest1, menuTest2, menuTest3 };
                return(subMenus);
            }

            return("");
        }
예제 #21
0
        // Gets the signal associated with the element
        public static string GetSignal(EA.Repository rep, string guid)
        {
            string      query  = @"select x.Description AS SIGNAL_GUID
                      from t_xref x 
                      where x.Client = '" + guid + "'    AND behavior = 'event' ";
            string      str    = rep.SQLQuery(query);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(str);

            XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//SIGNAL_GUID");

            guid = "";
            if (operationGuidNode != null)
            {
                guid = operationGuidNode.InnerText;
            }
            return(guid);
        }
예제 #22
0
파일: EAAddIn.cs 프로젝트: yjstyle/ADMentor
        public string EA_Connect(EA.Repository repository)
        {
            RepositoryChanged(repository);

            var data = Bootstrap(eaRepository);

            data.Item1.Do(wrapper =>
            {
                entityWrapper.Exchange(wrapper, GetType());
            });

            validationHandler.Exchange(Options.Some(new ValidationHandler(eaRepository, data.Item2)), GetType());

            var ciHandler = new ContextItemHandler(contextItem, eaRepository, entityWrapper);

            contextItemHandler.Exchange(Options.Some(ciHandler), GetType());

            return("");
        }
예제 #23
0
        static public void exportSample(EA.Repository Repository, EA.Diagram diagram)
        {
            Hashtable ht        = sampleToJObject(Repository, diagram);
            string    sample    = (string)ht["sample"];
            string    clazz     = (string)ht["class"];
            JObject   container = (JObject)ht["json"];


            if (!diagram.Stereotype.Equals(APIAddinClass.EA_STEREOTYPE_SAMPLEDIAGRAM))
            {
                logger.log("exportSample: Ignore diagam that isnt a sample diagram");
                return;
            }

            //KeyValuePair<string,JObject> kv = sampleToJObject(Repository, diagram);
            //JObject container = kv.Value;

            if (container == null)
            {
                MessageBox.Show("No object linked to root with classification sample declared nor  (older style) object of classification Request declared");
                return;
            }

            string msg = JsonConvert.SerializeObject(container, Newtonsoft.Json.Formatting.Indented) + "\n";

            EA.Package samplePkg      = Repository.GetPackageByID(diagram.PackageID);
            EA.Package samplesPackage = Repository.GetPackageByID(samplePkg.ParentID);
            EA.Package apiPackage     = Repository.GetPackageByID(samplesPackage.ParentID);

            string sourcecontrolPackage = apiPackage.Name;

            if (MetaDataManager.isCDMPackage(Repository, apiPackage))
            {
                sourcecontrolPackage = "cdm";
            }

            if (fileManager != null)
            {
                fileManager.initializeAPI(sourcecontrolPackage);
                fileManager.setup(APIAddinClass.RAML_0_8);
                fileManager.exportSample(sample, clazz, msg, fileManager.getNamespace(Repository, samplesPackage));
            }
        }
예제 #24
0
        public Moflon2Parser(String[] args)
        {
            eapFile = new ValueArgument <string>('a', "eap", "eap file");
            xmiFile = new ValueArgument <string>('x', "xmi", "xmi file");
            export  = new SwitchArgument('e', "export", false);
            import  = new SwitchArgument('i', "import", false);
            codegen2compatibility = new SwitchArgument('c', "codegen2", false);
            validate = new SwitchArgument('v', "validate", false);

            eapFile.AllowMultiple = true;
            parser.AdditionalArgumentsSettings.AcceptAdditionalArguments = true;

            parser.Arguments.Add(eapFile);
            parser.Arguments.Add(xmiFile);
            parser.Arguments.Add(export);
            parser.Arguments.Add(import);
            parser.Arguments.Add(codegen2compatibility);
            parser.Arguments.Add(validate);
            try
            {
                parser.ParseCommandLine(args);
            }
            catch (UnknownArgumentException e)
            {
                Console.Out.WriteLine("EXCEPTION:" + e.Message + "#");
            }
            doImport();
            doExport();

            if (validate.Value)
            {
                EA.Repository repository = null;
                String        filename   = eapFile.Value;
                repository = new EA.Repository();
                repository.OpenFile(filename);
                ConsistencyModule cM = new ConsistencyModule();
                cM.initializeRules();

                SQLRepository sqlRep = new SQLRepository(repository, false);

                cM.dispatchFullRulecheck(ref sqlRep, true);
            }
        }
예제 #25
0
        public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
        {
            /// <summary>
            /// Get EA add-in menu items
            /// <paramref name="Repository"/> Active EA repository
            /// <paramref name="Location"/> (not used)
            /// <paramref name="MenuName"/> Name of the EA menu
            /// </summary>
            switch (MenuName)
            {
            case "":
                return("-&Innovator");

            case "-&Innovator":
                string[] ar = { "Load &Data Model", "-", "Aras Login" };
                return(ar);
            }
            return("");
        }
예제 #26
0
        private void updateDiagramMetaType(String oldMetaType, String newMetaType, EA.Repository repository)
        {
            SQLRepository sqlRep = new SQLRepository(repository, false);

            String sqlString = "select Diagram_ID from t_diagram where StyleEx LIKE '*" + oldMetaType + "*'";
            String result    = repository.SQLQuery(sqlString);

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
            {
                if (row != "")
                {
                    SQLDiagram diag    = new SQLDiagram(sqlRep, row);
                    EA.Diagram rdiag   = EAUtil.sqlEAObjectToOriginalObject(sqlRep, diag) as EA.Diagram;
                    String     StyleEx = rdiag.StyleEx.Replace(oldMetaType, newMetaType);
                    sqlString = "UPDATE t_diagram SET StyleEx = '" + StyleEx + "' WHERE Diagram_ID = " + rdiag.DiagramID;
                    repository.Execute(sqlString);
                }
            }
        }
예제 #27
0
        // Find the calling operation from a Call Operation Action
        public static string GetClassifierGuid(EA.Repository rep, string guid)
        {
            string      query  = @"select o.Classifier_guid AS CLASSIFIER_GUID
                      from t_object o 
                      where o.EA_GUID = '" + guid + "'";
            string      str    = rep.SQLQuery(query);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(str);

            XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//CLASSIFIER_GUID");

            guid = "";
            if (operationGuidNode != null)
            {
                guid = operationGuidNode.InnerText;
            }
            return(guid);
        }
        private static string GetNameProperty(EABrowsableObjectsCollection <T> coll, int idx)
        {
            int    displayIndex    = idx + 1;
            string name            = "#" + displayIndex.ToString();
            T      browsableObject = coll[idx];

            EA.App        app        = System.Runtime.InteropServices.Marshal.GetActiveObject("EA.App") as EA.App;
            EA.Repository repository = app.Repository;

            EADualInterface <T> dualInterface = new EADualInterface <T>(browsableObject);
            string objectName = dualInterface.GetPropertyValue("Name");

            if (!string.IsNullOrEmpty(objectName))
            {
                name = name + "(" + objectName + ")";
            }

            return(name);
        }
예제 #29
0
        public override void EA_MenuClick(EA.Repository repository, string location,
                                          string menuName, string itemName)
        {
            // Selection of a menu-item of the Add-in
            switch (itemName)
            {
            case menuOpen:
                this.openEAValidator();
                break;

            case menuSettings:
                new SettingsForm(this.settings).ShowDialog(this.model.mainEAWindow);
                break;

            case menuAbout:
                new AboutWindow().ShowDialog(this.model.mainEAWindow);
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="pkg"></param>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="stereotype"></param>
        /// <returns></returns>
        public static EA.Element CreateElement(EA.Repository rep, EA.Package pkg, string name, string type, string stereotype)
        {
            var el = CallOperationAction.GetElementFromName(rep, name, type);

            if (el == null)
            {
                el = (EA.Element)pkg.Elements.AddNew(name, type);
                pkg.Elements.Refresh();
            }
            if (stereotype != "")
            {
                if (el.Stereotype != stereotype)
                {
                    el.Stereotype = stereotype;
                    el.Update();
                }
            }
            return(el);
        }
        /// <summary>
        /// Called when user makes a selection in the menu.
        /// This is your main exit point to the rest of your Add-in
        /// </summary>
        /// <param name="Repository">the repository</param>
        /// <param name="Location">the location of the menu</param>
        /// <param name="MenuName">the name of the menu</param>
        /// <param name="ItemName">the name of the selected menu item</param>
        public override void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName)
        {
            switch (ItemName)
            {
            // user has clicked the menuHello menu option
            case menuHello:
                this.sayHello();
                break;

            // user has clicked the menuGoodbye menu option
            case menuGoodbye:
                this.sayGoodbye();
                break;

            case menuOpenProperties:
                this.testPropertiesDialog(Repository);
                break;
            }
        }
 /// <summary>
 /// The Add-in can optionally implement this function.
 /// Using the SchemaProfile interface an Add-in can adjust the capabilities of the Schema Composer. (See Automation Interface)
 /// </summary>
 /// <param name="Repository">the repository object</param>
 /// <param name="profile">the EA SchemaProfile object</param>
 public override void EA_GetProfileInfo(EA.Repository Repository, EA.SchemaProfile profile)
 {
     //for some reason EA seems to sometimes create a new instance of the add-in.
     //to avoid nullpointer exception we inititialize the model and factory again if needed
     if (this.model == null || this.schemaFactory == null)
     {
         this.initialize(Repository);
     }
     //make sure the tagged value types we need are there
     if (this.schemaFactory != null)
     {
         this.checkTaggedValueTypes();
     }
     //tell EA our export format name
     if (profile != null)
     {
         profile.AddExportFormat("ECDM Message");
     }
 }
예제 #33
0
        public void EA_MenuClick(EA.Repository Repository, string MenuLocation, string MenuName, string ItemName)
        {
            var Evaluation = new EvaluationMain();

            Evaluation.LoadDeployDiagramObjectsInformation(Repository);
            var DeviceList                       = Evaluation.DeviceList;
            var CommunicationList                = Evaluation.CommunicationList;
            var RecommendDeviceXDocuments        = LoadRecommendXDocuments($@"{GlobalVar.ProjectPath}\RecommendDeviceXML\");
            var RecommendCommunicationXDocuments = LoadRecommendXDocuments($@"{GlobalVar.ProjectPath}\RecommendCommunicationXML\");

            LoadCommunicationMoveable();
            //CommunicationMoveableDictionary.ToList().ForEach(x => MessageBox.Show(x.ToString()));

            MakeRecommendDeviceXDocumentList(DeviceList, RecommendDeviceXDocuments).ToList()
            .ForEach(xdocument => xdocument.Save($@"{GlobalVar.ProjectPath}\RecommendationResult\{xdocument.Element("recommendList").Element("targetDeviceName").Value}.xml"));
            MakeRecommendCommunicationXDocumentList(CommunicationList, RecommendCommunicationXDocuments).ToList()
            .ForEach(xdocument => xdocument.Save($@"{GlobalVar.ProjectPath}\RecommendationResult\{xdocument.Element("recommendList").Element("targetCommunicationName").Value}.xml"));
            CommunicationMoveableDictionary.Clear();
        }
예제 #34
0
        // Update Method Types
        public static bool UpdateMethod(EA.Repository rep, EA.Method m)
        {
            int id;

            // over all parameters
            foreach (EA.Parameter par in m.Parameters)
            {
                if ((par.ClassifierID == "") || (par.ClassifierID == "0"))
                {
                    // find type from type_name
                    id = GetTypeId(rep, par.Type);
                    if (id > 0)
                    {
                        par.ClassifierID = id.ToString();
                        bool error = par.Update();
                        if (!error)
                        {
                            MessageBox.Show("Error write Parameter", m.GetLastError());
                            return(false);
                            // Error occurred
                        }
                    }
                }
            }
            // no classifier defined
            if ((m.ClassifierID == "") || (m.ClassifierID == "0"))
            {
                // find type from type_name
                id = GetTypeId(rep, m.ReturnType);
                if (id > 0)
                {
                    m.ClassifierID = id.ToString();
                    bool error = m.Update();
                    if (!error)
                    {
                        MessageBox.Show("Error write Method", m.GetLastError());
                        return(false);
                        // Error occurred
                    }
                }
            }
            return(true);
        }
예제 #35
0
        static YamlNode reifyExamples(EA.Repository Repository, EA.Element e, EA.Connector con, EA.Element client)
        {
            logger.log("ReifyExamples:" + fileManager.examplesPath(e.Name));

            YamlMappingNode example = new YamlMappingNode();

            if (e.Notes != null && e.Notes.Length > 0)
            {
                example.Add("description", e.Notes);
            }

            YamlScalarNode node = new YamlScalarNode("!include " + fileManager.examplesPath(e.Name));

            node.Style = ScalarStyle.Raw;

            example.Add("value", node);

            return(node);
        }
예제 #36
0
        // Find type for name
        // 1. Search for name
        // 2. Search for Synonyms
        public static int GetTypeId(EA.Repository rep, string name)
        {
            int intReturn = 0;

            //
            // delete an '*' at the end of the variable name
            name = name.Replace("*", "");
            // remove a 'const ' from start of string
            // remove a 'volatile ' from start of string
            name = name.Replace("const", "");
            name = name.Replace("volatile", "");
            name = name.Trim();


            if (name.Equals("void") || name.Equals("void*"))
            {
                return(0);
            }
            string query = @"SELECT
                            o.object_id As OBJECT_ID
                            FROM  t_object  o
                            INNER  JOIN  t_objectproperties  p ON  o.object_id  =  p.object_id
                            where property = 'typeSynonyms' AND
                                  Object_Type in ('Class','PrimitiveType','DataType')  AND
                                  p.value = '" + name + "' " +
                           @" UNION
                               Select o.object_id
                               From t_object o
                                        where Object_Type in ('Class','PrimitiveType','DataType') AND name = '" + name + "' ";
            string      str    = rep.SQLQuery(query);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(str);

            XmlNode operationGuidNode = xmlDoc.SelectSingleNode("//OBJECT_ID");

            if (operationGuidNode != null)
            {
                intReturn = Convert.ToInt32(operationGuidNode.InnerText);
            }

            return(intReturn);
        }
        public FindAndReplace(EA.Repository rep, EA.Package pkg, string findString, 
            string replaceString,
            bool isCaseSensitive, bool isRegularExpression, bool isIgnoreWhiteSpace,
            bool isNameSearch, bool isDescriptionSearch, bool isStereotypeSearch, bool isTagSearch,
            string taggedValueNames, 
            bool isPackageSearch, bool isElementSearch, bool isDiagramSearch,
            bool isAttributeSearch, bool isOperationSearch
            ) {
            _rep = rep;
            _pkg = pkg;
            _findString = findString;
            _replaceString = replaceString;
            _isRegularExpression = isRegularExpression;
            _isCaseSensitive = isCaseSensitive;
            _isIgnoreWhiteSpace = isIgnoreWhiteSpace;
            if (isNameSearch) _searchFieldTypes = FindAndReplaceItem.FieldType.Name;
            if (isDescriptionSearch) _searchFieldTypes = _searchFieldTypes | FindAndReplaceItem.FieldType.Description;
            if (isTagSearch) _searchFieldTypes = _searchFieldTypes | FindAndReplaceItem.FieldType.Tag;

            if (isStereotypeSearch) _searchFieldTypes = _searchFieldTypes | FindAndReplaceItem.FieldType.Stereotype;
            
            // tagged value names
            string s = taggedValueNames.Replace(' ',','); // remove blanks
            _taggedValueNames = s.Split(new Char[] { ',', ';',':',' ' }, System.StringSplitOptions.RemoveEmptyEntries);


            _isPackageSearch = isPackageSearch;
            _isElementSearch = isElementSearch;
            _isDiagramSearch = isDiagramSearch;
            _isAttributeSearch = isAttributeSearch;
            _isOperationSearch = isOperationSearch;
            _isTagSearch = isTagSearch;

            _regExPattern = PrepareRegexp();
            _index = -1;

        }
예제 #38
0
 public CodeGenerationForm(EA.Repository repository)
 {
     InitializeComponent();
     this.repository = repository;
 }
예제 #39
0
        static void Main(string[] args)
        {
            int packageID; //ID пакета в EA.
            String[] list; //
            String template; //Наименование шаблона документации в EA.
            String path = null; //Выходной документ.
            String docTemplatePath; // Путь к документу word, в котором находятся стили для замены.
            TextWriter errWriter = Console.Error; //Вывод в stderror.
            StreamReader reader; // Чтение входного файла переданного в 7-ом параметре.
            Object missingObj = System.Reflection.Missing.Value;
            Word.Application app = new Word.Application();
            Object missing = Type.Missing;

            try
            {
                if (args.Length < 1)
                {
                    throw new ReportException(withoutArgs, 1);
                }

                if (args[0] == help || args[0] == anotherHelp)
                {
                    printHelp();
                    Environment.Exit(1);
                }

                else
                    if (args.Length >= 5)
                    {
                        EA.Repository r = new EA.Repository();
                        EA.Project project = new EA.Project();

                        if (args.Length > 6)
                        {
                            reader = new StreamReader(args[6], Encoding.Default);//File.OpenText(args[6]);
                            styles(reader);
                            reader.Close();
                        }
                        else
                            styles();

                        //Открываем файл модели
                        if (!args[0].Contains(fileDelimiter))
                            args[0] = Environment.CurrentDirectory + fileDelimiter + args[0];

                        if (File.Exists(args[0]))
                            r.OpenFile(args[0]);
                        else
                            throw new ReportException(fileNotFound, 1);

                        //Выходной файл
                        if (args[1].Substring(args[1].Length - 5) == format)
                            path = Environment.CurrentDirectory + fileDelimiter + args[1];
                        else
                            throw new ReportException(incorrect, 1);

                        //Путь к документируемому пакету
                        list = args[2].Split(delimiter);

                        if (list.Length < 2)
                            throw new ReportException(incorrectPath, 1);

                        //Наименование шаблона документации
                        template = args[3];

                        //Получаем ID пакета
                        packageID = getPackageId(list, r);

                        //Запуск документации по шаблону
                        project.RunReport(r.GetPackageByID(packageID).PackageGUID, template, path);

                        r.CloseFile();
                        r.Exit();
                    }
                    else
                        throw new ReportException(incorrectArgsCount, 1);

                if (args[4].Contains(fileDelimiter))
                    docTemplatePath = args[4];
                else
                    docTemplatePath = Environment.CurrentDirectory + fileDelimiter + args[4];

                if (File.Exists(path) && File.Exists(docTemplatePath))
                {
                    Word.Document doc = app.Documents.Open(path);

                    if (args.Length > 5)
                    {
                        if (args[5].Equals(sixthArg))
                        {
                            Word.Find find = app.Selection.Find;
                            find.Text = emptyString;
                            find.Replacement.Text = emptyString.Substring(0, 2);
                            Object wrap = Word.WdFindWrap.wdFindContinue;
                            Object replace = Word.WdReplace.wdReplaceAll;
                            find.Execute(FindText: Type.Missing, MatchCase: false, MatchWholeWord: false, MatchWildcards: false, MatchSoundsLike: missing, MatchAllWordForms: false, Forward: true, Wrap: wrap, Format: false, ReplaceWith: missing, Replace: replace);
                        }
                    }

                    Word.Document docTemplate = app.Documents.Open(docTemplatePath);

                    foreach (Word.Paragraph p in doc.Paragraphs)
                    {
                        if (styleNames.ContainsKey(p.get_Style().NameLocal))
                        {
                            foreach (Word.Style s in docTemplate.Styles)
                            {
                                if (s.NameLocal == styleNames[p.get_Style().NameLocal])
                                {
                                    p.set_Style(s);
                                    break;
                                }
                            }
                        }
                    }

                    doc.Save();
                    doc.Close();
                    docTemplate.Close();
                    app.Quit(ref missingObj, ref  missingObj, ref missingObj);
                }
                else
                    throw new ReportException(templateNotFound, 1);

            }
            catch (ReportException re)
            {
                if (re.getPrintByte() == (byte)1)
                {
                    printPackageTree(re.getRepository().GetPackageByID(1));

                }

                re.eaClose();
                re.print(errWriter);
                app.Quit(ref missingObj, ref  missingObj, ref missingObj);
                Environment.Exit(1);
            }
            catch (Exception e)
            {
                errWriter.WriteLine(e.GetBaseException());
                app.Quit(ref missingObj, ref  missingObj, ref missingObj);
                Environment.Exit(2);
            }
        }
예제 #40
0
        public static void ProcessUseCase(EA.Repository rep, EA.Package navigationPackage, EA.Package interactionPackage,
            List<EA.Element> useCases, string patternType = null)
        {
            repository = rep;
            string[] res = repository.ConnectionString.Split('\\');
            string projectName = res[res.Length - 1].Split('.')[0];
            nsDiagram = XISMobileHelper.CreateDiagram(navigationPackage, projectName + "NavigationSpace Diagram",
                "XIS-Mobile_Diagrams::NavigationSpaceViewModel");
            bool isStartingUC = true;

            if (patternType != null)
            {
                homeDiagram = XISMobileHelper.CreateDiagram(interactionPackage, "HomeIS Diagram",
                    "XIS-Mobile_Diagrams::InteractionSpaceViewModel");
                homeIS = new XisInteractionSpace(repository, interactionPackage, homeDiagram, "HomeIS", "Home", true);
            }

            foreach (EA.Element useCase in useCases)
            {
                foreach (EA.Connector connector in useCase.Connectors)
                {
                    if (connector.Stereotype == "XisEntityUC-BEAssociation")
                    {
                        EA.Element be = repository.GetElementByID(connector.SupplierID);
                        XisEntity master = null;
                        List<XisEntity> details = new List<XisEntity>();
                        List<XisEntity> references = new List<XisEntity>();

                        #region [Get Entities (Master, Details and References)]
                        foreach (EA.Connector beConn in be.Connectors)
                        {
                            switch (beConn.Stereotype)
                            {
                                case "XisBE-EntityMasterAssociation":
                                    master = new XisEntity(repository.GetElementByID(beConn.SupplierID),
                                        GetConnectorTag(beConn.TaggedValues, "filter").Value);
                                    break;
                                case "XisBE-EntityDetailAssociation":
                                    details.Add(new XisEntity(repository.GetElementByID(beConn.SupplierID),
                                        GetConnectorTag(beConn.TaggedValues, "filter").Value));
                                    break;
                                case "XisBE-EntityReferenceAssociation":
                                    references.Add(new XisEntity(repository.GetElementByID(beConn.SupplierID),
                                        GetConnectorTag(beConn.TaggedValues, "filter").Value));
                                    break;
                                default:
                                    break;
                            }
                        }
                        #endregion

                        if (master != null)
                        {
                            //MessageBox.Show(master.Element.Name);

                            #region [Add cardinality to Entities]
                            if (details.Count > 0 || references.Count > 0)
                            {
                                foreach (EA.Connector conn in master.Element.Connectors)
                                {
                                    foreach (XisEntity detail in details)
                                    {
                                        if (conn.ClientID == detail.Element.ElementID)
                                        {
                                            detail.Cardinality = string.IsNullOrEmpty(conn.ClientEnd.Cardinality) ? "1" : conn.ClientEnd.Cardinality;
                                            detail.BeCardinality = string.IsNullOrEmpty(conn.SupplierEnd.Cardinality) ? "1" : conn.SupplierEnd.Cardinality;
                                            //MessageBox.Show("client: " + detail.Element.Name);
                                        }
                                        else if (conn.SupplierID == detail.Element.ElementID)
                                        {
                                            detail.Cardinality = string.IsNullOrEmpty(conn.SupplierEnd.Cardinality) ? "1" : conn.SupplierEnd.Cardinality;
                                            detail.BeCardinality = string.IsNullOrEmpty(conn.ClientEnd.Cardinality) ? "1" : conn.ClientEnd.Cardinality;
                                            //MessageBox.Show("supplier: " + detail.Element.Name);
                                        }
                                    }

                                    foreach (XisEntity reference in references)
                                    {
                                        if (conn.ClientID == reference.Element.ElementID)
                                        {
                                            reference.Cardinality = string.IsNullOrEmpty(conn.ClientEnd.Cardinality) ? "1" : conn.ClientEnd.Cardinality;
                                            reference.BeCardinality = string.IsNullOrEmpty(conn.SupplierEnd.Cardinality) ? "1" : conn.SupplierEnd.Cardinality;
                                            //MessageBox.Show("client: " + reference.Element.Name);
                                        }
                                        else if (conn.SupplierID == reference.Element.ElementID)
                                        {
                                            reference.Cardinality = string.IsNullOrEmpty(conn.SupplierEnd.Cardinality) ? "1" : conn.SupplierEnd.Cardinality;
                                            reference.BeCardinality = string.IsNullOrEmpty(conn.ClientEnd.Cardinality) ? "1" : conn.ClientEnd.Cardinality;
                                            //MessageBox.Show("supplier: " + reference.Element.Name);
                                        }
                                    }
                                }
                            }
                            #endregion

                            master.Details = details;
                            master.References = references;

                            EA.TaggedValue ucType = GetTaggedValue(useCase.TaggedValues, "type");

                            if (ucType != null)
                            {
                                if (ucType.Value == "EntityManagement")
                                {
                                    if (isStartingUC && useCases.Count > 1)
                                    {
                                        ProcessManagerUseCase(interactionPackage, master, useCase, be, isStartingUC,
                                            useCases.GetRange(1, useCases.Count - 1), patternType);
                                    }
                                    else
                                    {
                                        ProcessManagerUseCase(interactionPackage, master, useCase, be, isStartingUC, null, patternType);
                                    }
                                }
                                else if (ucType.Value == "EntityConfiguration")
                                {
                                    if (isStartingUC && useCases.Count > 1)
                                    {
                                        ProcessDetailUseCase(interactionPackage, master, useCase, be, isStartingUC,
                                            useCases.GetRange(1, useCases.Count - 1), patternType);
                                    }
                                    else
                                    {
                                        ProcessDetailUseCase(interactionPackage, master, useCase, be, isStartingUC, null, patternType);
                                    }
                                }
                            }
                        }
                    }
                    else if (connector.Stereotype == "XisServiceUC-BEAssociation")
                    {
                        EA.Element be = repository.GetElementByID(connector.SupplierID);
                        XisEntity master = null;
                        List<XisEntity> details = new List<XisEntity>();
                        List<XisEntity> references = new List<XisEntity>();

                        foreach (EA.Connector beConn in be.Connectors)
                        {
                            switch (beConn.Stereotype)
                            {
                                case "XisBE-EntityMasterAssociation":
                                    master = new XisEntity(repository.GetElementByID(beConn.SupplierID),
                                        GetConnectorTag(beConn.TaggedValues, "filter").Value);
                                    break;
                                default:
                                    break;
                            }
                        }

                        if (master != null)
                        {
                            ProcessServiceUseCase(interactionPackage, master, useCase, be, isStartingUC, null, patternType);
                        }
                    }
                }
                isStartingUC = false;
            }

            if (patternType != null)
            {
                if (patternType == "Springboard")
                {
                    ComputeSprinboardPositions();
                }
                else
                {
                    ComputePositions(homeIS, homeDiagram);
                }
            }
        }
 public Favorite(EA.Repository rep)
 {
     _rep = rep;
     
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="rep"></param>
 /// <param name="clientGuid">The client GUID of the item to remember as Favorite</param>
 public  Favorite(EA.Repository rep, string clientGuid) {
     _rep = rep;
     _xrefGuid = Guid.NewGuid().ToString();
     _clientGuid = clientGuid; // Favorite GUID
 }
예제 #43
0
 public NotesCleaner(EA.Repository repository)
 {
     this.currentRepo = repository;
 }
 public ElementRecursive(EA.Repository rep)
 {
     _rep = rep;
     _lElId = new List<int>();
 }
 public JSONDiscovererForm(EA.Repository repository)
 {
     InitializeComponent();
     this.repository = repository;
 }
 public void SetRepo(EA.Repository repo)
 {
     this.currentRepo = repo;
 }
 public UtilSql(EA.Repository rep)
 {
     _rep = rep;
 }
예제 #48
0
 public TraceabilityRunner(EA.Repository repository)
 {
     this.currentRepo = repository;
 }