From 64b95c625a5b98bd5517ea51811c4f302a7ed239 Mon Sep 17 00:00:00 2001 From: Ravi Chande Date: Mon, 14 Aug 2017 13:25:32 -0700 Subject: [PATCH] Revert "Merge pull request #20592 from sharwell/fix-options-page" This reverts commit b76c7b4e1e004d2ae59d008c07edad907e923811, reversing changes made to a526dba85177306f9da79bf16484a550cb2fa676. --- .../PreviewPane/PreviewPane.xaml.cs | 15 +++++---------- .../PreviewPane/PreviewPaneService.cs | 10 ++++------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs index ff2ccf4c833..dc03925fe1e 100644 --- a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs +++ b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs @@ -7,12 +7,11 @@ using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Navigation; +using EnvDTE; using Microsoft.CodeAnalysis.Diagnostics.Log; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Roslyn.Utilities; using Microsoft.CodeAnalysis.Editor.Implementation.Preview; -using IVsUIShell = Microsoft.VisualStudio.Shell.Interop.IVsUIShell; -using OLECMDEXECOPT = Microsoft.VisualStudio.OLE.Interop.OLECMDEXECOPT; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PreviewPane { @@ -25,7 +24,7 @@ internal partial class PreviewPane : UserControl, IDisposable private readonly string _id; private readonly bool _logIdVerbatimInTelemetry; - private readonly IVsUIShell _uiShell; + private readonly DTE _dte; private bool _isExpanded; private double _heightForThreeLineTitle; @@ -40,14 +39,14 @@ internal partial class PreviewPane : UserControl, IDisposable string helpLinkToolTipText, IReadOnlyList previewContent, bool logIdVerbatimInTelemetry, - IVsUIShell uiShell, + DTE dte, Guid optionPageGuid = default(Guid)) { InitializeComponent(); _id = id; _logIdVerbatimInTelemetry = logIdVerbatimInTelemetry; - _uiShell = uiShell; + _dte = dte; // Initialize header portion. if ((severityIcon != null) && !string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(title)) @@ -359,11 +358,7 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e) { if (_optionPageGuid != default(Guid)) { - ErrorHandler.ThrowOnFailure(_uiShell.PostExecCommand( - VSConstants.GUID_VSStandardCommandSet97, - (uint)VSConstants.VSStd97CmdID.ToolsOptions, - (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, - _optionPageGuid.ToString())); + _dte.ExecuteCommand("Tools.Options", _optionPageGuid.ToString()); } } } diff --git a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs index 5add7a32d0f..ea765534c4c 100644 --- a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs +++ b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs @@ -18,20 +18,18 @@ using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.Shell; -using IVsUIShell = Microsoft.VisualStudio.Shell.Interop.IVsUIShell; -using SVsUIShell = Microsoft.VisualStudio.Shell.Interop.SVsUIShell; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PreviewPane { [ExportWorkspaceServiceFactory(typeof(IPreviewPaneService), ServiceLayer.Host), Shared] internal class PreviewPaneService : ForegroundThreadAffinitizedObject, IPreviewPaneService, IWorkspaceServiceFactory { - private readonly IVsUIShell _uiShell; + private readonly EnvDTE.DTE _dte; [ImportingConstructor] public PreviewPaneService(SVsServiceProvider serviceProvider) { - _uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; + _dte = serviceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; } IWorkspaceService IWorkspaceServiceFactory.CreateService(HostWorkspaceServices workspaceServices) @@ -109,7 +107,7 @@ private static Uri GetHelpLink(DiagnosticData diagnostic, string language, strin return new PreviewPane( severityIcon: null, id: null, title: null, description: null, helpLink: null, helpLinkToolTipText: null, - previewContent: previewContent, logIdVerbatimInTelemetry: false, uiShell: _uiShell); + previewContent: previewContent, logIdVerbatimInTelemetry: false, dte: _dte); } var helpLinkToolTipText = string.Empty; @@ -130,7 +128,7 @@ private static Uri GetHelpLink(DiagnosticData diagnostic, string language, strin helpLinkToolTipText: helpLinkToolTipText, previewContent: previewContent, logIdVerbatimInTelemetry: diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Telemetry), - uiShell: _uiShell, + dte: _dte, optionPageGuid: optionPageGuid); } -- GitLab