コード例 #1
0
        public CodeCompletionProvider(Form parentForm, IDatabaseSource conn, SqlEditorAnalyser anal, ImageCache imgCache, char firstChar, TextAreaControl textArea, CodeCompletionSettings settings)
        {
            m_parentForm = parentForm;
            m_conn       = conn;
            m_anal       = anal;
            m_dialect    = m_conn.Dialect;
            m_imgCache   = imgCache;
            m_firstChar  = firstChar;
            m_settings   = settings;

            if (m_firstChar == '\0')
            {
                int    col  = textArea.Caret.Column;
                string line = textArea.Document.GetText(textArea.Document.GetLineSegment(textArea.Caret.Line));
                var    sb   = new StringBuilder();
                while (col >= 1 && (Char.IsLetterOrDigit(line[col - 1]) || line[col - 1] == '_'))
                {
                    sb.Insert(0, line[col - 1]);
                    col--;
                }
                if (sb.Length > 0)
                {
                    m_presel = sb.ToString();
                }
            }
        }
コード例 #2
0
ファイル: InsertJoinForm.cs プロジェクト: janproch/datadmin
        public static void Run(SqlEditorAnalyser anal, CodeEditor editor, CodeCompletionSettings settings)
        {
            var win = new InsertJoinForm(anal, settings);

            if (win.ShowDialogEx() == DialogResult.OK)
            {
                string text = win.GetSqlText();
                editor.InsertTextOnCursor(text);
                editor.ActiveTextAreaControl.Caret.Position = editor.Document.OffsetToPosition(editor.ActiveTextAreaControl.Caret.Offset + text.Length);
            }
        }
コード例 #3
0
ファイル: InsertJoinForm.cs プロジェクト: janproch/datadmin
 public InsertJoinForm(SqlEditorAnalyser anal, CodeCompletionSettings settings)
 {
     InitializeComponent();
     codeEditor1.Dialect = anal.Dialect;
     m_anal     = anal;
     m_settings = settings;
     foreach (var tbl in anal.UsedTables)
     {
         if (tbl.RealTable == null)
         {
             continue;
         }
         lbxExistingTable.Items.Add(tbl);
     }
     if (lbxExistingTable.Items.Count > 0)
     {
         lbxExistingTable.SelectedIndex = 0;
     }
 }