Example #1
0
 public DocumentManager(RunnableQuery q, Control hostControl)
 {
     this._query       = q;
     this._hostControl = hostControl;
     this._document    = new ActiproSoftware.SyntaxEditor.Document();
     this._document.get_SpanIndicatorLayers().Add(this._mainErrorLayer         = new SpanIndicatorLayer("errors", 0x3e8));
     this._document.get_SpanIndicatorLayers().Add(this._warningsLayer          = new SpanIndicatorLayer("warnings", 0x3e8));
     this._document.get_SpanIndicatorLayers().Add(this._executedSelectionLayer = new SpanIndicatorLayer("executedSelection", 0));
     this._document.get_SpanIndicatorLayers().Add(this._uriLayer        = new SpanIndicatorLayer("uriLayer", 0));
     this._document.get_SpanIndicatorLayers().Add(this._stackTraceLayer = new SpanIndicatorLayer("stackTrace", 0));
     if (UserOptions.Instance.TabSize.HasValue)
     {
         this._document.set_TabSize(UserOptions.Instance.TabSizeActual);
     }
     if (UserOptions.Instance.ConvertTabsToSpaces)
     {
         this._document.set_AutoConvertTabsToSpaces(true);
     }
     this._typeResolver = new ActiproBridge.TypeResolver(delegate(string name) {
         if (Program.Splash != null)
         {
             Program.Splash.UpdateMessage("Performing one-time build of autocompletion cache: " + name);
         }
     }, MyExtensions.AdditionalRefs);
     this.ConfigureLanguage();
     this.ConfigureResolver();
 }
 public DocumentManager(RunnableQuery q, Control hostControl)
 {
     this._query = q;
     this._hostControl = hostControl;
     this._document = new ActiproSoftware.SyntaxEditor.Document();
     this._document.get_SpanIndicatorLayers().Add(this._mainErrorLayer = new SpanIndicatorLayer("errors", 0x3e8));
     this._document.get_SpanIndicatorLayers().Add(this._warningsLayer = new SpanIndicatorLayer("warnings", 0x3e8));
     this._document.get_SpanIndicatorLayers().Add(this._executedSelectionLayer = new SpanIndicatorLayer("executedSelection", 0));
     this._document.get_SpanIndicatorLayers().Add(this._uriLayer = new SpanIndicatorLayer("uriLayer", 0));
     this._document.get_SpanIndicatorLayers().Add(this._stackTraceLayer = new SpanIndicatorLayer("stackTrace", 0));
     if (UserOptions.Instance.TabSize.HasValue)
     {
         this._document.set_TabSize(UserOptions.Instance.TabSizeActual);
     }
     if (UserOptions.Instance.ConvertTabsToSpaces)
     {
         this._document.set_AutoConvertTabsToSpaces(true);
     }
     this._typeResolver = new ActiproBridge.TypeResolver(delegate (string name) {
         if (Program.Splash != null)
         {
             Program.Splash.UpdateMessage("Performing one-time build of autocompletion cache: " + name);
         }
     }, MyExtensions.AdditionalRefs);
     this.ConfigureLanguage();
     this.ConfigureResolver();
 }
Example #3
0
            public RunnableQuery ToQuery()
            {
                RunnableQuery query = new RunnableQuery();

                if (!query.Recover(this.QueryPath, this.GetQueryData(), this.FileHasBeenTouched))
                {
                    return(null);
                }
                return(query);
            }
Example #4
0
 public RunnableQuery ToQuery()
 {
     RunnableQuery query = new RunnableQuery();
     if (!query.Recover(this.QueryPath, this.GetQueryData(), this.FileHasBeenTouched))
     {
         return null;
     }
     return query;
 }
Example #5
0
 internal QueryControl(RunnableQuery q, SchemaTree schemaTree)
 {
     EventHandler onClick = null;
     EventHandler handler2 = null;
     EventHandler handler3 = null;
     EventHandler handler4 = null;
     SplitterCancelEventHandler handler5 = null;
     this._browserHidden = true;
     Timer timer = new Timer {
         Interval = 0x2710,
         Enabled = true
     };
     this._autoSaveTimer = timer;
     this._executionTrackingTimer = new Timer();
     this._pluginWinButtons = new List<ToolStripButton>();
     this._query = new RunnableQuery();
     this.NextQueryRequest = delegate (object sender, EventArgs e) {
     };
     this.PreviousQueryRequest = delegate (object sender, EventArgs e) {
     };
     this._lambdaData = new MemoryStream();
     this._ilDirty = true;
     this._ilData = new MemoryStream();
     this._queryCount = 0;
     Timer timer2 = new Timer {
         Interval = 200
     };
     this._refreshTimer = timer2;
     Timer timer3 = new Timer {
         Interval = 200
     };
     this._clockTimer = timer3;
     this._firstResultsShow = true;
     this._lastQueryKind = QueryLanguage.SQL;
     this._suppressPullCount = 0;
     this._random = new Random();
     this.components = null;
     this._query = q;
     this._schemaTree = schemaTree;
     try
     {
         this.Font = FontManager.GetDefaultFont();
     }
     catch
     {
     }
     this.InitializeComponent();
     this.CheckIsMyExtensions();
     this._pluginWinManager = new PluginWindowManager(this);
     this._pluginWinButtonMenu = new ContextMenuStrip(this.components);
     if (onClick == null)
     {
         onClick = (sender, e) => this.CloseCurrentVisualizer();
     }
     this._pluginWinButtonMenu.Items.Add("Close visualizer (Shift+F4 or Middle-Click or Ctrl+Click)", Resources.Delete, onClick);
     if (this.btnExecute.Height > 0x20)
     {
         this.btnExecute.Height -= 3;
         this.cboLanguage.Margin = new Padding(this.cboLanguage.Margin.Left, 2, this.cboLanguage.Margin.Right, 4);
         this.cboDb.Margin = new Padding(this.cboDb.Margin.Left, 2, this.cboDb.Margin.Right, 4);
     }
     else if (this.btnExecute.Height > 0x1d)
     {
         this.btnExecute.Height -= 2;
     }
     else if (this.btnExecute.Height > 0x18)
     {
         this.btnExecute.Height--;
     }
     this.btnCancel.Height = this.btnExecute.Height;
     this.btnText.Height = this.btnGrids.Height = this.btnExecute.Height - 1;
     if ((IntPtr.Size == 4) && (this.btnExecute.Height > 0x1b))
     {
         Padding margin = this.cboLanguage.Margin;
         this.cboLanguage.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
         margin = this.cboDb.Margin;
         this.cboDb.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
     }
     if (this.btnExecute.Height > 40)
     {
         this.btnExecute.Image = ControlUtil.ResizeImage(this.btnExecute.Image, this.btnExecute.Width, this.btnExecute.Height, true);
         this.btnCancel.Image = ControlUtil.ResizeImage(this.btnCancel.Image, this.btnCancel.Width, this.btnCancel.Height, true);
         this.btnGrids.Image = ControlUtil.ResizeImage(this.btnGrids.Image, (this.btnGrids.Width * 3) / 4, (this.btnGrids.Height * 3) / 4, true);
         this.btnText.Image = ControlUtil.ResizeImage(this.btnText.Image, (this.btnText.Width * 3) / 4, (this.btnText.Height * 3) / 4, true);
     }
     this.UpdateAutocompletionMsg();
     try
     {
         this.txtError.Font = new Font("Verdana", 8.25f);
         this.txtSQL.Font = new Font("Verdana", 9.5f);
         this.btnActivateAutocompletion.Font = new Font("Verdana", 8f, FontStyle.Bold);
         this.lblOptimize.Font = new Font("Verdana", 7f, FontStyle.Bold);
     }
     catch
     {
     }
     this.txtSQL.get_Document().set_Language(DocumentManager.GetDynamicLanguage("SQL", SystemColors.Window.GetBrightness()));
     this.txtSQL.get_Document().get_Outlining().set_Mode(2);
     this.txtSQL.set_BracketHighlightingVisible(true);
     this.txtSQL.get_Document().set_ReadOnly(true);
     VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
     SimpleBorder border = new SimpleBorder();
     border.set_Style(0);
     renderer.set_Border(border);
     VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;
     this.txtSQL.set_Renderer(renderer2);
     this._docMan = new DocumentManager(this._query, this);
     this.CreateEditor();
     this.PropagateOptions();
     this.UpdateEditorZoom();
     this.CreateBrowser();
     this._browserHidden = true;
     this.panBottom.BorderStyle = BorderStyle.None;
     this.tsOutput.BackColor = Color.Transparent;
     this.tsOutput.Renderer = new OutputToolsRenderer();
     this.statusStrip.BackColor = Color.Transparent;
     this.statusStrip.Padding = new Padding(this.statusStrip.Padding.Left, this.statusStrip.Padding.Top, this.statusStrip.Padding.Left, this.statusStrip.Padding.Bottom);
     this.PullData(QueryChangedEventArgs.Refresh);
     this.ToggleResultsCollapse();
     this._query.QueryCompiled += new EventHandler<QueryCompilationEventArgs>(this._query_QueryCompiled);
     this._query.PluginsReady += new EventHandler(this._query_PluginsReady);
     this._query.CustomClickCompleted += new EventHandler(this._query_CustomClickCompleted);
     this._query.QueryCompleted += new EventHandler<QueryStatusEventArgs>(this._query_QueryCompleted);
     this._query.QueryChanged += new EventHandler<QueryChangedEventArgs>(this._query_QueryChanged);
     this._query.ReadLineRequested += new EventHandler<ReadLineEventArgs>(this._query_ReadLineRequested);
     this._editor.TextChanged += new EventHandler(this._editor_TextChanged);
     this._editor.add_SelectionChanged(new SelectionEventHandler(this, (IntPtr) this._editor_SelectionChanged));
     this._editor.RepositoryDropped += new EventHandler<QueryEditor.RepositoryEventArgs>(this._editor_RepositoryDropped);
     this._schemaTree.AfterSelect += new TreeViewEventHandler(this._schemaTree_AfterSelect);
     this._docMan.CheckForRepositoryChange();
     this._refreshTimer.Tick += new EventHandler(this.RefreshTimer_Tick);
     this._clockTimer.Tick += new EventHandler(this.ClockTimer_Tick);
     this._autoSaveTimer.Tick += new EventHandler(this.AutoSaveTimer_Tick);
     if (handler2 == null)
     {
         handler2 = (sender, e) => this.ReportMainThreadPosition();
     }
     this._executionTrackingTimer.Tick += handler2;
     if (SystemColors.Window.GetBrightness() < 0.5f)
     {
         this.llDbUseCurrent.ForeColor = SystemColors.HotTrack;
     }
     this.ExtendOutputSplitter();
     if (handler3 == null)
     {
         handler3 = (sender, e) => this.UpdateErrorHeight();
     }
     this.panError.SizeChanged += handler3;
     this.statusStrip.Parent = null;
     base.Controls.Add(this.statusStrip);
     this.statusStrip.SendToBack();
     if (handler4 == null)
     {
         handler4 = (sender, e) => this.RequestWinManagerRelocation();
     }
     EventHandler handler6 = handler4;
     this.panOutput.Resize += handler6;
     for (Control control = this.panOutput; control != null; control = control.Parent)
     {
         control.Move += handler6;
     }
     this._query.PluginWindowManager = this._pluginWinManager;
     this.queryProgressBar.Margin = new Padding(3, 3, 0, 1);
     this.tsOutput.Padding = new Padding(0, 0, 0, 2);
     this.splitContainer.SplitterWidth--;
     if (handler5 == null)
     {
         handler5 = delegate (object sender, SplitterCancelEventArgs e) {
             if (Control.MouseButtons == MouseButtons.Left)
             {
                 MainForm.Instance.IsSplitting = true;
             }
             if ((this.panOutput.BackColor == MainForm.Instance.TransparencyKey) && (this.panOutput.BackColor != Program.LightTransparencyKey))
             {
                 this.panOutput.BackColor = MainForm.Instance.TransparencyKey = Program.LightTransparencyKey;
             }
         };
     }
     this.splitContainer.SplitterMoving += handler5;
     this.panOutput.BorderStyle = BorderStyle.None;
     this.panOutput.BorderColor = Color.FromArgb(160, 160, 160);
     this.lblSyncDb.Cursor = Cursors.Hand;
     this.toolTip.ShowAlways = true;
     this.EnableControls();
     this.panBottom.Layout += new LayoutEventHandler(this.panBottom_Layout);
 }
Example #6
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && (this.components != null))
     {
         this.components.Dispose();
         this.KillIEComExceptionTimer();
         if (this._dataBrowser != null)
         {
             this._dataBrowser.ObjectForScripting = null;
         }
         this._pluginWinManager.Reset(false);
         this._query.Dispose();
         this._query = null;
         this._schemaTree.AfterSelect -= new TreeViewEventHandler(this._schemaTree_AfterSelect);
         if (this._docMan != null)
         {
             this._docMan.Dispose();
         }
         this._docMan = null;
         if (this._readLinePanel != null)
         {
             this._readLinePanel.Dispose();
             this._readLinePanel = null;
         }
         this._dataBrowser.Dispose();
         this._lambdaBrowser.Dispose();
         this._ilBrowser.Dispose();
         this._dataPanel.Dispose();
         this._lambdaPanel.Dispose();
         this._ilPanel.Dispose();
         this._refreshTimer.Dispose();
         this._clockTimer.Dispose();
         this._autoSaveTimer.Dispose();
         this._executionTrackingTimer.Dispose();
         this._pluginWinManager.Dispose();
     }
     base.Dispose(disposing);
 }
Example #7
0
 private QueryControl AddQueryPage(RunnableQuery q, bool focusEllipses, bool afterCurrent)
 {
     QueryControl control;
     if ((this.NextCacheQueryControl == null) || (this.NextCacheQueryControl.Query != q))
     {
         control = new QueryControl(q, this.schemaTree);
     }
     else
     {
         control = this._cacheQueryControls.Dequeue();
     }
     if (this.VerticalResultsLayout)
     {
         control.SetVerticalLayout();
     }
     control.Dock = DockStyle.Fill;
     control.QueryClosed += new EventHandler(this.qc_QueryClosed);
     q.QueryChanged += new EventHandler<QueryChangedEventArgs>(this.q_QueryChanged);
     if (Program.PresentationMode)
     {
         control.NextQueryRequest += new EventHandler(this.qc_NextQueryRequest);
         control.PreviousQueryRequest += new EventHandler(this.qc_PreviousQueryRequest);
     }
     control.UpdateEditorZoom();
     if (this.ResultsDockForm.AreResultsTorn)
     {
         this.ResultsDockForm.CheckQuery(control);
     }
     TabPage tabPage = new TabPage(q.Name);
     int left = Control.DefaultFont.Height / 5;
     tabPage.Padding = new Padding(left, 1, left, 0);
     tabPage.UseVisualStyleBackColor = true;
     tabPage.Controls.Add(control);
     this._queryPages[q] = tabPage;
     this.tcQueries.SuspendLayout();
     try
     {
         if (afterCurrent && (this.tcQueries.TabPages.Count > 0))
         {
             this.tcQueries.TabPages.Insert(this.tcQueries.SelectedIndex + 1, tabPage);
         }
         else
         {
             this.tcQueries.TabPages.Add(tabPage);
         }
         this.tcQueries.SelectedTab = tabPage;
     }
     finally
     {
         this.tcQueries.ResumeLayout();
     }
     control.FocusQuery(focusEllipses);
     control.FixEditorScrollBars();
     this.UpdateMessagePosition();
     this.schemaTree.UpdateSqlMode((this.CurrentQueryControl == null) ? null : this.CurrentQueryControl.Query);
     return control;
 }
Example #8
0
 internal void UpdateQueryUI(RunnableQuery q)
 {
     if ((q != null) && this._queryPages.ContainsKey(q))
     {
         string str = q.Name + (q.IsModified ? "*" : "") + (q.IsReadOnly ? " (read-only)" : ((q.LastMoved > DateTime.UtcNow.AddSeconds(-10.0)) ? " (moved)" : ""));
         if (str != this._queryPages[q].Text)
         {
             this._queryPages[q].Text = str;
         }
     }
 }
Example #9
0
 private void tcQueries_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this._lastQueryControl != null)
     {
         this._lastQueryControl.OnNoLongerSelectedPage();
     }
     this._lastQueryControl = this.CurrentQueryControl;
     this._lastQuery = (this._lastQueryControl == null) ? null : this._lastQueryControl.Query;
     this.UpdateTreeSelections();
     if (this.CurrentQueryControl != null)
     {
         this.CurrentQueryControl.OnNewlySelectedPage();
         if (this.CurrentQueryControl.Query.Repository != null)
         {
             this.schemaTree.RegisterRepository(this.CurrentQueryControl.Query, false, true);
         }
     }
     this.UpdateMessagePosition();
     this._resultsDockForm.QueryActivated(this.CurrentQueryControl);
     this.schemaTree.UpdateSqlMode((this.CurrentQueryControl == null) ? null : this.CurrentQueryControl.Query);
 }