コード例 #1
0
        public static void OpenFileInPreviewTab(string file)
        {
            IVsNewDocumentStateContext newDocumentStateContext = null;

            try
            {
                IVsUIShellOpenDocument3 openDoc3 =
                    Package.GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument3;

                Guid reason = VSConstants.NewDocumentStateReason.Navigation;
                newDocumentStateContext = openDoc3.SetNewDocumentState(
                    (uint)__VSNEWDOCUMENTSTATE.NDS_Provisional,
                    ref reason);

                VSFoldersPackage.DTE.ItemOperations.OpenFile(file);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (newDocumentStateContext != null)
                {
                    newDocumentStateContext.Restore();
                }
            }
        }
コード例 #2
0
        public override object GetProperty(int propId)
        {
            if (propId == (int)__VSHPROPID5.VSHPROPID_ProvisionalViewingStatus)
            {
                var objectBrowserGuid = VSProjectConstants.guidObjectBrowser;
                var logicalViewGuid   = VSConstants.LOGVIEWID.Primary_guid;
                IVsUIShellOpenDocument3 shellOpenDocument3 = Package.GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument3;
                return(shellOpenDocument3.GetProvisionalViewingStatusForEditor(ref objectBrowserGuid, ref logicalViewGuid));
            }

            return(base.GetProperty(propId));
        }
コード例 #3
0
ファイル: Helpers.cs プロジェクト: modulexcite/DartVS
        public static void OpenFileInPreviewTab(IServiceProvider serviceProvider, string file)
        {
            IVsNewDocumentStateContext newDocumentStateContext = null;

            try
            {
                IVsUIShellOpenDocument3 openDoc3 = DartPackage.GetGlobalService <SVsUIShellOpenDocument>() as IVsUIShellOpenDocument3;

                Guid reason = VSConstants.NewDocumentStateReason.Navigation;
                newDocumentStateContext = openDoc3.SetNewDocumentState((uint)__VSNEWDOCUMENTSTATE.NDS_Provisional, ref reason);

                VsShellUtilities.OpenDocument(serviceProvider, file);
            }
            finally
            {
                if (newDocumentStateContext != null)
                {
                    newDocumentStateContext.Restore();
                }
            }
        }
コード例 #4
0
        private void OpenFileInPreviewTab(string file)
        {
            IVsNewDocumentStateContext newDocumentStateContext = null;

            try
            {
                IVsUIShellOpenDocument3 openDoc3 = EditorExtensionsPackage.GetGlobalService <SVsUIShellOpenDocument>() as IVsUIShellOpenDocument3;

                Guid reason = VSConstants.NewDocumentStateReason.Navigation;
                newDocumentStateContext = openDoc3.SetNewDocumentState((uint)__VSNEWDOCUMENTSTATE.NDS_Provisional, ref reason);

                EditorExtensionsPackage.DTE.ItemOperations.OpenFile(file);
            }
            finally
            {
                if (newDocumentStateContext != null)
                {
                    newDocumentStateContext.Restore();
                }
            }
        }
コード例 #5
0
        public static void OpenFileInPreviewTab(string file)
        {
            IVsNewDocumentStateContext context = null;

            try
            {
                IVsUIShellOpenDocument3 shell = SassyStudioPackage.GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument3;

                Guid reason = VSConstants.NewDocumentStateReason.Navigation;
                context = shell.SetNewDocumentState((uint)__VSNEWDOCUMENTSTATE.NDS_Provisional, ref reason);

                SassyStudioPackage.Instance.DTE.ItemOperations.OpenFile(file);
            }
            finally
            {
                if (context != null)
                {
                    context.Restore();
                }
            }
        }