public override void InsertCompletionText(CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier)
        {
            //insert the method name
            MonoDevelop.Ide.Gui.Content.IEditableTextBuffer buf = window.CompletionWidget as MonoDevelop.Ide.Gui.Content.IEditableTextBuffer;
            if (buf != null)
            {
                using (var undo = buf.OpenUndoGroup()) {
                    buf.DeleteText(window.CodeCompletionContext.TriggerOffset, buf.CursorPosition - window.CodeCompletionContext.TriggerOffset);
                    buf.InsertText(buf.CursorPosition, methodInfo.Name);
                }
            }

            //generate the codebehind method
            if (codeBehindClassPart != null && project != null)
            {
                BindingService.AddMemberToClass(project, codeBehindClass.GetDefinition(), codeBehindClassPart, methodInfo, false);
            }
            else
            {
                BindingService.AddMemberToClass(project, codeBehindClass.GetDefinition(), codeBehindClass.GetDefinition().Parts.First(), methodInfo, false);
            }
        }
예제 #2
0
        public override void InsertCompletionText(CompletionListWindow window)
        {
            //insert the method name
            MonoDevelop.Ide.Gui.Content.IEditableTextBuffer buf = window.CompletionWidget as MonoDevelop.Ide.Gui.Content.IEditableTextBuffer;
            if (buf != null)
            {
                buf.BeginAtomicUndo();
                buf.DeleteText(window.CodeCompletionContext.TriggerOffset, buf.CursorPosition - window.CodeCompletionContext.TriggerOffset);
                buf.InsertText(buf.CursorPosition, methodInfo.Name);
                buf.EndAtomicUndo();
            }

            //generate the codebehind method
            if (codeBehindClassPart != null && project != null)
            {
                BindingService.AddMemberToClass(project, codeBehindClass, codeBehindClassPart, methodInfo, false);
            }
            else
            {
                BindingService.AddMemberToClass(project, codeBehindClass, codeBehindClass, methodInfo, false);
            }
        }