Пример #1
0
        /// <summary>
        /// Add completion data without searching through the Java library first
        /// </summary>
        private static void AddCompletion_Data(string data)
        {
            if (CompletionList.Contains(data))
            {
                return;
            }
            if (data.Length < 1)
            {
                return;
            }

            CompletionList.Add(data);
        }
Пример #2
0
        private void TextEditor_TextArea_TextEntering(object sender, TextCompositionEventArgs e)
        {
            if (SyntaxHighlighting != HighlightingManager.GetHighlightingFromExtension(".java"))
            {
                return;
            }

            string wordContext = GetClosedWordToCursor(CaretOffset);

            if (EditorCompletionWindow._editorCompletionList.SelectedItem == null && _completionWindow != null)
            {
                _completionWindow.Close();
            }
            else if (e.Text[0] == '.' && EditorCompletionWindow._editorCompletionList.SelectedItem?.Text.Length < 1)
            {
                InitializeCompletionWindow(wordContext);
            }

            if (e.Text[0] == ';')
            {
                if (_classList.Contains(wordContext.Replace(".", "/")))
                {
                    AddCompletionData(wordContext);
                }

                EditorCompletionWindow._editorCompletionList.RequestInsertion(e);
            }
            else if (e.Text[0] == '\n' && _completionWindow != null)
            {
                _completionWindow.Close();
            }
            else if (e.Text.Length > 1 && _completionWindow != null && !char.IsLetterOrDigit(e.Text[0]) && wordContext != "")
            {
                if (!CompletionList.Contains(wordContext) && _completionWindow == null)
                {
                    AddCompletionData(wordContext);
                }
                else if (wordContext.Length > 0 && !CompletionList.Contains(wordContext))
                {
                    EditorCompletionWindow._editorCompletionList.RequestInsertion(e);
                }
            }
        }