コード例 #1
0
        public static void Register(MainForm mainForm)
        {
            // Must be implemented. Gets the parse information for the specified file.
            HostCallback.GetParseInformation = delegate(string fileName) {
                if (fileName != MainForm.DummyFileName)
                    throw new Exception("Unknown file");
                if (mainForm.lastCompilationUnit == null)
                    return null;
                ParseInformation pi = new ParseInformation();
                pi.ValidCompilationUnit = mainForm.lastCompilationUnit;
                return pi;
            };

            // Must be implemented. Gets the project content of the active project.
            HostCallback.GetCurrentProjectContent = delegate {
                return mainForm.myProjectContent;
            };

            // The default implementation just logs to Log4Net. We want to display a MessageBox.
            // Note that we use += here - in this case, we want to keep the default Log4Net implementation.
            HostCallback.ShowError += delegate(string message, Exception ex) {
                MessageBox.Show(message + Environment.NewLine + ex.ToString());
            };
            HostCallback.ShowMessage += delegate(string message) {
                MessageBox.Show(message);
            };
            HostCallback.ShowAssemblyLoadError += delegate(string fileName, string include, string message) {
                MessageBox.Show("Error loading code-completion information for "
                                + include + " from " + fileName
                                + ":\r\n" + message + "\r\n");
            };
        }
コード例 #2
0
        public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor)
        {
            CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor);

            editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler;

            // When the editor is disposed, close the code completion window
            editor.Disposed += h.CloseCodeCompletionWindow;

            return h;
        }
コード例 #3
0
 private CodeCompletionKeyHandler(MainForm mainForm, TextEditorControl editor)
 {
     this.mainForm = mainForm;
     this.editor = editor;
 }
コード例 #4
0
 public CodeCompletionProvider(MainForm mainForm)
 {
     this.mainForm = mainForm;
 }