static void CloseOldToolTip() { if (oldToolTipControl != null) { Form frm = oldToolTipControl.FindForm(); if (frm != null) { frm.Close(); } oldToolTipControl = null; } }
static void CloseOldToolTip() { if (oldToolTipControl != null) { Form frm = oldToolTipControl.FindForm(); if (frm != null) frm.Close(); oldToolTipControl = null; } }
/// <summary> /// This function shows variable values as tooltips /// </summary> static void TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e) { DebuggerGridControl toolTipControl = null; try { TextArea textArea = (TextArea)sender; if (e.ToolTipShown) return; if (oldToolTipControl != null && !oldToolTipControl.AllowClose) return; if (!CodeCompletionOptions.EnableCodeCompletion) return; if (!CodeCompletionOptions.TooltipsEnabled) return; if (CodeCompletionOptions.TooltipsOnlyWhenDebugging) { if (currentDebugger == null) return; if (!currentDebugger.IsDebugging) return; } if (e.InDocument) { // Query all registered tooltip providers using the AddInTree. // The first one that does not return null will be used. ToolTipInfo ti = null; foreach (ITextAreaToolTipProvider toolTipProvider in AddInTree.BuildItems<ITextAreaToolTipProvider>(ToolTipProviderAddInTreePath, null, false)) { if ((ti = toolTipProvider.GetToolTipInfo(textArea, e)) != null) { break; } } if (ti != null) { toolTipControl = ti.ToolTipControl as DebuggerGridControl; if (ti.ToolTipText != null) { e.ShowToolTip(ti.ToolTipText); } } CloseOldToolTip(); if (toolTipControl != null) { toolTipControl.ShowForm(textArea, e.LogicalPosition); } oldToolTipControl = toolTipControl; } } catch (Exception ex) { ICSharpCode.Core.MessageService.ShowError(ex, "Error while requesting tooltip for location " + e.LogicalPosition); } finally { if (toolTipControl == null && CanCloseOldToolTip) CloseOldToolTip(); } }
/// <summary> /// This function shows variable values as tooltips /// </summary> static void TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e) { DebuggerGridControl toolTipControl = null; try { TextArea textArea = (TextArea)sender; if (e.ToolTipShown) { return; } if (oldToolTipControl != null && !oldToolTipControl.AllowClose) { return; } if (!CodeCompletionOptions.TooltipsEnabled) { return; } if (CodeCompletionOptions.TooltipsOnlyWhenDebugging) { if (currentDebugger == null) { return; } if (!currentDebugger.IsDebugging) { return; } } if (e.InDocument) { // Query all registered tooltip providers using the AddInTree. // The first one that does not return null will be used. ToolTipInfo ti = null; foreach (ITextAreaToolTipProvider toolTipProvider in AddInTree.BuildItems <ITextAreaToolTipProvider>(ToolTipProviderAddInTreePath, null, false)) { if ((ti = toolTipProvider.GetToolTipInfo(textArea, e)) != null) { break; } } if (ti != null) { toolTipControl = ti.ToolTipControl as DebuggerGridControl; if (ti.ToolTipText != null) { e.ShowToolTip(ti.ToolTipText); } } CloseOldToolTip(); if (toolTipControl != null) { toolTipControl.ShowForm(textArea, e.LogicalPosition); } oldToolTipControl = toolTipControl; } } catch (Exception ex) { ICSharpCode.Core.MessageService.ShowError(ex); } finally { if (toolTipControl == null && CanCloseOldToolTip) { CloseOldToolTip(); } } }