public static CodeCompletionKeyHandler Attach(ScriptForm 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);
        }
예제 #2
0
        public static void Register(ScriptForm mainForm)
        {
            // Must be implemented. Gets the parse information for the specified file.
            HostCallback.GetParseInformation = delegate(string fileName) {
                if (fileName != ScriptForm.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");
            };
        }
 private CodeCompletionKeyHandler(ScriptForm mainForm, TextEditorControl editor)
 {
     this.mainForm = mainForm;
     this.editor   = editor;
 }
예제 #4
0
        public void ShowScriptForm(PBCommandBarButton commandBarButton, ref bool b1)
        {
            ScriptForm frm = new ScriptForm(m_theApp);

            frm.ShowDialog();
        }
 public CodeCompletionProvider(ScriptForm mainForm)
 {
     this.mainForm = mainForm;
 }