bool HandleKeyPress(char ch)
        {
            CompletionWindow completionWindow;

            string fileName = FileName;

            switch (ch) {
                case ' ':
                    //TextEditorProperties.AutoInsertTemplates
                    if (1 == 1) {
                        string word = GetWordBeforeCaret();
                        if (word != null) {
                            CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(FileName);

                            if (templateGroup != null) {
                                foreach (CodeTemplate template in templateGroup.Templates) {
                                    if (template.Shortcut == word) {
                                        InsertTemplate(template);
                                        return false;
                                    }
                                }
                            }
                        }
                    }
                    goto case '.';
                case '<':
                    try {
                        completionWindow = new CompletionWindow(this, fileName, new CommentCompletionDataProvider());
                        completionWindow.ShowCompletionWindow('<');
                    } catch (Exception e) {
                        Console.WriteLine("EXCEPTION: " + e);
                    }
                    return false;
                case '(':
                    try {
                        if (insightWindow == null ) {//|| insightWindow.IsDisposed) {
                            insightWindow = new InsightWindow(this, fileName);
                        }

                        insightWindow.AddInsightDataProvider(new MethodInsightDataProvider());
                        insightWindow.ShowInsightWindow();
                    } catch (Exception e) {
                        Console.WriteLine("EXCEPTION: " + e);
                    }
                    return false;
                case '[':
                    try {
                        if (insightWindow == null ) {//|| insightWindow.IsDisposed) {
                            insightWindow = new InsightWindow(this, fileName);
                        }

                        insightWindow.AddInsightDataProvider(new IndexerInsightDataProvider());
                        insightWindow.ShowInsightWindow();
                    } catch (Exception e) {
                        Console.WriteLine("EXCEPTION: " + e);
                    }
                    return false;
                case '.':
                    try {
            //						TextAreaPainter.IHaveTheFocusLock = true;
                        completionWindow = new CompletionWindow(this, fileName, new CodeCompletionDataProvider());
                        completionWindow.ShowCompletionWindow(ch);
            //						TextAreaPainter.IHaveTheFocusLock = false;
                    } catch (Exception e) {
                        Console.WriteLine("EXCEPTION: " + e);
                    }
                    return false;
            }
            return false;
        }
Пример #2
0
 public override void Execute(TextArea services)
 {
     CompletionWindow completionWindow = new CompletionWindow(services.MotherTextEditorControl, "a.cs", new TemplateCompletionDataProvider());
     completionWindow.ShowCompletionWindow('\0');
 }