Esempio n. 1
0
        private void ToOATS(XmlDocument xmiDoc)
        {
            String  toTestRegex = "{click},{setText;[data1.username]},{pressTab}";
            Boolean testedRegex = RegexTest(toTestRegex);

            UmlModel    model    = new UmlModel("");
            XmiImporter importer = new XmiImporter();
            String      name     = "";

            model = importer.FromXmi(xmiDoc, ref name);

            string[] parts = xmiDoc.BaseURI.Split(new char[] { '/' });
            string   fName = parts[parts.Length - 1];

            fName = fName.Substring(0, fName.IndexOf('.'));
            filterToActDiagOnly(ref model);
            try
            {
                foreach (UmlActivityDiagram actDiag in model.Diagrams)
                {
                    tabs = 0;
                    UmlToGraphOATS umlToGraphOATS = new UmlToGraphOATS();
                    //sw = new StreamWriter(Configuration.getInstance().getConfiguration(Configuration.Fields.workspacepath) + fname + "_OATS.java");
                    //sw = new StreamWriter(Configuration.getInstance().getConfiguration(Configuration.Fields.workspacepath) + actDiag.Name + "_OATS.java");
                    sw = new StreamWriter(".//TestOutput//script.java");

                    dg = umlToGraphOATS.ActivityDiagramToGraph(actDiag, model);
                    OrderEdges(dg);
                    OrderActDiagramTransitions(actDiag);
                    currState  = dg.RootNode;
                    curActDiag = actDiag;
                    S();
                    sw.Close();
                    // break;
                }
            }
            catch (Exception e)
            {
                String message = e.Message;
                if (sw != null)
                {
                    sw.Close();
                }
                throw;
            }
        }
Esempio n. 2
0
        public void ParseXmiToOATS(string XmiPath, string OATSPath)
        {
            UmlModel    model  = new UmlModel("");
            XmlDocument xmiDoc = new XmlDocument();

            xmiDoc.Load(XmiPath);
            XmiImporter importer = new XmiImporter();
            String      name     = "";

            model = importer.FromXmi(xmiDoc, ref name);


            if (model.Diagrams.Count(X => X is UmlActivityDiagram) > 1)
            {
                throw new Exception("Only one Activity diagram allowed! (For now)");
            }
            try
            {
                UmlToFsm umlToFsm = new UmlToFsm();
                foreach (UmlActivityDiagram actDiag in model.Diagrams)
                {
                    tabs = 0;
                    sw   = new StreamWriter(OATSPath + "\\script.java");
                    fsm  = umlToFsm.ActivityDiagramToFsm(actDiag, model);
                    //fsm.
                    currState  = fsm.InitialState;
                    curActDiag = actDiag;
                    S();
                    sw.Close();
                    break;//only one
                }
            }
            catch (Exception ex)
            {
                if (sw != null)
                {
                    sw.Close();
                }
                throw ex;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Execute the command
        /// </summary>
        public void Exec()
        {
            if (_layer == null)
            {
                return;
            }
            XmiImporter importer = new XmiImporter(_layer);

            PromptBox prompt = new PromptBox("Xmi file name", "xmi files|*.xmi");

            if (prompt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    importer.Import(prompt.Value);
                }
                catch (Exception ex)
                {
                    ServiceLocator.Instance.IDEHelper.ShowError("Import error : " + ex.Message);
                }
            }
        }
 public void Initializer()
 {
     importer = new XmiImporter();
 }