internal void InsertTemplate (CodeTemplate template, MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext context) { using (var undo = editor.OpenUndoGroup ()) { var result = template.InsertTemplateContents (editor, context); var links = result.TextLinks.Select (l => new Mono.TextEditor.TextLink (l.Name) { Links = l.Links.Select (s => new TextSegment (s.Offset, s.Length)).ToList (), IsEditable = l.IsEditable, IsIdentifier = l.IsIdentifier, GetStringFunc = l.GetStringFunc != null ? (Func<Func<string, string>, Mono.TextEditor.PopupWindow.IListDataProvider<string>>)(arg => new ListDataProviderWrapper (l.GetStringFunc (arg))) : null }).ToList (); var tle = new TextLinkEditMode (this, result.InsertPosition, links); tle.TextLinkMode = TextLinkMode.General; if (tle.ShouldStartTextLinkMode) { tle.OldMode = CurrentMode; tle.StartMode (); CurrentMode = tle; GLib.Timeout.Add (10, delegate { tle.UpdateTextLinks (); return false; }); } } }
internal void InsertTemplate (CodeTemplate template, MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext context) { using (var undo = editor.OpenUndoGroup ()) { var result = template.InsertTemplateContents (editor, context); var links = result.TextLinks.Select (l => new Mono.TextEditor.TextLink (l.Name) { Links = l.Links.Select (s => new TextSegment (s.Offset, s.Length)).ToList (), IsEditable = l.IsEditable, IsIdentifier = l.IsIdentifier }).ToList (); var tle = new TextLinkEditMode (this, result.InsertPosition, links); tle.TextLinkMode = TextLinkMode.General; if (tle.ShouldStartTextLinkMode) { tle.OldMode = CurrentMode; tle.StartMode (); CurrentMode = tle; } } }