Example #1
0
 /// <summary>
 /// In a perfect world this would replace the contents of the existing ITextView
 /// with those of the specified file.  Unfortunately this causes problems in
 /// Visual Studio when the file is of a different content type.  Instead we
 /// mimic the behavior by opening the document in a new window and closing the
 /// existing one
 /// </summary>
 public override HostResult LoadFileIntoExistingWindow(string filePath, ITextView textView)
 {
     try
     {
         // Open the document before closing the other.  That way any error which occurs
         // during an open will cause the method to abandon and produce a user error
         // message
         VsShellUtilities.OpenDocument(_vsAdapter.ServiceProvider, filePath);
         _textManager.CloseView(textView);
         return(HostResult.Success);
     }
     catch (Exception e)
     {
         return(HostResult.NewError(e.Message));
     }
 }
Example #2
0
 /// <summary>
 /// In a perfect world this would replace the contents of the existing ITextView
 /// with those of the specified file.  Unfortunately this causes problems in
 /// Visual Studio when the file is of a different content type.  Instead we
 /// mimic the behavior by opening the document in a new window and closing the
 /// existing one
 /// </summary>
 public override bool LoadFileIntoExistingWindow(string filePath, ITextView textView)
 {
     try
     {
         // Open the document before closing the other.  That way any error which occurs
         // during an open will cause the method to abandon and produce a user error
         // message
         VsShellUtilities.OpenDocument(_vsAdapter.ServiceProvider, filePath);
         _textManager.CloseView(textView);
         return(true);
     }
     catch (Exception e)
     {
         _vim.ActiveStatusUtil.OnError(e.Message);
         return(false);
     }
 }
Example #3
0
        public void CloseView_NoWindowFrame()
        {
            var view = _factory.Create <IWpfTextView>().Object;

            Assert.False(_manager.CloseView(view));
        }
Example #4
0
        public void CloseView_NoWindowFrame()
        {
            var view = CreateTextView().Object;

            Assert.False(_manager.CloseView(view));
        }
Example #5
0
 public override void Close(ITextView textView, bool checkDirty)
 {
     _textManager.CloseView(textView, checkDirty);
 }
Example #6
0
        public void CloseView1()
        {
            var view = _factory.Create <IWpfTextView>().Object;

            Assert.IsFalse(_manager.CloseView(view, checkDirty: false));
        }