public void GetRequiredPosition(Mono.TextEditor.TextEditor editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign) { LanguageItemWindow win = (LanguageItemWindow)tipWindow; requiredWidth = win.SetMaxWidth(win.Screen.Width); xalign = 0.5; }
public Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { var ed = (ExtensibleTextEditor)editor; var doc = ed.ParsedDocument; if (doc == null) { return(null); } var resolveResult = (ResolveResult)item.Item; if (lastResult != null && lastWindow.IsRealized && resolveResult != null && lastResult.Type.Equals(resolveResult.Type)) { return(lastWindow); } var result = new LanguageItemWindow(ed, modifierState, resolveResult, null, doc.ParsedFile); lastWindow = result; lastResult = resolveResult; if (result.IsEmpty) { return(null); } return(result); }
public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var result = new LanguageItemWindow (GetExtensibleTextEditor (editor), modifierState, null, (string)item.Item, null); if (result.IsEmpty) return null; return result; }
protected override Gtk.Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { LanguageItemWindow result = new LanguageItemWindow ((ExtensibleTextEditor) editor, modifierState, null, (string)item.Item, null); if (result.IsEmpty) return null; return result; }
public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys 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; }
public override Window CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState) { var result = new LanguageItemWindow(GetExtensibleTextEditor(editor), modifierState, null, (string)item.Item, null); if (result.IsEmpty) { return(null); } return(result); }
public Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { LanguageItemWindow result = new LanguageItemWindow((ExtensibleTextEditor)editor, modifierState, null, (string)item.Item, null); if (result.IsEmpty) { return(null); } return(result); }
public Gtk.Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { ExtensibleTextEditor ed = (ExtensibleTextEditor) editor; ParsedDocument doc = ProjectDomService.GetParsedDocument (null, ed.Document.FileName); ResolveResult resolveResult = (ResolveResult)item.Item; if (lastResult != null && lastResult.ResolvedExpression != null && lastWindow.IsRealized && resolveResult != null && resolveResult.ResolvedExpression != null && lastResult.ResolvedExpression.Expression == resolveResult.ResolvedExpression.Expression) return lastWindow; LanguageItemWindow result = new LanguageItemWindow (ed, modifierState, resolveResult, null, doc != null ? doc.CompilationUnit : null); lastWindow = result; lastResult = resolveResult; if (result.IsEmpty) return null; return result; }
public Gtk.Window CreateTooltipWindow (Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { var ed = (ExtensibleTextEditor)editor; var doc = ed.ParsedDocument; if (doc == null) return null; var resolveResult = (ResolveResult)item.Item; if (lastResult != null && lastWindow.IsRealized && resolveResult != null && lastResult.Type.Equals (resolveResult.Type)) return lastWindow; var result = new LanguageItemWindow (ed, modifierState, resolveResult, null, doc.ParsedFile); lastWindow = result; lastResult = resolveResult; if (result.IsEmpty) return null; return result; }
public Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { ExtensibleTextEditor ed = (ExtensibleTextEditor)editor; ParsedDocument doc = ProjectDomService.GetParsedDocument(null, ed.Document.FileName); ResolveResult resolveResult = (ResolveResult)item.Item; if (lastResult != null && lastResult.ResolvedExpression != null && lastWindow.IsRealized && resolveResult != null && resolveResult.ResolvedExpression != null && lastResult.ResolvedExpression.Expression == resolveResult.ResolvedExpression.Expression) { return(lastWindow); } LanguageItemWindow result = new LanguageItemWindow(ed, modifierState, resolveResult, null, doc != null ? doc.CompilationUnit : null); lastWindow = result; lastResult = resolveResult; if (result.IsEmpty) { return(null); } return(result); }
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 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; string tooltip = null; if (titem.Result is UnknownIdentifierResolveResult) { tooltip = string.Format("error CS0103: The name `{0}' does not exist in the current context", ((UnknownIdentifierResolveResult)titem.Result).Identifier); } else if (titem.Result is UnknownMemberResolveResult) { var ur = (UnknownMemberResolveResult)titem.Result; if (ur.TargetType.Kind != TypeKind.Unknown) { tooltip = string.Format("error CS0117: `{0}' does not contain a definition for `{1}'", ur.TargetType.FullName, ur.MemberName); } } else if (titem.Result.IsError) { tooltip = "Resolve error."; } else if (titem.Result != null) { var ev = new ErrorVisitor(titem.Resolver); if (titem.Node is AstType && titem.Node.Parent is VariableDeclarationStatement && titem.Node.GetText() == "var") { titem.Node.Parent.AcceptVisitor(ev); } if (ev.ErrorResolveResult != null) { Console.WriteLine(ev.ErrorResolveResult); tooltip = string.Format("Error while resolving: '{0}'", ev.ErrorNode.GetText()); } else { tooltip = CreateTooltip(titem.Result, offset, ambience); } } else { return(null); } if (lastResult != null && lastWindow.IsRealized && titem.Result != null && lastResult.Type.Equals(titem.Result.Type)) { return(lastWindow); } var result = new LanguageItemWindow(tooltip); lastWindow = result; lastResult = titem.Result; if (result.IsEmpty) { return(null); } return(result); }
public 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; string tooltip = null; if (titem.Result is UnknownIdentifierResolveResult) { tooltip = string.Format ("error CS0103: The name `{0}' does not exist in the current context", ((UnknownIdentifierResolveResult)titem.Result).Identifier); } else if (titem.Result is UnknownMemberResolveResult) { var ur = (UnknownMemberResolveResult)titem.Result; if (ur.TargetType.Kind != TypeKind.Unknown) tooltip = string.Format ("error CS0117: `{0}' does not contain a definition for `{1}'", ur.TargetType.FullName, ur.MemberName); } else if (titem.Result.IsError) { tooltip = "Resolve error."; } else if (titem.Result != null) { var ev = new ErrorVisitor (titem.Resolver); if (titem.Node is AstType && titem.Node.Parent is VariableDeclarationStatement && titem.Node.GetText () == "var") { titem.Node.Parent.AcceptVisitor (ev); } if (ev.ErrorResolveResult != null) { Console.WriteLine (ev.ErrorResolveResult); tooltip = string.Format ("Error while resolving: '{0}'", ev.ErrorNode.GetText ()); } else { tooltip = CreateTooltip (titem.Result, offset, ambience); } } else { return null; } if (lastResult != null && lastWindow.IsRealized && titem.Result != null && lastResult.Type.Equals (titem.Result.Type)) return lastWindow; var result = new LanguageItemWindow (tooltip); lastWindow = result; lastResult = titem.Result; if (result.IsEmpty) return null; return result; }
public override Control 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"); color = editor.Options.GetColorStyle ().UnderlineHint.Color; break; case Microsoft.CodeAnalysis.DiagnosticSeverity.Warning: severity = GettextCatalog.GetString ("Warning"); color = editor.Options.GetColorStyle ().UnderlineWarning.Color; break; case Microsoft.CodeAnalysis.DiagnosticSeverity.Error: severity = GettextCatalog.GetString ("Error"); color = editor.Options.GetColorStyle ().UnderlineError.Color; break; default: severity = "?"; color = editor.Options.GetColorStyle ().UnderlineSuggestion.Color; break; } sb.Append (string.Format ("<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 void HideLanguageItemWindow () { if (showTipScheduled) { GLib.Source.Remove (tipTimeoutId); showTipScheduled = false; } if (languageItemWindow != null) { languageItemWindow.Destroy (); languageItemWindow = null; } }
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 (); }