public void Query(DatabaseObjectDisplayInfo displayInfo) { this.ucSqlQuery.Editor.AppendText(displayInfo.Content); RichTextBoxHelper.Highlighting(this.ucSqlQuery.Editor, displayInfo.DatabaseType, false); this.ucSqlQuery.RunScripts(displayInfo); }
private void txtEditor_SelectionChanged(object sender, EventArgs e) { this.txtEditor.SelectionFont = this.txtEditor.Font; if (this.isPasting) { this.isPasting = false; RichTextBoxHelper.Highlighting(this.txtEditor, this.DatabaseType); } }
private void ShowScripts(RichTextBox textBox, string scripts) { textBox.Clear(); if (!string.IsNullOrEmpty(scripts)) { textBox.AppendText(scripts.Trim()); RichTextBoxHelper.Highlighting(textBox, this.targetDbProfile.DatabaseType, false); } }
private void SetTabPageContent(DatabaseObjectDisplayInfo info, TabPage tabPage) { if (info.DisplayType == DatabaseObjectDisplayType.Script) { UC_SqlQuery sqlQuery = this.GetUcControl <UC_SqlQuery>(tabPage); if (sqlQuery == null) { sqlQuery = this.AddControlToTabPage <UC_SqlQuery>(tabPage); } sqlQuery.Show(info); if (!string.IsNullOrEmpty(sqlQuery.Editor.Text)) { RichTextBoxHelper.Highlighting(sqlQuery.Editor, info.DatabaseType, false); if (info.Error != null) { RichTextBoxHelper.HighlightingError(sqlQuery.Editor, info.Error); } } else { sqlQuery.Editor.Focus(); } } else if (info.DisplayType == DatabaseObjectDisplayType.Data) { UC_DataViewer dataViewer = this.GetUcControl <UC_DataViewer>(tabPage); if (dataViewer == null) { dataViewer = this.AddControlToTabPage <UC_DataViewer>(tabPage); dataViewer.OnDataFilter += this.DataFilter; } dataViewer.Show(info); } else if (info.DisplayType == DatabaseObjectDisplayType.TableDesigner) { UC_TableDesigner tableDesigner = this.GetUcControl <UC_TableDesigner>(tabPage); if (tableDesigner == null) { tableDesigner = this.AddControlToTabPage <UC_TableDesigner>(tabPage); tableDesigner.OnFeedback += this.Feedback; } tableDesigner.Show(info); } }
public void LoadScripts(string scripts) { this.txtScripts.AppendText(scripts); RichTextBoxHelper.Highlighting(this.txtScripts, this.DatabaseType, false); }
private void HandleKeyUpFoIntellisense(KeyEventArgs e) { if (e.KeyValue >= 112 && e.KeyValue <= 123) { this.SetWordListViewVisible(false); return; } if (e.KeyCode == Keys.Space) { this.ClearStyleForSpace(); this.SetWordListViewVisible(false); } SqlWordToken token = this.GetLastWordToken(); if (token == null || token.Text == null || token.Type != SqlWordTokenType.None) { this.SetWordListViewVisible(false); if (token != null) { if (token.Type != SqlWordTokenType.String && token.Text.Contains("'")) { this.ClearStyle(token); } } return; } if (this.panelWords.Visible) { if (this.lvWords.Tag is SqlWord word) { if (word.Type == SqlWordTokenType.Table) { string columnName = null; int index = this.txtEditor.SelectionStart; char c = this.txtEditor.Text[index - 1]; if (c != '.') { columnName = token.Text; } this.ShowTableColumns(word.Text, columnName); } else if (word.Type == SqlWordTokenType.Owner) { this.ShowDbObjects(token.Text); } return; } } if (e.KeyData == Keys.OemPeriod) { SqlWord word = this.FindWord(token.Text); if (word.Type == SqlWordTokenType.Table) { this.ShowTableColumns(word.Text); this.lvWords.Tag = word; } else if (word.Type == SqlWordTokenType.Owner) { this.ShowDbObjects(null, word.Text); this.lvWords.Tag = word; } } else if (e.KeyCode == Keys.Back) { if (this.panelWords.Visible) { if (!this.IsMatchWord(token.Text) || this.txtEditor.Text.Length == 0) { this.SetWordListViewVisible(false); } else { this.ShowWordListByToken(token); } } if (token.Text.Length > 0 && this.DbInterpreter.CommentString.Contains(token.Text.Last())) { int start = this.txtEditor.SelectionStart; int lineIndex = this.txtEditor.GetLineFromCharIndex(start); int stop = this.txtEditor.GetFirstCharIndexFromLine(lineIndex) + this.txtEditor.Lines[lineIndex].Length - 1; RichTextBoxHelper.Highlighting(this.txtEditor, this.DatabaseType, true, start, stop); } } else if (e.KeyValue < 48 || (e.KeyValue >= 58 && e.KeyValue <= 64) || (e.KeyValue >= 91 && e.KeyValue <= 96) || e.KeyValue > 122) { this.SetWordListViewVisible(false); } else { this.ShowWordListByToken(token); } }