示例#1
0
        public override void OnToolWindowCreated()
        {
            base.OnToolWindowCreated();

            var    frame = (IVsWindowFrame)Frame;
            object ouhw;

            ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out ouhw));

            // initialie w/ our hierarchy
            var hw = ouhw as IVsUIHierarchyWindow;

            _sessions = new SessionsNode((IServiceProvider)Package, hw);
            object punk;

            ErrorHandler.ThrowOnFailure(hw.Init(
                                            _sessions,
                                            (uint)(__UIHWINFLAGS.UIHWF_SupportToolWindowToolbars |
                                                   __UIHWINFLAGS.UIHWF_InitWithHiddenParentRoot |
                                                   __UIHWINFLAGS.UIHWF_HandlesCmdsAsActiveHierarchy),
                                            out punk
                                            ));

            // add our toolbar which  is defined in our VSCT file
            object otbh;

            ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out otbh));
            IVsToolWindowToolbarHost tbh = otbh as IVsToolWindowToolbarHost;
            Guid guidPerfMenuGroup       = GuidList.guidPythonProfilingCmdSet;

            ErrorHandler.ThrowOnFailure(tbh.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref guidPerfMenuGroup, PkgCmdIDList.menuIdPerfToolbar));
        }
示例#2
0
        public SessionNode(IServiceProvider serviceProvider, SessionsNode parent, ProfilingTarget target, string filename) {
            _serviceProvider = serviceProvider;
            _parent = parent;
            _target = target;
            _filename = filename;

            // Register this with the running document table.  This will prompt
            // for save when the file is dirty and by responding to GetProperty
            // for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of
            // our files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            var rdt = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable));
            Debug.Assert(rdt != null, "_serviceProvider has no RDT service");
            uint cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);
            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument(
                    (uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory),
                    filename,
                    this,
                    VSConstants.VSITEMID_ROOT,
                    punkDocData,
                    out cookie
                ));
            } finally {
                if (punkDocData != IntPtr.Zero) {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;

            ItemId = parent._sessionsCollection.Add(this);
        }
示例#3
0
        public override void OnToolWindowCreated() {            
            base.OnToolWindowCreated();

            var frame = (IVsWindowFrame)Frame;
            object ouhw;
            ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out ouhw));

            // initialie w/ our hierarchy
            var hw = ouhw as IVsUIHierarchyWindow;
            _sessions = new SessionsNode((IServiceProvider)Package, hw);
            object punk;
            ErrorHandler.ThrowOnFailure(hw.Init(
                _sessions,
                (uint)(__UIHWINFLAGS.UIHWF_SupportToolWindowToolbars |
                __UIHWINFLAGS.UIHWF_InitWithHiddenParentRoot |
                __UIHWINFLAGS.UIHWF_HandlesCmdsAsActiveHierarchy),
                out punk
            ));

            // add our toolbar which  is defined in our VSCT file
            object otbh;
            ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out otbh));
            IVsToolWindowToolbarHost tbh = otbh as IVsToolWindowToolbarHost;
            Guid guidPerfMenuGroup = GuidList.guidPythonProfilingCmdSet;
            ErrorHandler.ThrowOnFailure(tbh.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref guidPerfMenuGroup, PkgCmdIDList.menuIdPerfToolbar));
        }
示例#4
0
        public SessionNode(IServiceProvider serviceProvider, SessionsNode parent, ProfilingTarget target, string filename)
        {
            _serviceProvider = serviceProvider;
            _parent          = parent;
            _target          = target;
            _filename        = filename;

            // Register this with the running document table.  This will prompt
            // for save when the file is dirty and by responding to GetProperty
            // for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of
            // our files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            var rdt = (IVsRunningDocumentTable)_serviceProvider.GetService(typeof(SVsRunningDocumentTable));

            Debug.Assert(rdt != null, "_serviceProvider has no RDT service");
            uint   cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);

            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument(
                                                (uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory),
                                                filename,
                                                this,
                                                VSConstants.VSITEMID_ROOT,
                                                punkDocData,
                                                out cookie
                                                ));
            } finally {
                if (punkDocData != IntPtr.Zero)
                {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;

            ItemId = parent._sessionsCollection.Add(this);
        }
示例#5
0
        public SessionNode(SessionsNode parent, ProfilingTarget target, string filename)
        {
            _parent   = parent;
            _target   = target;
            _filename = filename;

            // Register this with the running document table.  This will prompt for save when the file is dirty and
            // by responding to GetProperty for VSHPROPID_ItemDocCookie we will support Ctrl-S when one of our
            // files is dirty.
            // http://msdn.microsoft.com/en-us/library/bb164600(VS.80).aspx
            IVsRunningDocumentTable rdt = PythonProfilingPackage.GetGlobalService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
            uint   cookie;
            IntPtr punkDocData = Marshal.GetIUnknownForObject(this);

            try {
                ErrorHandler.ThrowOnFailure(rdt.RegisterAndLockDocument((uint)(_VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_EditLock | _VSRDTFLAGS.RDT_CanBuildFromMemory), filename, this, VSConstants.VSITEMID_ROOT, punkDocData, out cookie));
            } finally {
                if (punkDocData != IntPtr.Zero)
                {
                    Marshal.Release(punkDocData);
                }
            }
            _docCookie = cookie;
        }
示例#6
0
 internal AutomationProfiling(SessionsNode sessions)
 {
     _sessions = sessions;
 }
示例#7
0
 internal AutomationProfiling(SessionsNode sessions) {
     _sessions = sessions;
 }