//文字入力中 private void TextArea_TextEntering(object sender, System.Windows.Input.TextCompositionEventArgs e) { Console.WriteLine("TextArea_TextEntering: " + e.ToString()); //補完Windowが開いている間 if (e.Text.Length > 0 && completionWindow != null) { //英数字以外が入力された場合 if (!char.IsLetterOrDigit(e.Text[0])) { //選択中のリストの項目をエディタに挿入する completionWindow.CompletionList.RequestInsertion(e); } } // HandledはTrueにしない // e.Handled=true; }
//文字入力後 private void TextArea_TextEntered(object sender, System.Windows.Input.TextCompositionEventArgs e) { Console.WriteLine("TextArea_TextEntered: " + e.ToString()); CompletionHelper completionHelpler = new CompletionHelper(); // Ctrl+スペース で入力補完Windowを表示する // 自クラスが保持する属性・操作の一覧("this."付き)と、集約・参照・依存の接続先クラス名が対象 if (e.Text == " " && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))) { //入力補完Windowを生成 completionWindow = new CompletionWindow(jpBehaviorEdit.TextArea); // 補完リストに表示するアイテムをコレクションに追加する IList <ICompletionData> cmplList = completionHelpler.searchCompletionDataFromMyOwn(this.element); foreach (ICompletionData cmp in cmplList) { completionWindow.CompletionList.CompletionData.Add(cmp); } // Windowを表示 completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; } // "$"入力で別Windowを表示する(全クラスから属性・メソッドを一覧検索する) if (e.Text == "$") { // モーダル表示する attrMethSearch = new AttrMethSearch(); attrMethSearch.Owner = GetWindow(this); attrMethSearch.ShowDialog(); //attrMethSearch.Show(); } // ピリオドを入力 -> キャレットの前のキーワードをクラス名とし、配下の属性・要素の一覧を表示する if (e.Text == ".") { string className = getClassNameFromText(jpBehaviorEdit.Text, jpBehaviorEdit.TextArea.Caret.Offset - 1); Console.WriteLine("探しに行くクラス名 = " + className); // 補完リストに表示するアイテムをコレクションに追加する IList <ICompletionData> cmplList = completionHelpler.searchCompletionDataFromClassName(className); if (cmplList != null && cmplList.Count > 0) { //入力補完Windowを生成 completionWindow = new CompletionWindow(jpBehaviorEdit.TextArea); foreach (ICompletionData cmp in cmplList) { completionWindow.CompletionList.CompletionData.Add(cmp); } // Windowを表示 completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; } else { // 補完リストにうまくつながらないと判断した場合、 // クラス名が初期表示された形で属性・操作検索画面をモーダル表示する attrMethSearch = new AttrMethSearch(className); attrMethSearch.Owner = GetWindow(this); attrMethSearch.ShowDialog(); } } }