bool TextArea_KeyEventHandler(char ch) { if (provider != null) { if (codeCompletionWindow != null) { if (char.IsLetterOrDigit(ch) || ch == '_' || ch == '$') { if (codeCompletionWindow.ProcessKeyEvent(ch)) { return(true); } } else { codeCompletionWindow.Close(); } } if (codeCompletionWindow == null && char.IsLetterOrDigit(ch) || ch == '_') { codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(mainForm, editor, editor.FileName, provider, ch); if (codeCompletionWindow != null) { codeCompletionWindow.FormClosed += new System.Windows.Forms.FormClosedEventHandler(codeCompletionWindow_FormClosed); } } } return(false); }
private bool TextAreaKeyEventHandler(char key) { if (codeCompletionWindow != null) { if (codeCompletionWindow.ProcessKeyEvent(key)) { return(true); } } if (key == '.') { ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(this); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( this, // The parent window for the completion window _textEditor, // The text editor to show the window for this.ContentFile.FullName, // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions key // Key pressed - will be passed to the provider ); if (codeCompletionWindow != null) { codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } } return(false); }
/// <summary> /// Return true to handle the keypress, return false to let the text area handle the keypress /// </summary> bool TextAreaKeyEventHandler(char key) { if (codeCompletionWindow != null) { // If completion window is open and wants to handle the key, don't let the text area // handle it if (codeCompletionWindow.ProcessKeyEvent(key)) { return(true); } } if (key == '.') { ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(mainForm); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( mainForm, // The parent window for the completion window editor, // The text editor to show the window for MainForm.DummyFileName, // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions key // Key pressed - will be passed to the provider ); if (codeCompletionWindow != null) { // ShowCompletionWindow can return null when the provider returns an empty list codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } } return(false); }
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider) { completionWindow = CodeCompletionWindow.ShowCompletionWindow(textEditorControl.ParentForm, textEditorControl, String.Empty, completionDataProvider, ' '); if (completionWindow != null) { completionWindow.Closed += CompletionWindowClosed; } }
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch) { codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(WorkbenchSingleton.MainForm, this, this.FileName, completionDataProvider, ch); if (codeCompletionWindow != null) { codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } }
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch) { codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(this.FindForm(), this, this.FileName, completionDataProvider, ch); if (codeCompletionWindow != null) { codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } }
/// <summary> /// Displays the code completion window. /// </summary> /// <param name="p_chrChar">The character that was typed that caused the code window to display.</param> public void ShowCodeCompletionWindow(char p_chrChar) { m_ccwCodeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(this.FindForm(), this, null, m_cdpXmlCompletionProvider, p_chrChar, true, false); //m_ccwCodeCompletionWindow is null if there are no valid completions if (m_ccwCodeCompletionWindow != null) { m_ccwCodeCompletionWindow.Closed += new EventHandler(DisposeCodeCompletionWindow); } }
public override void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char firstChar) { completionWindow = CodeCompletionWindow.ShowCompletionWindow(textEditorControl.ParentForm, textEditorControl, String.Empty, completionDataProvider, firstChar); if (completionWindow != null) { completionWindow.Width = 250; completionWindow.Closed += CompletionWindowClosed; } }
void CloseCodeCompletionWindow(object sender, EventArgs e) { if (codeCompletionWindow != null) { codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow); codeCompletionWindow.Dispose(); codeCompletionWindow = null; } }
private void CompletionWindow_Closed(object sender, EventArgs e) { if (mCompletionWindow != null) { mCompletionWindow.Closed -= new EventHandler(CompletionWindow_Closed); mCompletionWindow.Dispose(); mCompletionWindow = null; } }
void codeCompletionWindow_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) { if (codeCompletionWindow != null) { codeCompletionWindow.FormClosed -= new System.Windows.Forms.FormClosedEventHandler(codeCompletionWindow_FormClosed); codeCompletionWindow.Dispose(); codeCompletionWindow = null; } }
private void CloseCodeCompletionWindow(object sender, EventArgs e) { if (_codeCompletionWindow != null) { _codeCompletionWindow.Closed -= CloseCodeCompletionWindow; _codeCompletionWindow.Dispose(); _codeCompletionWindow = null; } }
void CloseCodeCompletionWindow(object sender, EventArgs e) { if (FCompletionWindow != null) { FCompletionWindow.Closed -= CloseCodeCompletionWindow; FCompletionWindow.Dispose(); FCompletionWindow = null; } }
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch) { _codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( ParentForm, this, FileName, completionDataProvider, ch); if (_codeCompletionWindow != null) { _codeCompletionWindow.Closed += CloseCodeCompletionWindow; } }
private void CompletionWindowClosed(object source, EventArgs e) { if (completionWindow != null) { completionWindow.Closed -= CompletionWindowClosed; completionWindow.Dispose(); completionWindow = null; } }
/// <summary> /// Disposes of the code completion window when it closes. /// </summary> /// <param name="sender">The object that triggered the event.</param> /// <param name="e">An <see cref="EventArgs" /> describing the event arguments.</param> private void DisposeCodeCompletionWindow(object sender, EventArgs e) { if (m_ccwCodeCompletionWindow != null) { m_ccwCodeCompletionWindow.Closed -= DisposeCodeCompletionWindow; m_ccwCodeCompletionWindow.Dispose(); m_ccwCodeCompletionWindow = null; } }
void CloseCodeCompletionWindow(object sender, EventArgs e) { if (FCompletionWindow != null) { FCompletionWindow.Closed -= CloseCodeCompletionWindow; FCompletionWindow.Dispose(); FCompletionWindow = null; } ActiveTextAreaControl.DoHandleMousewheel = true; }
private void OnClose(object sender, EventArgs e) { if (_codeCompletionWindow != null) { _codeCompletionWindow.Closed -= OnClose; _codeCompletionWindow.MouseWheel -= CodeCompletionWindowOnMouseWheel; _codeCompletionWindow.Dispose(); _codeCompletionWindow = null; } }
// Was part of the CodeCompletionKeyHandler file /// <summary> /// Return true to handle the keypress, return false to let the text area handle the keypress /// </summary> public bool TextAreaKeyEventHandler(char key) { if (codeCompletionWindow != null) { // If completion window is open and wants to handle the key, don't let the text area // handle it if (codeCompletionWindow != null) { if (codeCompletionWindow.ProcessKeyEvent(key)) { return(true); } } } // "key pressed:{0}".format(key).info(); if (key == '.') { //O2Thread.mtaThread( //I really want to run this on a separate thread but It is causing a weird problem where the codecomplete only happens after the 2nd char //() => //{ currentExpression = FindExpression(); //var o2Timer = new O2Timer("Code Completion").start(); //textEditor.invokeOnThread(()=> textEditor.textArea().Caret.Column ++ ); try { //startOffset = textEditor.currentOffset() + 1; // it was +1 before we made this run on an mta thread ICompletionDataProvider completionDataProvider = this; //new CodeCompletionProvider(this); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( textEditor.ParentForm, // The parent window for the completion window textEditor, // The text editor to show the window for DummyFileName, // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions key // Key pressed - will be passed to the provider ); if (codeCompletionWindow != null) { // ShowCompletionWindow can return null when the provider returns an empty list codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } //textEditor.insertTextAtCurrentCaretLocation("."); } catch (Exception ex) { ex.log("in O2CodeCompletion.TextAreaKeyEventHandler"); } // o2Timer.stop(); //}); // return true; } return(false); }
private void ShowSync(char value) { if (_editor.IsReadOnly || !_editor.Enabled) { return; } if (_codeCompletionWindow != null) { _codeCompletionWindow.Close(); } ICompletionDataProvider completionDataProvider = new CompletionProviderImpl(_intellisenseImageList); _codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( _editor.FindForm(), // The parent window for the completion window _editor, // The text editor to show the window for "", // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions value // Key pressed - will be passed to the provider ); // ShowCompletionWindow can return null when the provider returns an empty list if (_codeCompletionWindow == null) { return; } _codeCompletionWindow.Closed += OnClose; var completions = completionDataProvider.GenerateCompletionData("", _editor.ActiveTextAreaControl.TextArea, value) ?? new ICompletionData[0]; if (!completions.Any()) { return; } _codeCompletionWindow.MouseWheel += CodeCompletionWindowOnMouseWheel; using (var g = _codeCompletionWindow.CreateGraphics()) { var width = (int)completions.Select(data => g.MeasureString(data.Text, _codeCompletionWindow.Font).Width).Max(); width += 16; // Icon size width += SystemInformation.VerticalScrollBarWidth; if (width > _codeCompletionWindow.Width) { _codeCompletionWindow.Width = width; } } }
public void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch) { #if ModifiedForAltaxo Form active = Form.ActiveForm; codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(active, this, this.FileName, completionDataProvider, ch); #else codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow((Form)WorkbenchSingleton.Workbench, this, this.FileName, completionDataProvider, ch); #endif if (codeCompletionWindow != null) { codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); } }
private CodeCompletionWindow ShowAttributeList(CodeCompletionWindow window, EditorControl editor, char keyChar, string tagName) { if (window != null && !window.Visible) { return(CodeCompletionWindow.ShowCompletionWindow(MainForm.mainForm, editor, global.htmlDef, htmlDataProvider, keyChar, tagName)); } else if (window == null) { return(CodeCompletionWindow.ShowCompletionWindow(MainForm.mainForm, editor, global.htmlDef, htmlDataProvider, keyChar, tagName)); } return(window); }
void CloseCodeCompletionWindow(object sender, EventArgs e) { if (m_codeCompletionWindow != null) { m_codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow); m_codeCompletionWindow.Dispose(); m_codeCompletionWindow = null; } if (m_conn != null) { m_conn.Connection.BeginClose(EmptyCallback); m_conn = null; } }
void TextArea_KeyPress(object sender, KeyPressEventArgs e) { if (handleKey) { if (e.KeyChar == '<') { e.KeyChar = '\0'; editor.Document.Insert(editor.Caret.Offset, "<"); editor.Caret.Position = editor.Document.OffsetToPosition(editor.Caret.Offset + 1); string html = GetHTMLTag(editor.ActiveTextAreaControl.TextArea); if (html == String.Empty) { windowHtml = CodeCompletionWindow.ShowCompletionWindow(MainForm.mainForm, editor, global.htmlDef, htmlDataProvider, '<'); } } else if (Char.IsWhiteSpace(e.KeyChar)) { string html = GetHTMLTag(editor.ActiveTextAreaControl.TextArea); string attribute = String.Empty; attribute = GetAttribute(editor.ActiveTextAreaControl.TextArea); e.KeyChar = '\0'; editor.Document.Insert(editor.Caret.Offset, " "); editor.Caret.Position = editor.Document.OffsetToPosition(editor.Caret.Offset + 1); if ((html != String.Empty) && (attribute == string.Empty)) { windowHtml = ShowAttributeList(windowHtml, editor, ' ', html); } } else if (e.KeyChar == '"') { string html = GetHTMLTag(editor.ActiveTextAreaControl.TextArea); string attribute = String.Empty; if (html != String.Empty) { attribute = GetAttribute(editor.ActiveTextAreaControl.TextArea); html += "|" + attribute; } e.KeyChar = '\0'; editor.Document.Insert(editor.Caret.Offset, "\""); editor.Caret.Position = editor.Document.OffsetToPosition(editor.Caret.Offset + 1); if (attribute != string.Empty) { windowHtml = ShowAttributeList(windowHtml, editor, '"', html); } } } }
private void InitializeCodeCompletion() { _textEdit.ActiveTextAreaControl.TextArea.KeyEventHandler += ( AKey => { // Send the command to the existing code completion window if there is one if (_codeCompletionWindow != null) { if (_codeCompletionWindow.ProcessKeyEvent(AKey)) { return(true); } } // Handle the request to show code completion if (AKey == ' ' && ModifierKeys == Keys.Control) { var completionDataProvider = new D4CompletionDataProvider(this.Dataphoria); _codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow ( this, _textEdit, Text, completionDataProvider, AKey ); if (_codeCompletionWindow != null) { _codeCompletionWindow.Closed += ( (ASender, AE) => { if (_codeCompletionWindow != null) { _codeCompletionWindow.Dispose(); _codeCompletionWindow = null; } } ); } return(true); } return(false); } ); }
/// <summary> /// KAGファイルでキー入力イベントが発生したとき /// </summary> /// <param name="ch"></param> private void kagKeyEventHandler(char ch) { switch (ch) { case '[': //タグ呼び出しの時 case '@': //タグ呼び出しの時 case ' ': //属性名呼び出しの時 case '=': //属性値呼び出しの時 m_codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(GlobalStatus.FormManager.MainForm , this, this.FileName, KagCompDataPrv, ch); break; default: break; } }
void OnBufferChanged(object sender, TextChangeArgs args) { if (!_enabled.Value) { return; } if (ShouldCloseCompletionWindow(args.NewText)) { _state = State.Idle; CodeCompletionWindow.CloseList(); return; } _state = State.UpdateScreenRectNeeded; _codeView.Repaint(); }
public override void Execute(ICSharpCode.TextEditor.TextArea textArea) { TextEditorEx editor = (TextEditorEx)textArea.MotherTextEditorControl; switch (FileType.GetKrkrType(editor.FileName)) { case FileType.KrkrType.Kag: //KAG入力補完 editor.m_codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(GlobalStatus.FormManager.MainForm , editor, editor.FileName, editor.KagCompDataPrv, '\0'); break; case FileType.KrkrType.Tjs: //未実装 break; } }
private bool TextAreaKeyEventHandler(char key) { if (_codeCompletionWindow != null) { // If completion window is open and wants to handle the key, don't let the text area // handle it if (_codeCompletionWindow.ProcessKeyEvent(key)) { return(true); } } if (key == '.') { ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(_iForm); _codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow( _iForm, // The parent window for the completion window _editor, // The text editor to show the window for IntellisenseForm.DummyFileName, // Filename - will be passed back to the provider completionDataProvider, // Provider to get the list of possible completions key // Key pressed - will be passed to the provider ); if (_codeCompletionWindow != null) { // ShowCompletionWindow can return null when the provider returns an empty list _codeCompletionWindow.Closed += CloseCodeCompletionWindow; } } else if (key == '(') { if (_insightWindow != null && (!_insightWindow.IsDisposed)) { // provider returned an empty list, so the window never been opened CloseInsightWindow(this, EventArgs.Empty); } IInsightDataProvider insightdataprovider = new MethodInsightDataProvider(_iForm); _insightWindow = new InsightWindow(_iForm, _editor); _insightWindow.Closed += CloseInsightWindow; _insightWindow.AddInsightDataProvider(insightdataprovider, IntellisenseForm.DummyFileName); _insightWindow.ShowInsightWindow(); } return(false); }
public bool TextArea_DoProcessDialogKey(Keys keyData) { if (keyData == (Keys.Space | Keys.Control)) { string tagBeforeCaret = getHtmlTagAtCaret(editor.ActiveTextAreaControl.TextArea); string html = GetHTMLTag(editor.ActiveTextAreaControl.TextArea); string attribute = String.Empty; //string html = GetHTMLTag(editor.ActiveTextAreaControl.TextArea); if (tagBeforeCaret != String.Empty && tagBeforeCaret != "<") { windowHtml = CodeCompletionWindow.ShowCompletionWindow(MainForm.mainForm, editor, global.htmlDef, htmlDataProvider, '<', tagBeforeCaret); } else if (tagBeforeCaret == "<") { windowHtml = CodeCompletionWindow.ShowCompletionWindow(MainForm.mainForm, editor, global.htmlDef, htmlDataProvider, '<'); } else if (html != String.Empty) { attribute = GetAttribute(editor.ActiveTextAreaControl.TextArea); string attributeAtCaret = getWordBeforeCaret(); char charTyped = '\0'; if (attribute != string.Empty) { html += "|" + attribute; charTyped = '"'; } else if (attributeAtCaret != string.Empty) { html += "|" + attributeAtCaret; charTyped = ' '; } else { charTyped = ' '; } windowHtml = ShowAttributeList(windowHtml, editor, charTyped, html); } return(true); } return(false); }
private void CodeCompletionWindowClosed(object sender, EventArgs e) { codeCompletionWindow.Closed -= new EventHandler(CodeCompletionWindowClosed); codeCompletionWindow.Dispose(); codeCompletionWindow = null; }
private void ShowCompletionWindow(char ch) { if (IsCodeCompletionWindowOpen) { codeCompletionWindow.Close(); } if (IsCodeCompletionEnabled) { XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(schemaCompletionDataItems, defaultSchemaCompletionData, defaultNamespacePrefix); codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(ParentForm, this, FileName, completionDataProvider, ch, XmlEditorAddInOptions.ShowSchemaAnnotation); if (codeCompletionWindow != null) { codeCompletionWindow.Closed += new EventHandler(CodeCompletionWindowClosed); } } }