private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.InDocument && !e.ToolTipShown) { IExpressionFinder expressionFinder; if (MainForm.IsVisualBasic) { expressionFinder = new VBExpressionFinder(); } else { expressionFinder = new CSharpExpressionFinder(mainForm.parseInformation); } ExpressionResult expression = expressionFinder.FindFullExpression( editor.Text, editor.Document.PositionToOffset(e.LogicalPosition)); if (expression.Region.IsEmpty) { expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1); } TextArea textArea = editor.ActiveTextAreaControl.TextArea; NRefactoryResolver resolver = new NRefactoryResolver(mainForm.myProjectContent.Language); ResolveResult rr = resolver.Resolve(expression, mainForm.parseInformation, textArea.MotherTextEditorControl.Text); string toolTipText = GetText(rr); if (toolTipText != null) { e.ShowToolTip(toolTipText); } } }
private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.InDocument == false || e.ToolTipShown == true) { return; } int offset = mEditor.Document.PositionToOffset(e.LogicalPosition); LineSegment line = mEditor.Document.GetLineSegmentForOffset(offset); TextWord word = line.GetWord(e.LogicalPosition.Column); if (word == null) { return; } string lineText = word.Word; if (lineText.Length > 0) { if (TextArea.ToolTipWnd == null) { } e.ShowToolTip(lineText); } }
/// <summary> /// ツールチップ表示リクエストが発生したとき /// </summary> void ActiveTextArea_ToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (m_useCodeComp == false) { return; //入力補完が無効なときはTipは表示しない } if (e.ToolTipShown) { return; //Tipが表示中は新たに表示しない } if (e.InDocument == false) { return; } string tip = ""; switch (FileType.GetKrkrType(this.FileName)) { case FileType.KrkrType.Kag: tip = KagToolTip.GetText(Document, e.LogicalPosition.Y, e.LogicalPosition.X); break; case FileType.KrkrType.Tjs: //未実装 break; } if (tip != "") { e.ShowToolTip(tip); } }
// was part of Tool Tip Provider void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { O2Thread.mtaThread( () => { try { if (e.InDocument && !e.ToolTipShown) { var logicalPosition = e.LogicalPosition; // parseSourceCode(CodeCompleteTargetText); ResolveResult rr = resolveLocation(logicalPosition); string toolTipText = GetText(rr); if (toolTipText != null) { e.ShowToolTip(toolTipText); //} //if (toolTipText.valid()) "ToolTipText: {0}".format(toolTipText).info(); } } } catch (Exception ex) { ex.log("in OnToolTipRequest"); } }); }
protected override void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (!e.InDocument || e.LogicalPosition.IsEmpty) { return; } var text = (TextArea)sender; if (text.Document == null) { return; } var lineSegment = text.Document.GetLineSegment(e.LogicalPosition.Line); var lineText = text.Document.GetText(lineSegment); string word = GetWordAtColumn(lineText, e.LogicalPosition.Column); if (word == null) { return; } // register-variable? if (_formatter != null) { string varName = _formatter.GetVariableByRegisterName(word); if (varName != null) { e.ShowToolTip(varName); return; } } // opcode-mnemonic? var opcode = Opcodes.Lookup(word); if (opcode != null) { string toolTip = string.Format("{0}\n\n{1}\n\n{2}", opcode.Syntax, opcode.Arguments, opcode.Description); e.ShowToolTip(toolTip); return; } }
private void TextArea_ToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (!e.InDocument) { return; } var segment = Document.GetLineSegment(e.LogicalPosition.Line); var word = segment.GetWord(e.LogicalPosition.Column); if (word == null || string.IsNullOrEmpty(word.Word)) { return; } string text = word.Word; string tooltip; try { IParserData data = _parserService.GetParserData(text, Settings.Default.CaseSensitive).FirstOrDefault(); if (data == null) { var address = _symbolService.SymbolTable.GetAddressFromLabel(text); tooltip = address == null ? string.Empty : address.Value.ToString(); } else { tooltip = data.Description; } } catch (Exception) { return; } if (string.IsNullOrEmpty(tooltip)) { if (_debuggerService.CurrentDebugger == null) { return; } ushort?regValue = _debuggerService.CurrentDebugger.GetRegisterValue(text); if (!regValue.HasValue) { return; } tooltip = "$" + regValue.Value.ToString("X"); } e.ShowToolTip(tooltip); }
public static void Show(TabInfo ti, IDocument document, ToolTipRequestEventArgs args) { if (ColorTheme.CheckColorPosition(document, new TextLocation(args.LogicalPosition.Column, args.LogicalPosition.Line), true)) { return; } string word = TextUtilities.GetWordAt(document, document.PositionToOffset(args.LogicalPosition)); if (word.Length == 0) { return; } if (ti.messages.Count > 0) { int msg; if (int.TryParse(word, out msg) && ti.messages.ContainsKey(msg)) { args.ShowToolTip("\"" + ti.messages[msg] + "\""); return; } } document.TextEditorProperties.BoldFontTipsTile = true; string lookup = ProgramInfo.LookupOpcodesToken(word); // show opcodes help if (lookup == null && ti.parseInfo != null) { lookup = ti.parseInfo.LookupToken(word, ti.filepath, args.LogicalPosition.Line + 1); document.TextEditorProperties.BoldFontTipsTile = false; } if (lookup != null) { args.ShowToolTip(lookup); } }
void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.InDocument && !e.ToolTipShown) { try { string toolTipText = FToolTipProvider.GetToolTip(Document, e.LogicalPosition); if (toolTipText != null) { e.ShowToolTip(toolTipText); } } catch (Exception) { // Ignore } } }
void TextArea_ToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.ToolTipShown) { return; } if (e.InDocument) { var area = sender as TextArea; var pos = e.LogicalPosition; var doc = area.Document; LineSegment seg = doc.GetLineSegment(pos.Y); var txt = seg.GetWord(pos.X); if (txt != null && !string.IsNullOrEmpty(txt.Word)) { e.ShowToolTip(GetDescription(txt.Word)); } } }
void TextEditorControl_ToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (!e.InDocument || e.ToolTipShown) { return; } // Get word under cursor TextLocation position = e.LogicalPosition; LineSegment line = this.TextEditorControl.Document.GetLineSegment(position.Y); if (line != null) { TextWord word = line.GetWord(position.X); if (word != null && !String.IsNullOrEmpty(word.Word)) { e.ShowToolTip("Current word: \"" + word.Word + "\"\n" + "\nRow: " + (position.Y + 1) + " Column: " + (position.X + 1)); } } }
void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.InDocument && !e.ToolTipShown && _xdebugClient.State == XdebugClientState.Break) { ICSharpCode.TextEditor.TextArea area_obj = (ICSharpCode.TextEditor.TextArea)sender; string s = ICSharpCode.TextEditor.Document.TextUtilities.GetWordAt(area_obj.Document, area_obj.Document.PositionToOffset(new Point(e.LogicalPosition.X, e.LogicalPosition.Y))); if (area_obj.Document.GetCharAt(MyFindWordStart(area_obj.Document, area_obj.Document.PositionToOffset(new Point(e.LogicalPosition.X, e.LogicalPosition.Y))) - 1).ToString() == "$") { s = "$" + s; } if (s != "") { Property p = _xdebugClient.GetPropertyValue(s, 0); if (p != null) { e.ShowToolTip(p.Value); } } } }
/// <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(); } } }