private void RenderResult(IScriptEditor editor, TabControl tabControl, ScriptExecutionResult execResult)
        {
            if (execResult == null || execResult.DataSets == null || execResult.DataSets.Count == 0)
            {
                return;
            }

            TabPage          tp  = null;
            DxResultRenderer grd = null;
            int tblNo            = 1;

            foreach (DataSet ds in execResult.DataSets)
            {
                if (ds == null || ds.Tables.Count == 0)
                {
                    continue;
                }

                DataSetInfo dsInfo = editor.GetDataSetInfo(ds);
                tblNo = 1;
                foreach (DataTable tbl in ds.Tables)
                {
                    string tabCaption = String.Format("Qry {0}.{1} [{2}]", dsInfo.BatchNo, tblNo, tbl.Rows.Count);
                    tp             = new TabPage(tabCaption);
                    tp.ToolTipText = String.Format(tabCaption + " [{0}]", dsInfo.ServerDbInfo);

                    tabControl.TabPages.Add(tp);

                    grd = new DxResultRenderer();
                    tp.Controls.Add(grd);

                    grd.Enter += new EventHandler(grd_Enter);

                    editor.PrepareAddInSupportForResultContextMenu(grd.PopUpMenu.Items);
                    grd.Parent = tp;
                    grd.Dock   = DockStyle.Fill;
                    grd.RenderDataTable(tbl);
                    _disposeList.Add(grd);
                    tblNo++;
                }
            }
        }
Exemple #2
0
        public static RecoverContent CreateScriptContent(IScriptEditor editor)
        {
            RecoverContent item = new RecoverContent();

            item.Uid                = editor.Uid;
            item.Content            = editor.Content;
            item.SyntaxMode         = editor.CurrentSytaxMode;
            item.Title              = editor.Caption;
            item.Server             = editor.CurrentConnection == null ? String.Empty : editor.CurrentConnection.Server;
            item.Database           = editor.CurrentConnection == null ? String.Empty : editor.CurrentConnection.Database;
            item.Username           = editor.CurrentConnection == null ? String.Empty : editor.CurrentConnection.UserName;
            item.IntegratedSecurity = editor.CurrentConnection == null ? String.Empty : editor.CurrentConnection.IntegratedSecurity;
            item.FileName           = String.IsNullOrEmpty(editor.FileName) ? String.Empty : editor.FileName;
            item.ObjectType         = editor.ObjectType;
            switch (editor.ContentType)
            {
            case EditorContentType.Script:
                item.ItemType = RecoverContentType.Script;
                break;

            case EditorContentType.File:
                item.ItemType = RecoverContentType.ScriptFile;
                break;

            case EditorContentType.SharedSnippet:
                item.ItemType = RecoverContentType.SharedSnippet;
                break;

            case EditorContentType.SharedScript:
                item.ItemType = RecoverContentType.SharedScript;
                break;

            default:
                item.ItemType = RecoverContentType.SharedScript;
                break;
            }

            return(item);
        }
 static void _scriptEditor_AfterTextEditorClosed(object sender, FormClosedEventArgs e)
 {
     UnsubscribeFromScriptEditorEvents();
     _scriptEditor = null;
 }
Exemple #4
0
 public void Initialize(IScriptEditor scriptEditor)
 {
 }
Exemple #5
0
 public ObjectHelperPopupBuilder(IScriptEditor scriptEditor, ContextMenuStrip menuStrip)
 {
     _scriptEditor = scriptEditor;
     MenuStrip     = menuStrip;
 }
Exemple #6
0
        public string EvalMacro(PragmaSqlMacros macro)
        {
            string        result       = String.Empty;
            ITextEditor   txtEditor    = HostServicesSingleton.HostServices.EditorServices.CurrentEditor;
            IScriptEditor scriptEditor = HostServicesSingleton.HostServices.EditorServices.CurrentScriptEditor;

            switch (macro)
            {
            case PragmaSqlMacros.Content:
                if (txtEditor != null)
                {
                    result = txtEditor.Content;
                }

                break;

            case PragmaSqlMacros.SelectedContent:
                if (txtEditor != null)
                {
                    result = txtEditor.SelectedText;
                }
                break;

            case PragmaSqlMacros.FileName:
                if (txtEditor != null)
                {
                    result = txtEditor.FileName;
                }
                break;

            case PragmaSqlMacros.ObjectName:
                if (scriptEditor != null)
                {
                    result = scriptEditor.ObjectName;
                }
                break;

            case PragmaSqlMacros.ObjectNames:
                if (scriptEditor != null)
                {
                    IList <string> names = scriptEditor.ObjectNames;
                    string         comma = String.Empty;
                    foreach (string s in names)
                    {
                        result += (String.IsNullOrEmpty(comma) ? String.Empty : comma) + s;
                        comma   = ";";
                    }
                }
                break;

            case PragmaSqlMacros.WordAtCursor:
                if (txtEditor != null)
                {
                    result = txtEditor.WordAtCursor;
                }
                break;

            case PragmaSqlMacros.Connection:
                if (scriptEditor != null)
                {
                    result = scriptEditor.ConnectionString;
                }
                break;

            case PragmaSqlMacros.ServerName:
                if (scriptEditor != null)
                {
                    result = scriptEditor.Server;
                }
                break;

            case PragmaSqlMacros.DatabaseName:
                if (scriptEditor != null)
                {
                    result = scriptEditor.Database;
                }
                break;

            case PragmaSqlMacros.Username:
                scriptEditor = HostServicesSingleton.HostServices.EditorServices.CurrentScriptEditor;
                if (scriptEditor != null)
                {
                    result = scriptEditor.Username;
                }
                break;

            case PragmaSqlMacros.ObjExplorerNode:
                ObjectExplorerNode objExpNode = HostServicesSingleton.HostServices.ObjectExplorerService.SelNode;
                if (objExpNode != null)
                {
                    result = objExpNode.Name;
                }
                break;

            case PragmaSqlMacros.StartupPath:
                result = Application.StartupPath;
                break;

            default:
                break;
            }

            return(result);
        }