private EnvDTE.ProjectItem GetProjectItemFromDocumentCookie(uint cookie)
        {
            uint         pgrfRDTFlags;
            uint         pdwReadLocks;
            uint         pdwEditLocks;
            string       pbstrMkDocument;
            IVsHierarchy ppHier;
            uint         pitemid;
            IntPtr       ppunkDocData;

            try
            {
                if (RunningDocumentTable.GetDocumentInfo(
                        cookie,
                        out pgrfRDTFlags,
                        out pdwReadLocks,
                        out pdwEditLocks,
                        out pbstrMkDocument,
                        out ppHier,
                        out pitemid,
                        out ppunkDocData) == VSConstants.S_OK)
                {
                    return(DTEUtil.GetProjectItem(ppHier, pitemid));
                }
            }
            catch (Exception ex)
            {
                Package.UnexpectedExceptionWarning(ex);
                throw;
            }
            return(null);
        }