public FloatingQuickFixIconWidget( CodeActionEditorExtension codeActionEditorExtension, LanguageItemWindow window, SourceEditorView sourceEditorView, CodeActionContainer fixes, Cairo.Point point) : base(Gtk.WindowType.Popup) { this.ext = codeActionEditorExtension; this.window = window; this.sourceEditorView = sourceEditorView; this.fixes = fixes; this.point = point; this.Decorated = false; this.Events |= EventMask.ButtonPressMask | EventMask.LeaveNotifyMask | EventMask.EnterNotifyMask; TypeHint = Gdk.WindowTypeHint.Utility; var fr = new Gtk.HBox(); fr.BorderWidth = 2; var view = new ImageView(SmartTagMarginMarker.GetIconId(fixes.GetSmartTagSeverity()), Gtk.IconSize.Menu); fr.PackStart(view, false, false, 0); fr.PackEnd(new RectangleMarker(), false, false, 0); Add(fr); ext.FixesMenuClosed += Ext_FixesMenuClosed; ShowAll(); }
protected override Gtk.Window CreateTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { //create a message string from all the results var results = (IList <Result>)item.Item; var sb = new StringBuilder(); bool first = false; foreach (var r in results) { if (!first) { first = true; } else { sb.AppendLine(); } sb.Append(r.Level.ToString()); sb.Append(": "); sb.Append(r.Message); } //FIXME: use a nicer, more specialized tooltip window, with results formatting and hints about // commands and stuff var win = new LanguageItemWindow((ExtensibleTextEditor)editor, modifierState, null, sb.ToString(), null); if (win.IsEmpty) { return(null); } return(win); }
public override Window CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var result = item.Item as List <Result>; var sb = new StringBuilder(); foreach (var r in result) { var escapedMessage = Ambience.EscapeText(r.Message); if (sb.Length > 0) { sb.AppendLine(); } if (result.Count > 1) { string severity; HslColor color; switch (r.Level) { case Microsoft.CodeAnalysis.DiagnosticSeverity.Info: severity = GettextCatalog.GetString("Info"); editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineSuggestion, out color); break; case Microsoft.CodeAnalysis.DiagnosticSeverity.Warning: severity = GettextCatalog.GetString("Warning"); editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineWarning, out color); break; case Microsoft.CodeAnalysis.DiagnosticSeverity.Error: severity = GettextCatalog.GetString("Error"); editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineError, out color); break; default: severity = "?"; editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineSuggestion, out color); break; } sb.AppendFormat("<span foreground ='{2}'font_weight='bold'>{0}</span>: {1}", severity, escapedMessage, color.ToPangoString()); } else { sb.Append(escapedMessage); } } var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, sb.ToString(), null); if (window.IsEmpty) { return(null); } return(window); }
public override Control CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState) { var result = item.Item as Result; var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, result.Message, null); if (window.IsEmpty) { return(null); } return(window); }
void DoShowTooltip(LanguageItemWindow liw, int xloc, int yloc) { languageItemWindow = liw; int ox, oy; this.GetWindow(TextWindowType.Text).GetOrigin(out ox, out oy); int w = languageItemWindow.Child.SizeRequest().Width; languageItemWindow.Move(xloc + ox - (w / 2), yloc + oy + 20); languageItemWindow.ShowAll(); }
public void HideLanguageItemWindow() { if (showTipScheduled) { GLib.Source.Remove(tipTimeoutId); showTipScheduled = false; } if (languageItemWindow != null) { languageItemWindow.Destroy(); languageItemWindow = null; } }
public override Window CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var result = item.Item as TooltipInformation; if (result == null) { return(null); } var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, result.SignatureMarkup, null); window.Destroyed += delegate { if (window.Tag is FloatingQuickFixIconWidget widget) { widget.QueueDestroy(); } }; if (window.IsEmpty) { return(null); } return(window); }