//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static void WriteLine(Guid outputPaneGuid, string line) { // // Output specified line to the pane represented by the provided Guid. // i.e. VSConstants.OutputWindowPaneGuid.DebugPane_guid // IVsOutputWindowPane debugWindowPane = null; if (s_outputWindow == null) { s_outputWindow = AcquireOutputWindow(); } if (s_outputWindow?.GetPane(outputPaneGuid, out debugWindowPane) != VSConstants.S_OK) { ErrorHandler.ThrowOnFailure(s_outputWindow.CreatePane(outputPaneGuid, "General", 1, 0)); ErrorHandler.ThrowOnFailure(s_outputWindow.GetPane(outputPaneGuid, out debugWindowPane)); } if (debugWindowPane != null) { ErrorHandler.ThrowOnFailure(debugWindowPane.Activate()); ErrorHandler.ThrowOnFailure(debugWindowPane.OutputString(line + Environment.NewLine)); } }
/// <summary> /// Get reference to IVsOutputWindowPane interface from pane guid. The method will create the pane if it is not already created. /// </summary> /// <param name="guidPane">A guid for the pane.</param> /// <param name="paneName">The name of the pane.</param> /// <param name="visible">Set the visibility state of the pane.</param> /// <param name="clearWithSolution">Should the pane be cleared with solution. It is used if the pane will be created by this method.</param> /// <returns>A reference to an IVsOutputWindowPane interface.</returns> public static IVsOutputWindowPane GetOutputWindowpane(IServiceProvider serviceProvider, Guid guidPane, string paneName, bool visible, bool clearWithSolution) { IVsOutputWindow outputWindow = serviceProvider.GetService(typeof(IVsOutputWindow)) as IVsOutputWindow; if (outputWindow == null) { throw new InvalidOperationException("Could not get the IVsOutputWindow"); } IVsOutputWindowPane outputWindowPane = null; int hr = outputWindow.GetPane(ref guidPane, out outputWindowPane); if (ErrorHandler.Failed(hr) && outputWindowPane == null) { if (ErrorHandler.Succeeded(outputWindow.CreatePane(ref guidPane, paneName, visible ? 1 : 0, clearWithSolution ? 1 : 0))) { outputWindow.GetPane(ref guidPane, out outputWindowPane); } } else { if (!visible) { outputWindowPane.Hide(); } else { outputWindowPane.Activate(); } } return(outputWindowPane); }
public static void WriteMessageWithLink(string path, int line, string format, params object[] args) { IVsOutputWindow outputWindow = VsServiceProvider.Get(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid guidGeneral = VSConstants.OutputWindowPaneGuid.GeneralPane_guid; if (outputWindow == null) { return; } IVsOutputWindowPane pane; int hr = outputWindow.CreatePane(guidGeneral, "General", 1, 0); hr = outputWindow.GetPane(guidGeneral, out pane); if (pane == null) { return; } if (!format.EndsWith("\r\n")) { format = format + "\r\n"; } pane.Activate(); pane.OutputTaskItemString(string.Format(format, args) + "\r\n", VSTASKPRIORITY.TP_NORMAL, VSTASKCATEGORY.CAT_BUILDCOMPILE, "MergeUi", 0, path, (uint)line - 1, string.Format(format, args)); }
public static void Update(string message, bool newLine = true) { //Configuration.Instance.DTE.ExecuteCommand("View.Output"); var dte = Package.GetGlobalService(typeof(SDTE)) as EnvDTE.DTE; var win = dte.Windows.Item("{34E76E81-EE4A-11D0-AE2E-00A0C90FFFC3}"); win.Visible = true; IVsOutputWindow outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid guidGeneral = Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.GeneralPane_guid; IVsOutputWindowPane pane; int hr = outputWindow.CreatePane(guidGeneral, "Crm Code Generator", 1, 0); hr = outputWindow.GetPane(guidGeneral, out pane); pane.Activate(); pane.OutputString(message); if (newLine) { pane.OutputString("\n"); } pane.FlushToTaskList(); System.Windows.Forms.Application.DoEvents(); }
internal static void Log(string message) { if (!string.IsNullOrWhiteSpace(message)) { try { IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid paneGuid = VSConstants.GUID_OutWindowGeneralPane; IVsOutputWindowPane pane = null; if (outWindow != null) { outWindow.GetPane(ref paneGuid, out pane); if (pane == null) { paneGuid = VSConstants.GUID_OutWindowDebugPane; outWindow.GetPane(ref paneGuid, out pane); } } if (pane != null) { pane.OutputString("From ProtobufGenerator: " + message + "\n"); pane.Activate(); } } catch (Exception) { } } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static void WriteLine (Guid outputPaneGuid, string line) { // // Output specified line to the pane represented by the provided Guid. // i.e. VSConstants.OutputWindowPaneGuid.DebugPane_guid // IVsOutputWindowPane debugWindowPane = null; if (s_outputWindow == null) { s_outputWindow = AquireOutputWindow (); } if ((s_outputWindow != null) && (s_outputWindow.GetPane (outputPaneGuid, out debugWindowPane) != VSConstants.S_OK)) { ErrorHandler.ThrowOnFailure (s_outputWindow.CreatePane (outputPaneGuid, "General", 1, 0)); ErrorHandler.ThrowOnFailure (s_outputWindow.GetPane (outputPaneGuid, out debugWindowPane)); } if (debugWindowPane != null) { ErrorHandler.ThrowOnFailure (debugWindowPane.Activate ()); ErrorHandler.ThrowOnFailure (debugWindowPane.OutputString (line + Environment.NewLine)); } }
/// <summary> /// Get a pane. /// You can use Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid. /// </summary> /// <returns></returns> private static bool EnsurePane() { if (_pane == null) { lock (_syncRoot) { if (_pane == null) { if (!_guid.HasValue) { _guid = Guid.NewGuid(); } Guid _temp = _guid.Value; IVsOutputWindow output = (IVsOutputWindow)_provider.GetService(typeof(SVsOutputWindow)); output.GetPane(_guid.Value, out _pane); if (_pane == null) { output.CreatePane( ref _temp, string.IsNullOrEmpty(_name)? "VSExtensibilityHelper - Pane" : _name, 1, 1); output.GetPane(ref _temp, out _pane); } } } } return(_pane != null); }
//--// public MessageCentreDeployment() { m_outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; if (m_outputWindow == null) { throw new Exception("Package.GetGlobalService(SVsOutputWindow) failed to provide the output window"); } Guid tempId = VSConstants.GUID_OutWindowDebugPane; m_outputWindow.GetPane(ref tempId, out m_debugPane); tempId = s_DeploymentMessagesPaneGuid; m_outputWindow.CreatePane(ref tempId, "Micro Framework Device Deployment", 0, 1); tempId = s_DeploymentMessagesPaneGuid; m_outputWindow.GetPane(ref tempId, out m_deploymentMessagesPane); m_fShowInternalErrors = false; if (RegistryAccess.GetBoolValue(@"\NonVersionSpecific\UserInterface", "showInternalErrors", out m_fShowInternalErrors, false)) { this.Message(m_deploymentMessagesPane, "Micro Framework deployment internal errors will be reported."); } m_statusBar = Package.GetGlobalService(typeof(SVsStatusbar)) as IVsStatusbar; }
public ExtensionOutput( AsyncPackage package, string name, Guid guid, bool visible = true, bool clearWithSolution = false) { ThreadHelper.ThrowIfNotOnUIThread(); IVsOutputWindow output = package.GetService <SVsOutputWindow, IVsOutputWindow>() as IVsOutputWindow; m_guid = guid; output.GetPane(ref m_guid, out m_pane); if (m_pane == null) { // Create a new pane. output.CreatePane( ref m_guid, name, Convert.ToInt32(visible), Convert.ToInt32(clearWithSolution)); // Retrieve the new pane. output.GetPane(ref guid, out m_pane); } }
/// <summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary> /// <param term='custom'>Array of parameters that are host application specific.</param> /// <seealso class='IDTExtensibility2' /> public void OnStartupComplete(ref Array custom) { IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid paneGuid = VSConstants.GUID_OutWindowDebugPane; IVsOutputWindowPane debugPane; outWindow.GetPane(ref paneGuid, out debugPane); debugPane.OutputString("DebugView++ Forwarding initializing..."); debugPane.Activate(); // Brings this pane into view IVsUserData userData = (IVsUserData)debugPane; object o; Guid guidViewHost = DefGuidList.guidIWpfTextViewHost; userData.GetData(ref guidViewHost, out o); IWpfTextViewHost viewHost = (IWpfTextViewHost)o; m_textView = viewHost.TextView; m_textView.TextBuffer.Changed += new EventHandler <Microsoft.VisualStudio.Text.TextContentChangedEventArgs>(TextBuffer_Changed); debugPane.OutputString("DebugView++ Forwarding installed."); Trace.AutoFlush = true; }
/// <summary> /// Write the outputText to the General Output Window, /// using a Tab named tabName. /// </summary> /// <param name="outputText"></param> /// <param name="tabName"></param> internal static void WriteOutputWindow(string outputText, string tabName) { IVsOutputWindow outputWindow = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; // If we fail to get it we can exit now. if (null == outputWindow) { XSharpProjectPackage.Instance.DisplayOutPutMessage("Failed to get a reference to IVsOutputWindow"); return; } // Now get the window pane for the general output. Guid guidGeneral = Microsoft.VisualStudio.VSConstants.GUID_OutWindowGeneralPane; IVsOutputWindowPane windowPane = null; if (Microsoft.VisualStudio.ErrorHandler.Failed(outputWindow.GetPane(ref guidGeneral, out windowPane))) { if (Microsoft.VisualStudio.ErrorHandler.Failed(outputWindow.CreatePane(ref guidGeneral, tabName, 1, 0))) { XSharpProjectPackage.Instance.DisplayOutPutMessage("Failed to get a reference to the Output window General pane"); return; } outputWindow.GetPane(ref guidGeneral, out windowPane); } if (Microsoft.VisualStudio.ErrorHandler.Failed(windowPane.OutputString(outputText))) { XSharpProjectPackage.Instance.DisplayOutPutMessage("Failed to write on the Output window"); } // }
private IVsOutputWindowPane CreateOutputPane(IVsOutputWindow outputWindow) { _threadingContext.ThrowIfNotOnUIThread(); // Try to get the workspace pane if it has already been registered var workspacePaneGuid = s_outputPaneGuid; // If the pane has already been created, CreatePane returns it if ( ErrorHandler.Succeeded( outputWindow.CreatePane( ref workspacePaneGuid, "Roslyn Logger Output", fInitVisible: 1, fClearWithSolution: 1 ) ) && ErrorHandler.Succeeded( outputWindow.GetPane(ref workspacePaneGuid, out var pane) ) ) { return(pane); } return(null); }
/// <summary> /// Initializes the services and adds well-known window panes to the cache /// </summary> static OutputWindow() { cache = new Dictionary <Guid, OutputWindowPane>(); outputWindowService = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; if (outputWindowService == null) { throw new Exception("Cannot consume SVsOutputWindow service."); } cache.Add(blackHoleGuid, new OutputWindowPane(null)); // obtain standard VS output window panes (if they exist) OutputWindowPane buildPane = GetStandardPane(VSConstants.GUID_BuildOutputWindowPane); if (buildPane != null) { cache.Add(VSConstants.GUID_BuildOutputWindowPane, buildPane); } OutputWindowPane generalPane = GetStandardPane(VSConstants.GUID_OutWindowGeneralPane); if (generalPane != null) { cache.Add(VSConstants.GUID_OutWindowGeneralPane, generalPane); } OutputWindowPane debugPane = GetStandardPane(VSConstants.GUID_OutWindowDebugPane); if (debugPane != null) { cache.Add(VSConstants.GUID_OutWindowDebugPane, debugPane); } }
public static void Initialize(IServiceProvider provider, string name) { ThreadHelper.ThrowIfNotOnUIThread(); _output = (IVsOutputWindow)provider.GetService(typeof(SVsOutputWindow)); Assumes.Present(_output); _name = name; }
public static IVsOutputWindowPane GetOrCreateSonarLintOutputPane(IServiceProvider serviceProvider) { IVsOutputWindow outputWindow = serviceProvider.GetService <SVsOutputWindow, IVsOutputWindow>(); if (outputWindow == null) { Debug.Fail("Could not get IVsOutputWindow"); return(null); } const bool makeVisible = true; const bool clearWithSolution = false; IVsOutputWindowPane pane; int hrGetPane = outputWindow.GetPane(ref SonarLintOutputPaneGuid, out pane); if (ErrorHandler.Succeeded(hrGetPane)) { return(pane); } int hrCreatePane = outputWindow.CreatePane( ref SonarLintOutputPaneGuid, Strings.SonarLintOutputPaneTitle, Convert.ToInt32(makeVisible), Convert.ToInt32(clearWithSolution)); Debug.Assert(ErrorHandler.Succeeded(hrCreatePane), "Failed in outputWindow.CreatePane: " + hrCreatePane.ToString()); hrGetPane = outputWindow.GetPane(ref SonarLintOutputPaneGuid, out pane); Debug.Assert(ErrorHandler.Succeeded(hrGetPane), "Failed in outputWindow.GetPane: " + hrGetPane.ToString()); return(pane); }
/// <summary> /// output string into output window (general pane) /// </summary> /// <param name="output">string to output</param> private void OutputString(string output) { if (_generalPane == null) { try { IVsOutputWindow outWindow = PowerShellToolsPackage.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid generalPaneGuid = VSConstants.OutputWindowPaneGuid.GeneralPane_guid; // By default this is no pane created in output window, so we need to create one by our own // This call won't do anything if there is one exists int hr = outWindow.CreatePane(generalPaneGuid, "General", 1, 1); outWindow.GetPane(ref generalPaneGuid, out _generalPane); } catch (Exception ex) { Log.Error("Failed to create general pane of output window due to exception: ", ex); throw; } } if (_generalPane != null) { _generalPane.Activate(); // Brings this pane into view _generalPane.OutputStringThreadSafe(output); // Thread-safe so the the output order can be preserved } }
public static void WriteMessage(string format, params object[] args) { IVsOutputWindow outputWindow = VsServiceProvider.Get(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid guidGeneral = VSConstants.OutputWindowPaneGuid.GeneralPane_guid; if (outputWindow == null) { return; } IVsOutputWindowPane pane; int hr = outputWindow.CreatePane(guidGeneral, "General", 1, 0); hr = outputWindow.GetPane(guidGeneral, out pane); if (pane == null) { return; } if (!format.EndsWith("\r\n")) { format = format + "\r\n"; } pane.Activate(); pane.OutputString(string.Format(format, args)); }
public void LogMessage(LogLevel level, string message, params object[] args) { //! Copy Guid. Guid customGuid = logGuid; //! Get OutputWindow and Create a new Pane. if (logWnd == null) { ThreadHelper.ThrowIfNotOnUIThread(); logWnd = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; logWnd.CreatePane(ref customGuid, "NArrange", 1, 1); } //! Get Pane, Log to it and Activate it. if (logWnd != null) { IVsOutputWindowPane customPane; logWnd.GetPane(ref customGuid, out customPane); customPane.OutputString(String.Format(message, args)); customPane.OutputString("\r\n"); //! Brings this pane into view customPane.Activate(); } Debug.WriteLine(message, args); }
/// <summary> /// Configure <see cref="IVsOutputWindow"/> and <see cref="IVsOutputWindowPane"/> /// </summary> public static void Configure() { vsOutputWindow = Package.GetGlobalService(typeof(IVsOutputWindow)) as IVsOutputWindow; vsOutputWindow.CreatePane(ref guid, LogTitle, 1, 0); vsOutputWindow.GetPane(ref guid, out vsOutputWindowPane); vsOutputWindowPane.Activate(); }
public static async Task InitializeAsync(AsyncPackage provider, string name) { _output = await provider.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow; Assumes.Present(_output); _name = name; }
private async System.Threading.Tasks.Task <bool> EnsurePaneAsync() { if (_pane == null) { try { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (_pane == null) { IVsOutputWindow output = await ServiceProvider.GetGlobalServiceAsync <SVsOutputWindow, IVsOutputWindow>(); var guid = new Guid(); ErrorHandler.ThrowOnFailure(output.CreatePane(ref guid, _paneTitle, 1, 1)); ErrorHandler.ThrowOnFailure(output.GetPane(ref guid, out _pane)); } } catch { // Nothing to do if this fails } } return(_pane != null); }
public static void Log(object toWrite, bool openWindow = false) { if (toWrite == null) { return; } if (_outWindow == null) { _outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; } string customTitle = "Suction"; _outWindow.CreatePane(ref _customGuid, customTitle, 1, 1); IVsOutputWindowPane pane; _outWindow.GetPane(ref _customGuid, out pane); pane.OutputString(toWrite.ToString()); pane.OutputString(Environment.NewLine); if (openWindow) { pane.Activate(); } }
public BuildOutputConsole(IVsOutputWindow vsOutputWindow) { if (vsOutputWindow == null) { throw new ArgumentNullException(nameof(vsOutputWindow)); } _vsOutputWindow = vsOutputWindow; _outputWindowPane = new AsyncLazy <IVsOutputWindowPane>(async() => { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _vsOutputWindow.GetPane(ref BuildWindowPaneGuid, out var outputWindowPane); return(outputWindowPane); }, NuGetUIThreadHelper.JoinableTaskFactory); _outputWindowTextWriter = new AsyncLazy <OutputWindowTextWriter>(async() => { var outputWindowPane = await _outputWindowPane.GetValueAsync(); if (outputWindowPane != null) { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); return(new OutputWindowTextWriter(outputWindowPane)); } else { return(null); } }, NuGetUIThreadHelper.JoinableTaskFactory); }
internal static void WriteOnOutputWindow(IVsOutputWindow provider, string text) { if (null == provider) { return; } IVsOutputWindow outputWindow = provider; Guid guidGeneral = VSConstants.GUID_OutWindowGeneralPane; if (ErrorHandler.Failed(outputWindow.GetPane(ref guidGeneral, out IVsOutputWindowPane windowPane)) || null == windowPane) { ErrorHandler.Failed(outputWindow.CreatePane(ref guidGeneral, "General", 1, 0)); if (ErrorHandler.Failed(outputWindow.GetPane(ref guidGeneral, out windowPane)) || null == windowPane) { return; } ErrorHandler.Failed(windowPane.Activate()); } if (ErrorHandler.Failed(windowPane.OutputString(text))) { } }
// Methods internal static void WriteLine(string format, params object[] args) { if ((_windowPane == null) && !_failedPaneCreation) { IVsOutputWindow globalService = (IVsOutputWindow)Package.GetGlobalService(typeof(SVsOutputWindow)); Guid xBuilderWindowPane = GuidList.XBuilderWindowPane; if (ErrorHandler.Failed(globalService.GetPane(ref xBuilderWindowPane, out _windowPane))) { try { ErrorHandler.ThrowOnFailure(globalService.CreatePane(ref xBuilderWindowPane, "XBuilder", 1, 1)); ErrorHandler.ThrowOnFailure(globalService.GetPane(ref xBuilderWindowPane, out _windowPane)); } catch { _failedPaneCreation = true; throw; } } } if (_windowPane != null) { ErrorHandler.ThrowOnFailure(_windowPane.Activate()); ErrorHandler.ThrowOnFailure(_windowPane.OutputString(string.Format(CultureInfo.CurrentUICulture, format + "\n", args))); } }
// create the output pane public static void MakeOutputPane() { IVsOutputWindow window = MsVsShell.Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid guid = s_OutputPaneGuid; window.CreatePane(ref guid, "NLV listener", 1, 0); }
public MessageCentre() { _outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; if (_outputWindow == null) { throw new Exception("Package.GetGlobalService(SVsOutputWindow) failed to provide the output window"); } Guid tempId = VSConstants.GUID_OutWindowDebugPane; _outputWindow.GetPane(ref tempId, out _debugPane); tempId = s_DeploymentMessagesPaneGuid; _outputWindow.CreatePane(ref tempId, "nanoFramework Extension", 0, 1); tempId = s_DeploymentMessagesPaneGuid; _outputWindow.GetPane(ref tempId, out _deploymentMessagesPane); _showInternalErrors = false; // TODO replace with project user option exposed in device explorer //if (RegistryAccess.GetBoolValue(@"\NonVersionSpecific\UserInterface", "showInternalErrors", out m_fShowInternalErrors, false)) //{ // this.Message(m_deploymentMessagesPane, "nanoFramework deployment internal errors will be reported."); //} _statusBar = Package.GetGlobalService(typeof(SVsStatusbar)) as IVsStatusbar; }
public static void Initialize(IServiceProvider provider, string name) { _output = (IVsOutputWindow)provider.GetService(typeof(SVsOutputWindow)); _name = name; // Ensure the pane before using it (otherwise first log will never come) EnsurePane(); }
private static async Task <bool> EnsurePaneAsync() { if (_pane == null) { try { if (_pane == null) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); IVsOutputWindow output = await VS.Windows.GetOutputWindowAsync(); var guid = new Guid(); ErrorHandler.ThrowOnFailure(output.CreatePane(ref guid, _paneTitle, 1, 1)); ErrorHandler.ThrowOnFailure(output.GetPane(ref guid, out _pane)); } } catch { // Swallow the exception } } return(_pane != null); }
/// <summary> /// Write the outputText to the General Output Window, /// using a Tab named tabName. /// </summary> /// <param name="outputText"></param> /// <param name="tabName"></param> internal static void WriteOutputWindow(string outputText, string tabName) { ThreadHelper.ThrowIfNotOnUIThread(); IVsOutputWindow outputWindow = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; // If we fail to get it we can exit now. if (null == outputWindow) { return; } // Now get the window pane for the general output. Guid guidGeneral = Microsoft.VisualStudio.VSConstants.GUID_OutWindowGeneralPane; IVsOutputWindowPane windowPane = null; if (Microsoft.VisualStudio.ErrorHandler.Failed(outputWindow.GetPane(ref guidGeneral, out windowPane))) { if (Microsoft.VisualStudio.ErrorHandler.Failed(outputWindow.CreatePane(ref guidGeneral, tabName, 1, 0))) { return; } outputWindow.GetPane(ref guidGeneral, out windowPane); } #if DEV17 if (Microsoft.VisualStudio.ErrorHandler.Failed(windowPane.OutputStringThreadSafe(outputText))) #else if (Microsoft.VisualStudio.ErrorHandler.Failed(windowPane.OutputString(outputText))) #endif { } // }
/// <summary> /// Writes to the general output window. /// https://stackoverflow.com/a/1852535/1233379 /// </summary> /// <param name="msg"></param> public static void Output(string msg, bool appendTS = true, bool debugOnly = true) { if (debugOnly && !AppHelper.Debug) { return; } ThreadHelper.ThrowIfNotOnUIThread(); if (AppHelper.Debug) { msg = String.Format("[{0}] {1}", "DEBUG", msg); } if (appendTS) { msg = String.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss"), msg); } // ADD TO Error List pane TaskManager.AddWarning(msg); // ADD TO custom Output pane IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid customGuid = new Guid(GuidList.GuidPkgString); IVsOutputWindowPane customPane = null; outWindow.GetPane(ref customGuid, out customPane); if (customPane == null) { string customTitle = "Source Control Switcher [Debug]"; outWindow.CreatePane(ref customGuid, customTitle, 1, 1); outWindow.GetPane(ref customGuid, out customPane); } customPane.Activate(); // Brings this pane into view customPane.OutputString(msg); }
public static OutputWindow Create(IVsOutputWindow outputWindowService) { IVsOutputWindowPane outputWindowPane; var generalPaneId = VSConstants.OutputWindowPaneGuid.GeneralPane_guid; outputWindowService.CreatePane(generalPaneId, "General", 1, 0); outputWindowService.GetPane(ref generalPaneId, out outputWindowPane); return new OutputWindow(outputWindowPane); }
public OutputConsole(IVsOutputWindow outputWindow) { if (outputWindow == null) { throw new ArgumentNullException("outputWindow"); } _outputWindow = outputWindow; }
public VsOutputWindow(DTE2 dte2) { using ( var sp = new ServiceProvider( (IServiceProvider) dte2)) { _output = (IVsOutputWindow) sp.GetService(typeof (SVsOutputWindow)); } }
/// <param name="ow"></param> /// <param name="name">Name of the pane</param> public PaneCOM(IVsOutputWindow ow, string name) { if(ow == null) { throw new ArgumentNullException("ow", "cannot be null"); } Guid id = GuidList.OWP_SBE; ow.CreatePane(ref id, name, 1, 1); ow.GetPane(ref id, out pane); this.Guid = id; }
/// <summary> /// Initialization of the IVsOutputWindowPane /// note: probably slow initialization, /// and be careful with using in Initialize() of package or constructor, /// may be inner exception for COM object in VS (tested on VS2013 with docked to output panel) /// Otherwise, use the IVsUIShell.FindToolWindow (again, only with __VSFINDTOOLWIN.FTW_fFindFirst) /// </summary> /// <param name="name">Name of the pane</param> /// <param name="ow"></param> /// <param name="dteContext"></param> public void paneAttach(string name, IVsOutputWindow ow, EnvDTE.DTE dteContext) { dte = dteContext; if(_paneCOM != null || _paneDTE != null) { Log.Debug("paneAttach-COM: skipped"); return; // currently we work only with one pane } Guid id = GuidList.OWP_SBE; ow.CreatePane(ref id, name, 1, 1); ow.GetPane(ref id, out _paneCOM); }
public static void Initialise() { outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; // Use e.g. Tools -> Create GUID to make a stable, but unique GUID for your pane. // Also, in a real project, this should probably be a static constant, and not a local variable // http://stackoverflow.com/questions/1094366/how-do-i-write-to-the-visual-studio-output-window-in-my-custom-tool var guid = new Guid(OutputWindowGuidString); var title = "EnvDTE"; outWindow.CreatePane(ref guid, title, 1, 1); outWindow.GetPane(ref guid, out customPane); }
private bool EnsurePane() { if (pane == null) { lock (syncRoot) { this.outputWindow = this.package.VsHelper.GetGlobalService<IVsOutputWindow>(typeof(SVsOutputWindow)); var customGuid = new Guid(GuidList.guidErcOutputPaneWindow); this.outputWindow.CreatePane(ref customGuid, ".erc", 1, 0); this.outputWindow.GetPane(ref customGuid, out this.pane); } } return pane != null; }
protected override void Initialize() { base.Initialize(); _statusBar = GetService(typeof (SVsStatusbar)) as IVsStatusbar; _oleMenuCommandService = GetService(typeof (IMenuCommandService)) as OleMenuCommandService; _outputWindow = GetService(typeof (SVsOutputWindow)) as IVsOutputWindow; _sortIcon = (short) Constants.SBAI_General; if (_oleMenuCommandService != null) { var menuCommandId = new CommandID(GuidList.guidErsx_Net_VsixCmdSet, (int) PkgCmdIDList.sortResx); var menuItem = new OleMenuCommand(MenuItemClick, StatusChanged, BeforeContextMenuOpens, menuCommandId); _oleMenuCommandService.AddCommand(menuItem); } }
public static void Log(object toWrite, bool openWindow = false) { if (toWrite == null) return; if (_outWindow == null) _outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; string customTitle = "Suction"; _outWindow.CreatePane(ref _customGuid, customTitle, 1, 1); IVsOutputWindowPane pane; _outWindow.GetPane(ref _customGuid, out pane); pane.OutputString(toWrite.ToString()); pane.OutputString(Environment.NewLine); if (openWindow) pane.Activate(); }
/// <summary> /// Initialization of the IVsOutputWindowPane /// note: probably slow, /// and be careful with using inside `Initialize()` method or constructor of main package, /// may be inner exception for COM object in VS (tested on VS2013 with docked to output panel) /// Otherwise, use the IVsUIShell.FindToolWindow (again, only with __VSFINDTOOLWIN.FTW_fFindFirst) /// </summary> /// <param name="name">Name of the pane</param> /// <param name="ow"></param> /// <param name="dteContext"></param> public void paneAttach(string name, IVsOutputWindow ow, EnvDTE.DTE dteContext) { dte = dteContext; if(upane != null) { Log.Debug("paneAttach-COM: pane is already attached."); return; } upane = new PaneCOM(ow, name); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); ActivateBuildOrderPaneCmd.Initialize(this); // Get solution build manager _solutionBuildManager = ServiceProvider.GlobalProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2; if (_solutionBuildManager != null) _solutionBuildManager.AdviseUpdateSolutionEvents(this, out _updateSolutionEventsCookie); _outputWindow = (IVsOutputWindow)GetService(typeof(SVsOutputWindow)); if (_outputWindow != null) { _outputWindow.GetPane(VSConstants.OutputWindowPaneGuid.SortedBuildOutputPane_guid, out _buildOrderPane); } }
public static IVsOutputWindowPane FindGeneralPane(IVsOutputWindow outputWindow) { Guid paneGuid = VSConstants.GUID_OutWindowGeneralPane; IVsOutputWindowPane results; outputWindow.GetPane(ref paneGuid, out results); return results; }
public static void Initialize(IServiceProvider provider, string name) { _output = (IVsOutputWindow)provider.GetService(typeof(SVsOutputWindow)); _name = name; }
private void InitializeOutputWindow() { outputWindow = Common.GetService(typeof(IVsOutputWindow)) as IVsOutputWindow; }
private void DisposeOutputWindow() { outputWindow = null; }
private void InitializeOutputWindow() { try { // sometimes failed on VS2010 outputWindow = Common.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; } catch { outputWindow = null; } }
/// <summary> /// Detaching OWP by IVsOutputWindow. /// </summary> /// <param name="ow"></param> public void paneDetach(IVsOutputWindow ow) { Guid id; if(_paneDTE != null) { id = new Guid(_paneDTE.Guid); //_paneDTE.Clear(); } else{ id = GuidList.OWP_SBE; } if(ow != null) { ow.DeletePane(ref id); } paneDetach(); }
public OutputWindowLogger(IVsOutputWindow outputWindow) { this.outputWindow = outputWindow; }
private void SetupOutputWindow() { this.outputWindow = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; this.guid = new Guid("0F44E2D1-F5FA-4d2d-AB30-22BE8ECD9789"); var windowTitle = "Line Endings Unifier"; this.outputWindow.CreatePane(ref this.guid, windowTitle, 1, 1); }
//--// public MessageCentreDeployment() { m_outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; if(m_outputWindow == null) throw new Exception( "Package.GetGlobalService(SVsOutputWindow) failed to provide the output window" ); Guid tempId = VSConstants.GUID_OutWindowDebugPane; m_outputWindow.GetPane(ref tempId, out m_debugPane); tempId = s_DeploymentMessagesPaneGuid; m_outputWindow.CreatePane(ref tempId, "Micro Framework Device Deployment", 0, 1); tempId = s_DeploymentMessagesPaneGuid; m_outputWindow.GetPane(ref tempId, out m_deploymentMessagesPane); m_fShowInternalErrors = false; if (RegistryAccess.GetBoolValue(@"\NonVersionSpecific\UserInterface", "showInternalErrors", out m_fShowInternalErrors, false)) { this.Message(m_deploymentMessagesPane, "Micro Framework deployment internal errors will be reported."); } m_statusBar = Package.GetGlobalService(typeof(SVsStatusbar)) as IVsStatusbar; }
/// <summary> /// Detaching OWP by IVsOutputWindow. /// </summary> /// <param name="ow"></param> public void paneDetach(IVsOutputWindow ow) { Guid id = (upane != null)? upane.Guid : GuidList.OWP_SBE; paneDetach(); if(ow != null) { ow.DeletePane(ref id); } }
public static void Initialize(IVsOutputWindow outputWindow) { _outputWindow = outputWindow; _customGuid = new Guid(GuidList.guidVisualStudioOutputWindow); }
public OutputService(IServiceProvider serviceProvider) { this.outputWindow = serviceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; }
public OutputPane(IVsOutputWindow outputWindow) { Window = outputWindow; }
public static async task InitializeAsync(AsyncPackage package, string name) { _output = await package.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow; _name = name; }