コード例 #1
0
        internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
        {
            _componentModel = model;
            this.Caption = title;
            _editorAdapters = _componentModel.GetService<IVsEditorAdaptersFactoryService>();
            _evaluator = evaluator;

            // The following calls this.OnCreate:
            Guid clsId = this.ToolClsid;
            Guid empty = Guid.Empty;
            Guid typeId = providerId;
            IVsWindowFrame frame;
            var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.

            ErrorHandler.ThrowOnFailure(
                vsShell.CreateToolWindow(
                    (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags),
                    (uint)instanceId,
                    this.GetIVsWindowPane(),
                    ref clsId,
                    ref typeId,
                    ref empty,
                    null,
                    title,
                    null,
                    out frame
                )
            );

            this.Frame = frame;
        }
コード例 #2
0
        internal VsInteractiveWindow(
            IComponentModel model,
            Guid providerId,
            int instanceId,
            string title,
            IInteractiveEvaluator evaluator,
            __VSCREATETOOLWIN creationFlags,
            Guid toolbarCommandSet,
            uint toolbarId,
            IOleCommandTarget toolbarCommandTarget)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _componentModel = model;
            Caption         = title;
            _editorAdapters = _componentModel.GetService <IVsEditorAdaptersFactoryService>();
            _evaluator      = evaluator;

            _toolbarCommandSet    = toolbarCommandSet;
            _toolbarCommandTarget = toolbarCommandTarget;
            _toolbarId            = toolbarId;

            // The following calls this.OnCreate:
            Guid clsId  = ToolClsid;
            Guid empty  = Guid.Empty;
            Guid typeId = providerId;

            var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));

            if (vsShell == null)
            {
                throw new InvalidOperationException("Service 'SVsUIShell' is not available");
            }

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.

            ErrorHandler.ThrowOnFailure(
                vsShell.CreateToolWindow(
                    (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags),
                    (uint)instanceId,
                    GetIVsWindowPane(),
                    ref clsId,
                    ref typeId,
                    ref empty,
                    null,
                    title,
                    null,
                    out var frame
                    )
                );
            var guid = GetType().GUID;

            ErrorHandler.ThrowOnFailure(frame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_CmdUIGuid, ref guid));
            Frame = frame;
        }
コード例 #3
0
 public IVsInteractiveWindow Create(
     Guid providerId,
     int instanceId,
     string title,
     IInteractiveEvaluator evaluator,
     __VSCREATETOOLWIN creationFlags,
     Guid toolbarCommandSet,
     uint toolbarId,
     IOleCommandTarget toolbarCommandTarget)
 {
     return(new VsInteractiveWindow(_componentModel, providerId, instanceId, title, evaluator, creationFlags, toolbarCommandSet, toolbarId, toolbarCommandTarget));
 }
コード例 #4
0
        private ReplWindowInfo CreateReplWindowInternal(IReplEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId)
        {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model   = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveReplInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            __VSCREATETOOLWIN creationFlags = 0;

            if (!roles.Contains("DontPersist"))
            {
                creationFlags |= __VSCREATETOOLWIN.CTW_fForceCreate;
            }

            var replWindow = _windowFactory.Create(GuidList.guidPythonInteractiveWindowGuid, id, title, evaluator, creationFlags);

            replWindow.SetLanguage(GuidList.guidPythonLanguageServiceGuid, contentType);
            replWindow.InteractiveWindow.InitializeAsync();
            return(_windows[id] = new ReplWindowInfo(replWindow, replId));
        }
コード例 #5
0
        internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
        {
            _componentModel = model;
            this.Caption    = title;
            _editorAdapters = _componentModel.GetService <IVsEditorAdaptersFactoryService>();
            _evaluator      = evaluator;

            // The following calls this.OnCreate:
            Guid           clsId  = this.ToolClsid;
            Guid           empty  = Guid.Empty;
            Guid           typeId = providerId;
            IVsWindowFrame frame;
            var            vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.

            ErrorHandler.ThrowOnFailure(
                vsShell.CreateToolWindow(
                    (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags),
                    (uint)instanceId,
                    this.GetIVsWindowPane(),
                    ref clsId,
                    ref typeId,
                    ref empty,
                    null,
                    title,
                    null,
                    out frame
                    )
                );

            this.Frame = frame;
        }
コード例 #6
0
 public IVsInteractiveWindow Create(Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags = 0) {
     return new VsInteractiveWindowMock(new WpfTextViewMock(new TextBufferMock(string.Empty, "R")));
 }
コード例 #7
0
 public IVsInteractiveWindow Create(Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
 {
     return(Create(providerId, instanceId, title, evaluator, creationFlags, Guid.Empty, 0, null));
 }
コード例 #8
0
 internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
 {
     _windowPane = new VsInteractiveWindowPane(model, providerId, instanceId, title, evaluator, creationFlags);
 }
コード例 #9
0
 public IVsInteractiveWindow Create(Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags = 0)
 {
     return(new VsInteractiveWindowMock(new WpfTextViewMock(new TextBufferMock(string.Empty, "R"))));
 }
コード例 #10
0
 public IVsInteractiveWindow Create(Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags)
 {
     return new VsInteractiveWindow(_componentModel, providerId, instanceId, title, evaluator, creationFlags);
 }
コード例 #11
0
 public IVsInteractiveWindow Create(Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags, Guid toolbarCommandSet, uint toolbarId,
                                    IOleCommandTarget toolbarCommandTarget)
 => new VsInteractiveWindowMock(new WpfTextViewMock(new TextBufferMock(string.Empty, "R")), evaluator);