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); }
//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); }
public override void Dispose () { CancelQuickFixTimer (); document.Editor.SelectionChanged -= HandleSelectionChanged; document.DocumentParsed -= HandleDocumentDocumentParsed; if (widget != null) { widget.Destroy (); widget = null; } base.Dispose (); }
void RemoveWidget () { /* if (widget == null) return; widget.Hide ();*/ if (widget != null) { widget.Destroy (); widget = null; } }
public override void Dispose() { CancelQuickFixTimer(); document.Editor.SelectionChanged -= HandleSelectionChanged; document.DocumentParsed -= HandleDocumentDocumentParsed; if (widget != null) { widget.Destroy(); widget = null; } base.Dispose(); }
void RemoveWidget() { /* * if (widget == null) * return; * widget.Hide ();*/ if (widget != null) { widget.Destroy(); widget = null; } }
void RemoveWidget () { if (widget != null) { widget.Destroy (); widget = null; } if (currentSmartTag != null) { document.Editor.Document.RemoveMarker (currentSmartTag); currentSmartTag = null; currentSmartTagBegin = DocumentLocation.Empty; } CancelSmartTagPopupTimeout (); }
void RemoveWidget() { if (widget != null) { widget.Destroy(); widget = null; } if (currentSmartTag != null) { document.Editor.Document.RemoveMarker(currentSmartTag); currentSmartTag = null; currentSmartTagBegin = DocumentLocation.Empty; } CancelSmartTagPopupTimeout(); }
void RemoveWidget () { if (widget != null) { widget.Destroy (); widget = null; } if (currentSmartTag != null) { bool wasRemoved = document.Editor.Document.RemoveMarker (currentSmartTag); if (!wasRemoved) { LoggingService.LogWarning ("Can't remove smart tag marker from document."); } currentSmartTag = null; currentSmartTagBegin = DocumentLocation.Empty; } }
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 OnQuickFixCommand() { if (!QuickTaskStrip.EnableFancyFeatures) { var w = new CodeActionWidget(this, Document); w.SetFixes(RefactoringService.GetValidActions(Document, Document.Editor.Caret.Location).Result, Document.Editor.Caret.Location); w.PopupQuickFixMenu(); w.Destroy(); return; } if (currentSmartTag == null) { return; } currentSmartTag.Popup(); }
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 OnQuickFixCommand () { if (!QuickTaskStrip.EnableFancyFeatures) { var w = new CodeActionWidget (this, Document); w.SetFixes (RefactoringService.GetValidActions (Document, Document.Editor.Caret.Location).Result, Document.Editor.Caret.Location); w.PopupQuickFixMenu (); w.Destroy (); return; } if (widget == null || !widget.Visible) return; widget.PopupQuickFixMenu (); }
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; } 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 ()) { RemoveWidget (); return; } } else { 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)); } 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) return; var editor = document.Editor; if (editor == null || editor.Parent == null || !editor.Parent.IsRealized) return; if (!fixes.Any ()) { ICSharpCode.NRefactory.TypeSystem.DomRegion region; var resolveResult = document.GetLanguageItem (editor.Caret.Offset, out region); if (resolveResult != null) { var possibleNamespaces = ResolveCommandHandler.GetPossibleNamespaces (document, 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); }