diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs')
-rw-r--r-- | main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs b/main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs index 70c59b68ec..fb9109f3bc 100644 --- a/main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs +++ b/main/src/addins/CBinding/Parser/CompilationUnitDataProvider.cs @@ -37,17 +37,21 @@ using MonoDevelop.Ide.CodeCompletion; using MonoDevelop.Components; using Gtk; +using MonoDevelop.Ide.Editor; namespace CBinding.Parser { // Yoinked from C# binding public class CompilationUnitDataProvider : DropDownBoxListWindow.IListDataProvider { - Document Document { get; set; } + TextEditor editor; + + DocumentContext DocumentContext { get; set; } - public CompilationUnitDataProvider (Document document) + public CompilationUnitDataProvider (TextEditor editor, DocumentContext documentContext) { - this.Document = document; + this.editor = editor; + this.DocumentContext = documentContext; } #region IListDataProvider implementation @@ -55,7 +59,7 @@ namespace CBinding.Parser public string GetMarkup (int n) { - return GLib.Markup.EscapeText (Document.ParsedDocument.UserRegions.ElementAt (n).Name); + return GLib.Markup.EscapeText (DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n).Name); } internal static Xwt.Drawing.Image Pixbuf @@ -70,24 +74,26 @@ namespace CBinding.Parser public object GetTag (int n) { - return Document.ParsedDocument.UserRegions.ElementAt (n); + return DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n); } public void ActivateItem (int n) { - var reg = Document.ParsedDocument.UserRegions.ElementAt (n); - MonoDevelop.Ide.Gui.Content.IExtensibleTextEditor extEditor = Document.GetContent<MonoDevelop.Ide.Gui.Content.IExtensibleTextEditor> (); - if (extEditor != null) - extEditor.SetCaretTo (Math.Max (1, reg.Region.BeginLine), reg.Region.BeginColumn); + var reg = DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n); + var extEditor = editor; + if (extEditor != null) { + extEditor.CaretLocation = new DocumentLocation (Math.Max (1, reg.Region.BeginLine), reg.Region.BeginColumn); + extEditor.StartCaretPulseAnimation (); + } } public int IconCount { get { - if (Document.ParsedDocument == null) + if (DocumentContext.ParsedDocument == null) return 0; - return Document.ParsedDocument.UserRegions.Count (); + return DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.Count (); } } |