Esempio n. 1
0
        private EnvDTE.OutputWindowPane LoadOutputWindowPane(DTE dte)
        {
            const string windowName = "pMixins Code Generator";

            EnvDTE.OutputWindowPane pane   = null;
            EnvDTE.Window           window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            if (window != null)
            {
                EnvDTE.OutputWindow output = window.Object as EnvDTE.OutputWindow;
                if (output != null)
                {
                    pane = output.ActivePane;
                    if (pane == null || pane.Name != windowName)
                    {
                        for (int ix = output.OutputWindowPanes.Count; ix > 0; ix--)
                        {
                            pane = output.OutputWindowPanes.Item(ix);
                            if (pane.Name == windowName)
                            {
                                break;
                            }
                        }
                        if (pane == null || pane.Name != windowName)
                        {
                            pane = output.OutputWindowPanes.Add(windowName);
                        }
                        if (pane != null)
                        {
                            pane.Activate();
                        }
                    }
                }
            }
            return(pane);
        }
Esempio n. 2
0
 private void GetOutputWindow()
 {
     if (newOutputWindow == null)
     {
         object serviceObject = GetService(typeof(ProjectItem));
         Debug.Assert(serviceObject != null, "Unable to get Project Item.");
         if (serviceObject == null)
         {
             string errorMessage = "Unable to add DLL to project references.";
             GeneratorErrorCallback(false, 1, errorMessage, 0, 0);
             //				return null;
         }
         else
         {
             // get the output window
             EnvDTE.Window win = ((ProjectItem)serviceObject).DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
             win.Activate();
             //and the internal object (.nets window)
             EnvDTE.OutputWindow outputWindow = (EnvDTE.OutputWindow)win.Object;
             try
             {
                 // have we a curent pane?
                 newOutputWindow = outputWindow.OutputWindowPanes.Item("Proxy Builder");
             }
             catch
             {
                 // no, so create...strangely it errors, so it must be handled this way
                 newOutputWindow = outputWindow.OutputWindowPanes.Add("Proxy Builder");
             }
         }
     }
 }
Esempio n. 3
0
        private bool Initialize()
        {
            if (null != _outputPane)                    // already initialized?
            {
                return(true);
            }

            if (0 == _application.Windows.Count)
            {
                return(false);
            }
            _window = _application.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            if (null == _window)
            {
                return(false);
            }

            _outputWindow = _window.Object as EnvDTE.OutputWindow;
            if (null == _outputWindow)
            {
                return(false);
            }

            var outputWindowPane = from EnvDTE.OutputWindowPane pane in _outputWindow.OutputWindowPanes
                                   where pane.Name == _outputPaneName
                                   select pane;

            _outputPane = outputWindowPane.SingleOrDefault();
            if (_outputPane == null)
            {
                _outputPane = _outputWindow.OutputWindowPanes.Add(_outputPaneName);
            }

            return(_outputPane != null);
        }
Esempio n. 4
0
 private OutputWindow(DTE2 applicationObject)
 {
     if (null == _outputWindowPane)
     {
         EnvDTE.OutputWindow outputWindow = (EnvDTE.OutputWindow)applicationObject.Windows.Item(Constants.vsWindowKindOutput).Object;
         _outputWindowPane = outputWindow.OutputWindowPanes.Add("OMN Output");
     }
 }
Esempio n. 5
0
        public void OutputWindowWriteLine(string text)
        {
            const string DEBUG_OUTPUT_PANE_GUID = "{FC076020-078A-11D1-A7DF-00A0C9110051}";

            EnvDTE.Window window = (EnvDTE.Window)BabePackage.Current.DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            window.Visible = true;
            EnvDTE.OutputWindow outputWindow = (EnvDTE.OutputWindow)window.Object;
            foreach (EnvDTE.OutputWindowPane outputWindowPane in outputWindow.OutputWindowPanes)
            {
                if (outputWindowPane.Guid.ToUpper() == DEBUG_OUTPUT_PANE_GUID)
                {
                    outputWindowPane.OutputString(text + "\r\n");
                }
            }
        }
Esempio n. 6
0
        protected EnvDTE.OutputWindowPane GetOutputPane(DTE dte)
        {
            try
            {
                if (dte == null)
                {
                    return(null);
                }

                string windowName              = GetType().Name;
                EnvDTE.OutputWindowPane pane   = null;
                EnvDTE.Window           window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
                if (window != null)
                {
                    EnvDTE.OutputWindow output = window.Object as EnvDTE.OutputWindow;
                    if (output != null)
                    {
                        pane = output.ActivePane;
                        if (pane == null || pane.Name != windowName)
                        {
                            for (int ix = output.OutputWindowPanes.Count; ix > 0; ix--)
                            {
                                pane = output.OutputWindowPanes.Item(ix);
                                if (pane.Name == windowName)
                                {
                                    break;
                                }
                            }
                            if (pane == null || pane.Name != windowName)
                            {
                                pane = output.OutputWindowPanes.Add(windowName);
                            }
                            if (pane != null)
                            {
                                pane.Activate();
                            }
                        }
                    }
                }
                return(pane);
            }
            catch
            {
                return(null);
            }
        }