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(); } } }
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(); } } }
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(); } } }
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(); } } }