コード例 #1
0
        public IInteractiveWindowVisualComponent Create(int instanceId, IInteractiveEvaluator evaluator)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            var vsWindow = _vsInteractiveWindowFactoryLazy.Value.Create(RGuidList.ReplInteractiveWindowProviderGuid, instanceId, Resources.ReplWindowName, evaluator);

            vsWindow.SetLanguage(RGuidList.RLanguageServiceGuid, _contentType);

            var toolWindow = (ToolWindowPane)vsWindow;
            var frame      = (IVsWindowFrame)toolWindow.Frame;

            frame.SetProperty((int)__VSFPROPID4.VSFPROPID_TabImage, Resources.ReplWindowIcon);
            // TODO: figure out why REPL window doesn't get 'force create' flag set
            // For now, set it forcibly when window is shown
            object value;

            frame.GetProperty((int)__VSFPROPID.VSFPROPID_CreateToolWinFlags, out value);
            frame.SetProperty((int)__VSFPROPID.VSFPROPID_CreateToolWinFlags, (int)value | (int)__VSCREATETOOLWIN.CTW_fForceCreate);

            var componentContainer = new VisualComponentToolWindowAdapter <IInteractiveWindowVisualComponent>(toolWindow);
            var component          = new RInteractiveWindowVisualComponent(vsWindow.InteractiveWindow, componentContainer);

            componentContainer.Component = component;
            return(component);
        }
コード例 #2
0
        public IInteractiveWindowVisualComponent Create(int instanceId, IInteractiveEvaluator evaluator, IRSessionProvider sessionProvider)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            IVsInteractiveWindow vsWindow;

#if VS14
            vsWindow = _vsInteractiveWindowFactoryLazy.Value.Create(RGuidList.ReplInteractiveWindowProviderGuid, instanceId, string.Empty, evaluator);
#else
            var vsf2 = _vsInteractiveWindowFactoryLazy.Value as IVsInteractiveWindowFactory2; // Temporary for VS 2017 RC2
            vsWindow = vsf2.Create(RGuidList.ReplInteractiveWindowProviderGuid, instanceId, string.Empty, evaluator,
                                   0, RGuidList.RCmdSetGuid, RPackageCommandId.replWindowToolBarId, null);
#endif

            var contentType = _contentTypeRegistryService.GetContentType(RContentTypeDefinition.ContentType);
            vsWindow.SetLanguage(RGuidList.RLanguageServiceGuid, contentType);

            var toolWindow         = (ToolWindowPane)vsWindow;
            var componentContainer = new VisualComponentToolWindowAdapter <IInteractiveWindowVisualComponent>(toolWindow);
            var component          = new RInteractiveWindowVisualComponent(vsWindow.InteractiveWindow, componentContainer, sessionProvider, _shell);
            componentContainer.Component = component;

            RegisterFocusPreservingWindow(toolWindow);

            return(component);
        }
        public IInteractiveWindowVisualComponent Create(int instanceId, IInteractiveEvaluator evaluator, IRSessionProvider sessionProvider)
        {
            var tb        = new TextBufferMock(string.Empty, RContentTypeDefinition.ContentType);
            var container = new VisualComponentContainerStub <RInteractiveWindowVisualComponent>();
            var component = new RInteractiveWindowVisualComponent(new InteractiveWindowMock(new WpfTextViewMock(tb), evaluator), container, sessionProvider, _shell);

            container.Component = component;
            return(component);
        }
コード例 #4
0
        public IInteractiveWindowVisualComponent Create(int instanceId, IInteractiveEvaluator evaluator, IRSessionProvider sessionProvider)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            var vsWindow    = _vsInteractiveWindowFactoryLazy.Value.Create(RGuidList.ReplInteractiveWindowProviderGuid, instanceId, string.Empty, evaluator);
            var contentType = _contentTypeRegistryService.GetContentType(RContentTypeDefinition.ContentType);

            vsWindow.SetLanguage(RGuidList.RLanguageServiceGuid, contentType);

            var toolWindow         = (ToolWindowPane)vsWindow;
            var componentContainer = new VisualComponentToolWindowAdapter <IInteractiveWindowVisualComponent>(toolWindow);
            var component          = new RInteractiveWindowVisualComponent(vsWindow.InteractiveWindow, componentContainer, sessionProvider, _shell);

            componentContainer.Component = component;
            return(component);
        }
コード例 #5
0
        public IInteractiveWindowVisualComponent Create(int instanceId, IInteractiveEvaluator evaluator, IRSessionProvider sessionProvider)
        {
            _shell.MainThread().Assert();

            var vsf2      = _vsInteractiveWindowFactoryLazy.Value;
            var vsWindow2 = vsf2.Create(RGuidList.ReplInteractiveWindowProviderGuid, instanceId, string.Empty, evaluator,
                                        0, RGuidList.RCmdSetGuid, RPackageCommandId.replWindowToolBarId, null);

            var contentType = _contentTypeRegistryService.GetContentType(RContentTypeDefinition.ContentType);

            vsWindow2.SetLanguage(RGuidList.RLanguageServiceGuid, contentType);

            var toolWindow         = (ToolWindowPane)vsWindow2;
            var componentContainer = new VisualComponentToolWindowAdapter <IInteractiveWindowVisualComponent>(toolWindow, _shell.Services);
            var component          = new RInteractiveWindowVisualComponent(vsWindow2.InteractiveWindow, componentContainer, sessionProvider, _shell);

            componentContainer.Component = component;

            RegisterFocusPreservingWindow(toolWindow);

            return(component);
        }