//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);
        }
示例#3
0
        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);
        }
示例#4
0
 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 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 ();
		}