Пример #1
0
 /// <summary>
 /// Gets the text buffer for the file opening the document if necessary.
 /// </summary>
 public ITextBuffer GetTextBuffer()
 {
     // http://pytools.codeplex.com/workitem/672
     // When we FindAndLockDocument we marshal on the main UI thread, and the docdata we get
     // back is marshalled back so that we'll marshal any calls on it back.  When we pass it
     // into IVsEditorAdaptersFactoryService we don't go through a COM boundary (it's a managed
     // call) and we therefore don't get the marshaled value, and it doesn't know what we're
     // talking about.  So run the whole operation on the UI thread.
     return(UIThread.Invoke(() => GetTextBufferOnUIThread()));
 }
Пример #2
0
 public override void ShowAndActivate()
 {
     UIThread.Invoke(() => {
         ErrorHandler.ThrowOnFailure(_pane.Activate());
         if (_window != null)
         {
             ErrorHandler.ThrowOnFailure(_window.ShowNoActivate());
         }
     });
 }
Пример #3
0
        /// <summary>
        /// Gets or creates the specified output pane.
        /// </summary>
        /// <exception cref="InvalidOperationException">The output pane could
        /// not be found or created.</exception>
        public static OutputWindowRedirector Get(IServiceProvider provider, Guid id, string title)
        {
            var outputWindow = provider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            if (outputWindow == null)
            {
                throw new InvalidOperationException("Unable to get output window service");
            }

            IVsOutputWindowPane pane;

            if (ErrorHandler.Failed(outputWindow.GetPane(id, out pane)) || pane == null)
            {
                if (ErrorHandler.Failed(UIThread.Invoke(() => outputWindow.CreatePane(id, title, 1, 0))))
                {
                    throw new InvalidOperationException("Unable to create output pane");
                }
            }
            return(new OutputWindowRedirector(provider, id));
        }
Пример #4
0
 public virtual IList <Output> EnumerateOutputs()
 {
     UIThread.Invoke(Refresh);
     return(_outputs);
 }
Пример #5
0
 public override void Show()
 {
     UIThread.Invoke(() => ErrorHandler.ThrowOnFailure(_pane.Activate()));
 }