public override void InsertWithCursor(string operation, AstNode node, InsertPosition defaultPosition)
            {
                var editor     = ctx.Document.Editor;
                var mode       = new InsertionCursorEditMode(editor.Parent, MonoDevelop.Ide.CodeGenerationService.GetInsertionPoints(ctx.Document, ctx.Document.CompilationUnit.GetTypeAt(ctx.Location.Line, ctx.Location.Column)));
                var helpWindow = new Mono.TextEditor.PopupWindow.ModeHelpWindow();

                helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
                helpWindow.TitleText    = string.Format(GettextCatalog.GetString("<b>{0} -- Targeting</b>"), operation);
                helpWindow.Items.Add(new KeyValuePair <string, string> (GettextCatalog.GetString("<b>Key</b>"), GettextCatalog.GetString("<b>Behavior</b>")));
                helpWindow.Items.Add(new KeyValuePair <string, string> (GettextCatalog.GetString("<b>Up</b>"), GettextCatalog.GetString("Move to <b>previous</b> target point.")));
                helpWindow.Items.Add(new KeyValuePair <string, string> (GettextCatalog.GetString("<b>Down</b>"), GettextCatalog.GetString("Move to <b>next</b> target point.")));
                helpWindow.Items.Add(new KeyValuePair <string, string> (GettextCatalog.GetString("<b>Enter</b>"), GettextCatalog.GetString("<b>Accept</b> target point.")));
                helpWindow.Items.Add(new KeyValuePair <string, string> (GettextCatalog.GetString("<b>Esc</b>"), GettextCatalog.GetString("<b>Cancel</b> this operation.")));
                mode.HelpWindow = helpWindow;

                switch (defaultPosition)
                {
                case InsertPosition.Start:
                    mode.CurIndex = 0;
                    break;

                case InsertPosition.End:
                    mode.CurIndex = mode.InsertionPoints.Count - 1;
                    break;

                case InsertPosition.Before:
                    for (int i = 0; i < mode.InsertionPoints.Count; i++)
                    {
                        if (mode.InsertionPoints [i].Location < new DocumentLocation(ctx.Location.Line, ctx.Location.Column))
                        {
                            mode.CurIndex = i;
                        }
                    }
                    break;

                case InsertPosition.After:
                    for (int i = 0; i < mode.InsertionPoints.Count; i++)
                    {
                        if (mode.InsertionPoints [i].Location > new DocumentLocation(ctx.Location.Line, ctx.Location.Column))
                        {
                            mode.CurIndex = i;
                            break;
                        }
                    }
                    break;
                }

                mode.StartMode();
                mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
                    if (iCArgs.Success)
                    {
                        var output = OutputNode(GetIndentLevelAt(editor.LocationToOffset(iCArgs.InsertionPoint.Location)), node);
                        iCArgs.InsertionPoint.Insert(editor, output.Text);
                    }
                };
            }
		void ImplementInterface (bool explicitly)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			var editor = doc.Editor.Parent;
			IType interfaceType = item as IType;
			IType declaringType = klass;
			
			var mode = new Mono.TextEditor.InsertionCursorEditMode (editor, HelperMethods.GetInsertionPoints (doc, declaringType));
			var helpWindow = new Mono.TextEditor.PopupWindow.ModeHelpWindow ();
			helpWindow.TransientFor = IdeApp.Workbench.RootWindow;
			helpWindow.TitleText = GettextCatalog.GetString ("<b>Implement Interface -- Targeting</b>");
			helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Key</b>"), GettextCatalog.GetString ("<b>Behavior</b>")));
			helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Up</b>"), GettextCatalog.GetString ("Move to <b>previous</b> target point.")));
			helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Down</b>"), GettextCatalog.GetString ("Move to <b>next</b> target point.")));
			helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Enter</b>"), GettextCatalog.GetString ("<b>Declare interface implementation</b> at target point.")));
			helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Esc</b>"), GettextCatalog.GetString ("<b>Cancel</b> this refactoring.")));
			mode.HelpWindow = helpWindow;
			mode.CurIndex = mode.InsertionPoints.Count - 1;
			mode.StartMode ();
			mode.Exited += delegate(object s, Mono.TextEditor.InsertionCursorEventArgs args) {
				if (args.Success) {
					var generator = doc.CreateCodeGenerator ();
					args.InsertionPoint.Insert (editor, generator.CreateInterfaceImplementation (declaringType, interfaceType, explicitly));
				}
			};
		}
			public override void InsertWithCursor (string operation, AstNode node, InsertPosition defaultPosition)
			{
				var editor = ctx.Document.Editor;
				var mode = new InsertionCursorEditMode (editor.Parent, MonoDevelop.Ide.CodeGenerationService.GetInsertionPoints (ctx.Document, ctx.Document.CompilationUnit.GetTypeAt (ctx.Location.Line, ctx.Location.Column)));
				var helpWindow = new Mono.TextEditor.PopupWindow.ModeHelpWindow ();
				helpWindow.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
				helpWindow.TitleText = string.Format (GettextCatalog.GetString ("<b>{0} -- Targeting</b>"), operation);
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Key</b>"), GettextCatalog.GetString ("<b>Behavior</b>")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Up</b>"), GettextCatalog.GetString ("Move to <b>previous</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Down</b>"), GettextCatalog.GetString ("Move to <b>next</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Enter</b>"), GettextCatalog.GetString ("<b>Accept</b> target point.")));
				helpWindow.Items.Add (new KeyValuePair<string, string> (GettextCatalog.GetString ("<b>Esc</b>"), GettextCatalog.GetString ("<b>Cancel</b> this operation.")));
				mode.HelpWindow = helpWindow;
				
				switch (defaultPosition) {
				case InsertPosition.Start:
					mode.CurIndex = 0;
					break;
				case InsertPosition.End:
					mode.CurIndex = mode.InsertionPoints.Count - 1;
					break;
				case InsertPosition.Before:
					for (int i = 0; i < mode.InsertionPoints.Count; i++) {
						if (mode.InsertionPoints [i].Location < new DocumentLocation (ctx.Location.Line, ctx.Location.Column))
							mode.CurIndex = i;
					}
					break;
				case InsertPosition.After:
					for (int i = 0; i < mode.InsertionPoints.Count; i++) {
						if (mode.InsertionPoints [i].Location > new DocumentLocation (ctx.Location.Line, ctx.Location.Column)) {
							mode.CurIndex = i;
							break;
						}
					}
					break;
				}
				
				mode.StartMode ();
				mode.Exited += delegate(object s, InsertionCursorEventArgs iCArgs) {
					if (iCArgs.Success) {
						var output = OutputNode (GetIndentLevelAt (editor.LocationToOffset (iCArgs.InsertionPoint.Location)), node);
						iCArgs.InsertionPoint.Insert (editor, output.Text);
					}
				};
			}