Esempio n. 1
0
        // 配置図の要素が属している実行環境の取得
        internal ExecutionEnvironment GetExecutionEnvironment(EA.Repository Repository, DeployDiagramObject DeployDiagramObject)
        {
            var diagram       = Repository.GetCurrentDiagram();
            var diagramObject = diagram.GetDiagramObjectByID(DeployDiagramObject.ParentID, "");

            if (DeviceList.Where(Device => Device.ID == DeployDiagramObject.ParentID).Any())
            {
                return(GetExecutionEnvironment(Repository, DeviceList.Single(Device => Device.ID == DeployDiagramObject.ParentID)));
            }
            return(ExecutionEnvironmentList.Single(ExecutionEnvironment => ExecutionEnvironment.ID == DeployDiagramObject.ParentID));
        }
Esempio n. 2
0
        public void EA_MenuClick(EA.Repository Repository, string MenuLocation, string MenuName, string ItemName)
        {
            try
            {
                // 評価がクリックされたときの動作
                EA.Diagram diagram = Repository.GetCurrentDiagram();
                this.Repository = Repository;

                if (diagram == null)
                {
                    MessageBox.Show("ダイアグラムを開いてから実行してください。", ADDINNAME);
                    return;
                }

                else if (!diagram.Type.Equals("Deployment"))
                {
                    MessageBox.Show("配置図を開いてから実行してください", ADDINNAME);
                    return;
                }
                LoadDeployDiagramObjectsInformation(Repository);
                DeleteFilesUnderDirectory($@"{GlobalVar.ProjectPath}\EvaluationResult");
                DeleteFilesUnderDirectory($@"{GlobalVar.ProjectPath}\EachQualityEvaluationResult");
                var InputXDocument = XDocument.Load($@"{GlobalVar.ProjectPath}\inputdata.xml");
                var ProcesseComposedComponentNameList = InputXDocument.Element("inputData").Element("functionLists").Elements("function");
                var FunctionComposedComponentLists    = ConvertFunctionComposedComponentNameListsIntoFunctionComposedComponentLists(ProcesseComposedComponentNameList);
                var FunctionNameList = InputXDocument.Element("inputData").Elements("functionLists").Elements("function").Elements("functionName").ToList();

                foreach (var FunctionComposedComponentList in FunctionComposedComponentLists)
                {
                    var FunctionName = FunctionNameList.Pop().Value;
                    var FunctionComposedXDocument = GetFunctionComposedXDocument(FunctionComposedComponentList, FunctionName);
                    FunctionComposedXDocument.Save($@"{GlobalVar.ProjectPath}\EvaluationResult\{FunctionName}.xml");
                }

                MessageBox.Show("end");
                MakeDeviceQualityXDocuments(Repository);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            finally
            {
                Initialize();
            }
            return;
        }
Esempio n. 3
0
        // 図から必要な要素を取得し、リストを作成する
        internal void LoadDeployDiagramObjectsInformation(EA.Repository Repository)
        {
            // ノードの配置に関するモデルの作成,親をたどることにより必要な情報を入手
            // 配置図の要素を環境、デバイス、ノード、コンポーネントのリストに格納
            EA.Diagram diagram = Repository.GetCurrentDiagram();
            var        TmpCommunicationList = new List <Communication>();

            for (short i = 0; i < diagram.DiagramObjects.Count; i++)
            {
                DiagramObject diagramObject = diagram.DiagramObjects.GetAt(i);
                Element       element       = Repository.GetElementByID(diagramObject.ElementID);
                var           ConnectorList = new List <Connector>();
                var           xdoc          = element.Notes.ToXDocument();
                switch (element.MetaType)
                {
                case "ExecutionEnvironment":
                    ExecutionEnvironmentList.Add(new ExecutionEnvironment(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;

                case "Device":
                    // デバイスが保持している接続を取得
                    for (short j = 0; j < element.Connectors.Count; j++)
                    {
                        Connector connector = element.Connectors.GetAt(j);
                        ConnectorList.Add(connector);
                        TmpCommunicationList.Add(new Communication(connector.Name, connector.ConnectorID, connector.DiagramID, connector.Notes.ToXDocument()));
                    }

                    DeviceList.Add(new Device(element.Name, element.ElementID, element.ParentID, xdoc, element.Stereotype, ConnectorList));
                    break;

                case "Node":
                    NodeList.Add(new Node(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;

                case "Component":
                    ComponentList.Add(new Component(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;
                }
            }

            TmpCommunicationList.GroupBy(communication => communication.Name)
            .Select(x => x.FirstOrDefault())
            .ToList()
            .ForEach(Communication => CommunicationList.Add(Communication));
        }
Esempio n. 4
0
        private void ExecuteSynchronizeReference()
        {
            EAAPI.Diagram diagram = _repository.GetCurrentDiagram();

            if (diagram != null)
            {
                if (diagram.SelectedObjects.Count == 1)
                {
                    EAAPI.DiagramObject diagramObject = (EAAPI.DiagramObject)diagram.SelectedObjects.GetAt(0);

                    EAAPI.Element referenceElement = _repository.GetElementByID(diagramObject.ElementID);

                    ReferenceSynchronizer referenceSynchronizer = new ReferenceSynchronizer(_repository, referenceElement);

                    referenceSynchronizer.SynchronizeReferenceWithOriginal();

                    MessageBox.Show("Synchronization finished.", "Reference Synchronization");
                }
            }
        }
Esempio n. 5
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)
        {
            logger.log("location:" + Location);
            logger.log("MenuName:" + MenuName);
            logger.log("ContextItemType:" + Repository.GetContextItemType());

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

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

            case menuHeader:
                string[] subMenusOther  = { menuExportPackage, menuExportAll, menuExportDiagram, menuToggleLogging };
                string[] subMenusAPI    = { menuExportPackage, menuExportAll, menuExportDiagram, menuExportAPI, menuExportAPIRAML1, menuValidateDiagram, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                string[] subMenusSOA    = { menuExportPackage, menuExportSOA, menuExportDiagram, menuImportSOA };
                string[] subMenusSchema = { menuExportPackage, menuExportAll, menuExportDiagram, menuValidateDiagram, menuExportSchema, menuCreateSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                string[] subMenusSample = { menuExportPackage, menuExportAll, menuExportDiagram, menuExportSample, menuValidateDiagram, menuSyncSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                //string[] subMenusCanonical = { menuExportAll, menuExportDiagram, menuExportCanonical, menuCreateSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };

                if (diagram != null && diagram.Stereotype.Equals(APIAddinClass.EA_STEREOTYPE_APIDIAGRAM))
                {
                    logger.log("API Menus");
                    return(subMenusAPI);
                }
                else if (diagram != null && diagram.Stereotype.Equals(APIAddinClass.EA_STEREOTYPE_SOADIAGRAM))
                {
                    logger.log("SOA Menus");
                    return(subMenusSOA);
                }
                else if (diagram != null && diagram.Stereotype.Equals(APIAddinClass.EA_STEREOTYPE_SCHEMADIAGRAM))
                {
                    logger.log("Schema Menus");
                    return(subMenusSchema);
                }
                else if (diagram != null && diagram.Stereotype.Equals(APIAddinClass.EA_STEREOTYPE_SAMPLEDIAGRAM))
                {
                    logger.log("Sample Menus");
                    return(subMenusSample);
                }
                //else if (diagram != null && diagram.Stereotype.Equals(APIAddInClass.EA_STEREOTYPE_CANONICALDIAGRAM))
                //{
                //    logger.log("Canonical Menus");
                //    return subMenusCanonical;
                //}

                return(subMenusOther);

            case menuHeaderExperimental:
                string[] subMenus2 = { menuSqlQuery, menuWeb, };
                //EA.Element apiEl = diagramAPI(Repository);
                //if (apiEl == null)
                //{
                //    return new string[] { menuGenerate, menuGenerateSamples, menuGenerateAPI, menuValidateDiagram, };
                //}
                return(subMenus2);
            }

            return("");
        }
        ///
        /// 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)
        {
            logger.log("location:" + Location);
            logger.log("MenuName:" + MenuName);
            logger.log("ContextItemType:" + Repository.GetContextItemType());

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

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

            case menuHeader:
                string[] subMenusOther = { menuExportPackage, menuExportAll, menuExportDiagram, menuToggleLogging };
                //string[] subMenusAPI = { menuExportPackage, menuExportAll, menuExportDiagram, menuExportAPI, menuExportAPIRAML1, menuValidateDiagram, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                string[] subMenusSchema     = { menuExportPackage, menuExportAll, menuExportDiagram, menuValidateDiagram, menuExportSchema, menuCreateSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                string[] subMenusSample     = { menuExportPackage, menuExportAll, menuExportDiagram, menuExportSample, menuValidateDiagram, menuSyncSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };
                string[] subMenusPopulation = { menuExportPopulation, menuSyncPopulation, menuExportDiagram, menuToggleLogging };
                string[] subMenusHierarchy  = { menuExportHierarchy, menuSyncHierarchy, menuExportDiagram, menuToggleLogging };
                string[] subMenusMapping    = { menuExportMapping, menuSyncMapping, menuExportDiagram, menuToggleLogging };
                string[] subMenusConstraint = { menuExportConstraint, menuSyncConstraint, menuExportDiagram, menuToggleLogging };
                //string[] subMenusCanonical = { menuExportAll, menuExportDiagram, menuExportCanonical, menuCreateSample, menuUpdateClassFromInstance, menuUpdateInstanceFromClass, menuToggleLogging };

                if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_SCHEMADIAGRAM))
                {
                    logger.log("Schema Menus");
                    return(subMenusSchema);
                }
                else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_SAMPLEDIAGRAM))
                {
                    logger.log("Sample Menus");
                    return(subMenusSample);
                }
                else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_POPULATIONDIAGRAM))
                {
                    logger.log("Population Menus");
                    return(subMenusPopulation);
                }
                else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_HIERARCHYDIAGRAM))
                {
                    logger.log("Population Menus");
                    return(subMenusHierarchy);
                }
                else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_MAPPINGDIAGRAM))
                {
                    logger.log("Mapping Menus");
                    return(subMenusMapping);
                }
                else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_CONSTRAINTDIAGRAM))
                {
                    logger.log("Constraint Menus");
                    return(subMenusConstraint);
                }
                //else if (diagram != null && diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_CANONICALDIAGRAM))
                //{
                //    logger.log("Canonical Menus");
                //    return subMenusCanonical;
                //}

                return(subMenusOther);

            case menuHeaderExperimental:
                string[] subMenus2 = { menuSqlQuery, menuWeb, };
                //EA.Element apiEl = diagramAPI(Repository);
                //if (apiEl == null)
                //{
                //    return new string[] { menuGenerate, menuGenerateSamples, menuGenerateAPI, menuValidateDiagram, };
                //}
                return(subMenus2);
            }

            return("");
        }