public void Execute(IMenuCommand command)
        {
            IDiagram diagram = this.DiagramContext.CurrentDiagram;
            IModelStore modelStore = diagram.ModelStore;

            string SqlFile = @"C:\MyLoStore\MyLoStorePostgres.sql";
            string PythonFile = @"C:\MyLoStore\MyLoStore.py";

            FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog();
            openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
            openFolderDialog1.Description =
                "Select the directory that you want to use for generated output";

            if (openFolderDialog1.ShowDialog() == DialogResult.OK)
            {
                string folderName = openFolderDialog1.SelectedPath;
                SqlFile = folderName + @"\MyLoStorePostgres.sql";
                PythonFile = folderName + @"\MyLoStore.py";

                using (StreamWriter fsSql = new StreamWriter(SqlFile, false))
                {
                    using (StreamWriter fsPy = new StreamWriter(PythonFile, false))
                    {

                        SQLWriter mySql = new SQLWriter(SQLGenerateRun.Postgres);
                        PythonClassWriter py = new PythonClassWriter();
                        SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
                        sqlGen.GenerateMySQL();
                    }
                }
            }
        }
Beispiel #2
0
        public void Execute(IMenuCommand command)
        {
            IDiagram diagram = this.DiagramContext.CurrentDiagram;
            IModelStore modelStore = diagram.ModelStore;

            const string newPath = @"C:\PLDB";
            System.IO.Directory.CreateDirectory(newPath);
            string SqlFile = Path.Combine(newPath, @"PLDBmysql.sql");
            string PythonFile = Path.Combine(newPath, @"PLDB.py");

            using (StreamWriter fsSql = new StreamWriter(SqlFile))
            {
                using (StreamWriter fsPy = new StreamWriter(PythonFile))
                {
                    SQLWriter mySql = new SQLWriter(SQLGenerateRun.INNODB);
                    //DjangoWriter py = new DjangoWriter();
                    PythonClassWriter py = new PythonClassWriter();
                    SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
                    sqlGen.GenerateMySQL();

                }
            }

            // TODO debug this code: seems like I'm missing an assembly reference!
            //var outWindow = Package.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            //Guid generalPaneGuid = VSConstants.GUID_OutWindowGeneralPane;
            //IVsOutputWindowPane generalPane;
            //outWindow.GetPane(ref generalPaneGuid, out generalPane);
            //generalPane.OutputString("============= SQL Generation Successful =================");
            //generalPane.Activate(); // Brings this pane into view
        }
        public void Execute(IMenuCommand command)
        {
            IDiagram diagram = this.DiagramContext.CurrentDiagram;
            IModelStore modelStore = diagram.ModelStore;

            const string SqlFile = @"C:\PLDB\PLDBmysql.sql";
            const string PythonFile = @"C:\PLDB\PLDB.py";

            using (StreamWriter fsSql = new StreamWriter(SqlFile))
            {
                using (StreamWriter fsPy = new StreamWriter(PythonFile))
                {
                    SQLWriter mySql = new SQLWriter(SQLGenerateRun.MyISAM);
                    PythonClassWriter py = new PythonClassWriter();
                    SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
                    sqlGen.GenerateMySQL();
                }
            }
        }