Example #1
0
        public static void ShowScriptEditor(frmScriptEditor frm)
        {
            if (frm == null)
            {
                return;
            }

            if (Program.MainForm.DockPanel.DocumentStyle == DocumentStyles.SystemMdi)
            {
                frm.MdiParent = Program.MainForm;
                frm.Show();
            }
            else
            {
                frm.Show(Program.MainForm.DockPanel);
            }
        }
Example #2
0
        private frmScriptEditor CreateNewScriptEditor()
        {
            TreeNode node = tv.SelectedNode;

            if (node == null)
            {
                CreateNewConnectionFromRepository(false);
            }

            node = tv.SelectedNode;
            if (node == null)
            {
                return(null);
            }


            NodeData data = NodeDataFactory.GetNodeData(node.Tag);

            if (data == null)
            {
                MessageBox.Show("Can not create connection!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            frmScriptEditor editor = new frmScriptEditor();

            editor.Text    = "Script " + (++_scriptEditorCnt).ToString();
            editor.TabText = editor.Text;

            if (DockPanel.DocumentStyle == DocumentStyles.SystemMdi)
            {
                editor.MdiParent = this;
                editor.Show();
            }
            else
            {
                editor.Show(DockPanel);
            }
            editor.InitializeScriptEditor(String.Empty, DBObjectType.None, data.ConnParams, data.DBName);
            return(editor);
        }
Example #3
0
        private void ModifySelectedObjectInScriptWindow()
        {
            TreeNode node = tv.SelectedNode;

            if (node == null)
            {
                return;
            }

            NodeData data = NodeDataFactory.GetNodeData(node.Tag);

            if (data == null)
            {
                MessageBox.Show("Node data not assigned", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            frmScriptEditor editor = new frmScriptEditor();

            editor.Text    = data.Name;
            editor.TabText = editor.Text;

            if (DockPanel.DocumentStyle == DocumentStyles.SystemMdi)
            {
                editor.MdiParent = this;
                editor.Show();
            }
            else
            {
                editor.Show(DockPanel);
            }

            ProgrammabilityHelper.SqlConn = _connections[data.ConnParams.Name];
            string script = ProgrammabilityHelper.GetObjectCreateScript(data.ID);

            script = ProgrammabilityHelper.ReplaceCreateWithAlter(data.Type, script);

            editor.InitializeScriptEditor(script, data.Type, data.ConnParams, data.DBName);
        }