コード例 #1
0
        internal void ShowSmartTag(IVsTextView textView, bool showMenu, Location loc, Guid cmdSet, MenuCmd.CmdId contextMenuId, Action <MenuCmd.CmdId> exec, Func <MenuCmd.CmdId, uint> queryStatus)
        {
            ErrorHelper.ThrowIsNull(exec, "exec");

            var smartTagWin = GetSmartTagTipWindow();
            var source      = (NemerleSource)GetSource(textView);

            Debug.Assert(source != null, "source == null");

            var pos    = source.GetPositionOfLineIndex(loc.Line, loc.Column);
            var endPos = source.GetPositionOfLineIndex(loc.EndLine, loc.EndColumn);
            var length = endPos - pos;

            var smartTagData = new NemerleSmartTagData(pos, length, cmdSet, exec, queryStatus,
                                                       () => IsSmartTagActive = false);

            ErrorHelper.ThrowOnFailure(smartTagWin.SetSmartTagData(smartTagData));

            var shouContextMenu = showMenu ? (uint)TipWindowFlags2.UTW_EXPANDED : 0;

            var viewEx = (IVsTextViewEx)textView;

            ErrorHelper.ThrowOnFailure(viewEx.UpdateSmartTagWindow(smartTagWin, shouContextMenu));

            IsSmartTagActive = true;
        }
コード例 #2
0
        internal void ShowSmartTag(IVsTextView textView, bool showMenu, Location loc, Guid cmdSet, MenuCmd.CmdId contextMenuId, Action<MenuCmd.CmdId> exec, Func<MenuCmd.CmdId, uint> queryStatus)
        {
            ErrorHelper.ThrowIsNull(exec, "exec");

            var smartTagWin = GetSmartTagTipWindow();
            var source = (NemerleSource)GetSource(textView);
            Debug.Assert(source != null, "source == null");

            var pos = source.GetPositionOfLineIndex(loc.Line, loc.Column);
            var endPos = source.GetPositionOfLineIndex(loc.EndLine, loc.EndColumn);
            var length = endPos - pos;

            var smartTagData = new NemerleSmartTagData(pos, length, cmdSet, exec, queryStatus,
                () => IsSmartTagActive = false);
            ErrorHelper.ThrowOnFailure(smartTagWin.SetSmartTagData(smartTagData));

              var shouContextMenu = showMenu ? (uint)TipWindowFlags2.UTW_EXPANDED : 0;

            var viewEx = (IVsTextViewEx)textView;
            ErrorHelper.ThrowOnFailure(viewEx.UpdateSmartTagWindow(smartTagWin, shouContextMenu));

            IsSmartTagActive = true;
        }