//TextLocation loc; void CreateWidget(IEnumerable <CodeAction> fixes, TextLocation loc) { //this.loc = loc; var editor = document.Editor; var container = editor.Parent; var point = editor.Parent.LocationToPoint(loc); point.Y += (int)editor.LineHeight; if (widget == null) { widget = new CodeActionWidget(this, Document); container.AddTopLevelWidget( widget, point.X, point.Y ); widget.Show(); } else { if (!widget.Visible) { widget.Show(); } container.MoveTopLevelWidget( widget, point.X, point.Y ); } widget.SetFixes(fixes, loc); }
void CreateWidget(IEnumerable <CodeAction> fixes, TextLocation loc) { Fixes = fixes; if (!QuickTaskStrip.EnableFancyFeatures) { return; } var editor = document.Editor; if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) { return; } if (document.ParsedDocument == null || document.ParsedDocument.IsInvalid) { return; } if (!fixes.Any()) { ICSharpCode.NRefactory.Semantics.ResolveResult resolveResult; ICSharpCode.NRefactory.CSharp.AstNode node; if (ResolveCommandHandler.ResolveAt(document, out resolveResult, out node)) { var possibleNamespaces = ResolveCommandHandler.GetPossibleNamespaces(document, node, resolveResult); if (!possibleNamespaces.Any()) { return; } } else { return; } } var container = editor.Parent.Parent as TextEditorContainer; if (container == null) { return; } if (widget == null) { widget = new CodeActionWidget(this, Document); container.AddTopLevelWidget(widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY(document.Editor.Caret.Line)); } else { container.MoveTopLevelWidget(widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY(document.Editor.Caret.Line)); } widget.Show(); widget.SetFixes(fixes, loc); }
void CreateWidget(IEnumerable <CodeAction> fixes, TextLocation loc) { Fixes = fixes; if (!QuickTaskStrip.EnableFancyFeatures) { RemoveWidget(); return; } var editor = document.Editor; if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) { RemoveWidget(); return; } if (document.ParsedDocument == null || document.ParsedDocument.IsInvalid) { RemoveWidget(); return; } var container = editor.Parent.Parent as TextEditorContainer; if (container == null) { RemoveWidget(); return; } if (widget == null) { widget = new CodeActionWidget(this, Document); container.AddTopLevelWidget(widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY(document.Editor.Caret.Line)); widget.Show(); } else { if (!widget.Visible) { widget.Show(); } container.MoveTopLevelWidget(widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY(document.Editor.Caret.Line)); } widget.SetFixes(fixes, loc); }
void CreateWidget (IEnumerable<CodeAction> fixes, TextLocation loc) { Fixes = fixes; if (!QuickTaskStrip.EnableFancyFeatures) { RemoveWidget (); return; } var editor = document.Editor; if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) { RemoveWidget (); return; } if (document.ParsedDocument == null || document.ParsedDocument.IsInvalid) { RemoveWidget (); return; } var container = editor.Parent; if (container == null) { RemoveWidget (); return; } if (widget == null) { widget = new CodeActionWidget (this, Document); container.AddTopLevelWidget (widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY (document.Editor.Caret.Line)); widget.Show (); } else { if (!widget.Visible) widget.Show (); container.MoveTopLevelWidget (widget, 2 + (int)editor.Parent.TextViewMargin.XOffset, -2 + (int)editor.Parent.LineToY (document.Editor.Caret.Line)); } widget.SetFixes (fixes, loc); }
void CreateWidget (IEnumerable<CodeAction> fixes, TextLocation loc) { this.loc = loc; var editor = document.Editor; var container = editor.Parent; var point = editor.Parent.LocationToPoint (loc); point.Y += (int)editor.LineHeight; if (widget == null) { widget = new CodeActionWidget (this, Document); container.AddTopLevelWidget ( widget, point.X, point.Y ); widget.Show (); } else { if (!widget.Visible) widget.Show (); container.MoveTopLevelWidget ( widget, point.X, point.Y ); } widget.SetFixes (fixes, loc); }