static Window CreatePackageWindow(InfoItem infoItem) { var window = new TooltipInformationWindow(); window.ShowArrow = true; window.RepositionWindow(); var cts = new CancellationTokenSource(); window.Closed += delegate { cts.Cancel(); }; var packages = infoItem.Packages; TooltipInformation ti; bool done = CreatePackageTooltipInfo((string)infoItem.ResolveResult.Reference, packages, out ti); if (!done) { packages.ContinueWith(t => { if (!done) { done = CreatePackageTooltipInfo((string)infoItem.ResolveResult.Reference, packages, out ti); if (ti != null) { window.Clear(); window.AddOverload(ti); } } }, cts.Token, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); } window.AddOverload(ti); return(window); }
protected override Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { var doc = IdeApp.Workbench.ActiveDocument; if (doc == null) { return(null); } var titem = (ToolTipData)item.Item; var tooltipInformation = CreateTooltip(titem, offset, null, modifierState); if (tooltipInformation == null || string.IsNullOrEmpty(tooltipInformation.SignatureMarkup)) { return(null); } var result = new TooltipInformationWindow(); result.ShowArrow = true; result.AddOverload(tooltipInformation); result.RepositionWindow(); return(result); }
public override Window CreateTooltipWindow( TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var result = new TooltipInformationWindow(); result.ShowArrow = true; result.AddOverload((TooltipInformation)item.Item); result.RepositionWindow(); return(result); }
async void ShowTooltip() { var currentSelectedItem = selectedItem; if (currentSelectedItem == null || currentSelectedItem.DataSource == null) { HideTooltip(); return; } var i = currentSelectedItem.Item; if (i < 0 || i >= currentSelectedItem.DataSource.Count) { return; } if (tooltipSrc != null) { tooltipSrc.Cancel(); } tooltipSrc = new CancellationTokenSource(); var token = tooltipSrc.Token; try { currentTooltip = await currentSelectedItem.DataSource [i].GetTooltipInformation(token); } catch (OperationCanceledException) { HideTooltip(); return; } catch (Exception e) { LoggingService.LogError("Error while creating search popup window tooltip", e); HideTooltip(); return; } if (currentTooltip == null || string.IsNullOrEmpty(currentTooltip.SignatureMarkup) || token.IsCancellationRequested) { HideTooltip(); return; } declarationviewwindow.Hide(); declarationviewwindow.Clear(); declarationviewwindow.AddOverload(currentTooltip); declarationviewwindow.CurrentOverload = 0; declarationviewwindow.ShowArrow = true; var rect = SelectedItemRectangle; declarationviewwindow.ShowPopup(this, new Rectangle(0, (int)rect.Y - 5, Bounds.Width, (int)rect.Height), PopupPosition.Right); }
public override Components.Window CreateTooltipWindow(Ide.Editor.TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var doc = ctx; if (doc == null) { return(null); } var result = new TooltipInformationWindow(); result.ShowArrow = true; result.AddOverload((TooltipInformation)item.Item); result.RepositionWindow(); return(result); }
void ShowTooltip() { HideTooltip(); var currentSelectedItem = selectedItem; if (currentSelectedItem == null || currentSelectedItem.DataSource == null) { return; } var i = currentSelectedItem.Item; if (i < 0 || i >= currentSelectedItem.DataSource.ItemCount) { return; } if (tooltipSrc != null) { tooltipSrc.Cancel(); } tooltipSrc = new CancellationTokenSource(); var token = tooltipSrc.Token; ThreadPool.QueueUserWorkItem(delegate { TooltipInformation tooltip; try { tooltip = currentSelectedItem.DataSource.GetTooltip(i); } catch (Exception e) { LoggingService.LogError("Error while creating search popup window tooltip", e); return; } if (tooltip == null || string.IsNullOrEmpty(tooltip.SignatureMarkup) || token.IsCancellationRequested) { return; } Application.Invoke(delegate { if (token.IsCancellationRequested) { return; } declarationviewwindow.Clear(); declarationviewwindow.AddOverload(tooltip); declarationviewwindow.CurrentOverload = 0; declarationViewTimer = GLib.Timeout.Add(250, DelayedTooltipShow); }); }); }
static Window CreateItemWindow(InfoItem infoItem) { TooltipInformation ti = null; ti = CreateTooltipInformation(infoItem.Doc, infoItem.Info, infoItem.ResolveResult); if (ti == null) { return(null); } var window = new TooltipInformationWindow(); window.AddOverload(ti); window.ShowArrow = true; window.RepositionWindow(); return(window); }
private async Task UpdateDescription() { if (descriptionWindow != null) { descriptionWindow.Destroy(); descriptionWindow = null; } descriptionCts.Cancel(); if (SelectedItemIndex == -1) { return; } var completionItem = SelectedItem; descriptionCts = new CancellationTokenSource(); var token = descriptionCts.Token; TooltipInformation description = null; try { var document = _subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChangesSafe(); description = await RoslynCompletionData.CreateTooltipInformation(document, completionItem, false, token); } catch { } if (token.IsCancellationRequested) { return; } if (descriptionWindow != null) { descriptionWindow.Destroy(); descriptionWindow = null; } if (description == null) { return; } var window = new TooltipInformationWindow(); window.AddOverload(description); descriptionWindow = window; ShowDescription(); }
void ShowDescription(TooltipInformation description) { HideDescription(); if (description == null) { return; } var window = new TooltipInformationWindow(); window.AddOverload(description); descriptionWindow = window; var rect = GetRowArea(SelectedItemIndex); int y = rect.Y + Theme.Padding - (int)vadj.Value; descriptionWindow.ShowPopup(this, new Gdk.Rectangle(0, Math.Min(Allocation.Height, Math.Max(0, y)), Allocation.Width, rect.Height), PopupPosition.Left); descriptionWindow.Show(); }
protected override Window CreateTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { var doc = IdeApp.Workbench.ActiveDocument; if (doc == null) { return(null); } var titem = item.Item as AbstractType; if (titem == null) { return(null); } var result = new TooltipInformationWindow(); result.ShowArrow = true; foreach (var i in AmbiguousType.TryDissolve(titem)) { if (i == null) { continue; } var tooltipInformation = TooltipInfoGen.Create(i, editor.ColorStyle); if (tooltipInformation != null && !string.IsNullOrEmpty(tooltipInformation.SignatureMarkup)) { result.AddOverload(tooltipInformation); } } if (result.Overloads < 1) { result.Dispose(); return(null); } result.RepositionWindow(); return(result); }
public override Control CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState) { var doc = ctx; if (doc == null) { return(null); } var titem = (ToolTipData)item.Item; var tooltipInformation = CreateTooltip(titem, editor, ctx, offset, modifierState); if (tooltipInformation == null || string.IsNullOrEmpty(tooltipInformation.SignatureMarkup)) { return(null); } var result = new TooltipInformationWindow(); result.ShowArrow = true; result.AddOverload(tooltipInformation); result.RepositionWindow(); return(result); }