示例#1
0
        protected override int CreateToolWindow(ref Guid toolWindowType, int id)
        {
            if (toolWindowType == GuidList.guidPythonInteractiveWindowGuid)
            {
                var    pyService = this.GetPythonToolsService();
                var    category  = SelectableReplEvaluator.GetSettingsCategory(id.ToString());
                string replId;
                try {
                    replId = pyService.LoadString("Id", category);
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    Debug.Fail("Could not load settings for interactive window.", ex.ToString());
                    replId = null;
                }

                if (string.IsNullOrEmpty(replId))
                {
                    pyService.DeleteCategory(category);
                    return(VSConstants.S_OK);
                }

                pyService.ComponentModel.GetService <InteractiveWindowProvider>().Create(replId, id);
                return(VSConstants.S_OK);
            }

            return(base.CreateToolWindow(ref toolWindowType, id));
        }
示例#2
0
        protected override int CreateToolWindow(ref Guid toolWindowType, int id)
        {
            // We can't move initialization of PythonInteractiveWindow into AsyncToolWindowFactory
            // because Package.ShowToolWindow doesn't call IVsAsyncToolWindowFactory.CreateToolWindow
            // which makes it impossible to fully override tool window creation
            if (toolWindowType == GuidList.guidPythonInteractiveWindowGuid)
            {
                var    pyService = this.GetPythonToolsService();
                var    category  = SelectableReplEvaluator.GetSettingsCategory(id.ToString());
                string replId;
                try {
                    replId = pyService.LoadString("Id", category);
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    Debug.Fail("Could not load settings for interactive window.", ex.ToString());
                    replId = null;
                }

                if (string.IsNullOrEmpty(replId))
                {
                    pyService.DeleteCategory(category);
                    return(VSConstants.S_OK);
                }

                pyService.ComponentModel.GetService <InteractiveWindowProvider>().Create(replId, id);
                return(VSConstants.S_OK);
            }

            return(base.CreateToolWindow(ref toolWindowType, id));
        }