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