예제 #1
0
        internal bool CloseView(ITextView textView)
        {
            if (textView.IsPeekView())
            {
                if (textView.TryGetPeekViewHostView(out var hostView))
                {
                    _peekBroker.DismissPeekSession(hostView);
                    return(true);
                }

                return(false);
            }

            if (!_vsAdapter.GetContainingWindowFrame(textView).TryGetValue(out IVsWindowFrame vsWindowFrame))
            {
                return(false);
            }

            // In the case this is a split view then close should close on of the views vs. closing the
            // entire frame
            if (vsWindowFrame.GetCodeWindow().TryGetValue(out IVsCodeWindow vsCodeWindow) && vsCodeWindow.IsSplit())
            {
                return(SendSplit(vsCodeWindow));
            }

            // It's possible for IVsWindowFrame elements to nest within each other.  When closing we want to
            // close the actual tab in the editor so get the top most item
            vsWindowFrame = vsWindowFrame.GetTopMost();

            var value = __FRAMECLOSE.FRAMECLOSE_NoSave;

            return(ErrorHandler.Succeeded(vsWindowFrame.CloseFrame((uint)value)));
        }
 /// <inheritdoc/>
 public void Hide(ITextView textView)
 {
     peekBroker.DismissPeekSession(textView);
 }