src/Misc/EFTools/DesignXmlCore/Refactoring/RefactoringOperationBase.cs
/// <summary>
///     Method to show the preview window.
///     This method will create a PreviewChangesEngine and PreviewChangesList and give these two information
///     to preview dialog.
/// </summary>
Method to show the preview window.
This method will create a PreviewChangesEngine and PreviewChangesList and give these two information
to preview dialog.
Method to show the preview window . This method will create a PreviewChangesEngine and PreviewChangesList and give these two information to preview dialog .
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsPreviewChangesService.PreviewChanges(Microsoft.VisualStudio.Shell.Interop.IVsPreviewChangesEngine)")]
        private void ShowPreviewWindow()
        {
            var builder = GetPreviewChangesNodeBuilder();
            var nodes = builder.Build(FileChanges);
            PreviewData.ChangeList = nodes;
            PreviewData.FileChanges = FileChanges;
            var warningText = AnalysisWarningText;
            if (!string.IsNullOrEmpty(warningText))
            {
                PreviewData.Warning = AnalysisWarningText;
                PreviewData.WarningLevel = __PREVIEWCHANGESWARNINGLEVEL.PCWL_Warning;
            }
            var previewChangeService = _serviceProvider.GetService(typeof(SVsPreviewChangesService)) as IVsPreviewChangesService;
            if (previewChangeService != null)
            {
                using (var previewEngine = new PreviewChangesEngine(ApplyChanges, PreviewData, _serviceProvider))
                {
                    var result = previewChangeService.PreviewChanges(previewEngine);
                    Debug.Assert(result == VSConstants.S_OK, "Failed to preview the change.");
                }
                PreviewData = null;
            }
            else
            {
                OnError(Resources.Error_FailedInvokePreviewWindow);
            }
        }
[ SuppressMessage ( " " , " " , MessageId = " " ) ] private void ShowPreviewWindow ( ) { var builder = GetPreviewChangesNodeBuilder ( ) ; var nodes = builder . Build ( FileChanges ) ; PreviewData . ChangeList = nodes ; PreviewData . FileChanges = FileChanges ; var warningText = AnalysisWarningText ; if ( ! string . IsNullOrEmpty ( warningText ) ) { PreviewData . Warning = AnalysisWarningText ; PreviewData . WarningLevel = __PREVIEWCHANGESWARNINGLEVEL . PCWL_Warning ; } var previewChangeService = _serviceProvider . GetService ( typeof ( SVsPreviewChangesService ) ) as IVsPreviewChangesService ; if ( previewChangeService != null ) { using ( var previewEngine = new PreviewChangesEngine ( ApplyChanges , PreviewData , _serviceProvider ) ) { var result = previewChangeService . PreviewChanges ( previewEngine ) ; Debug . Assert ( result == VSConstants . S_OK , " " ) ; } PreviewData = null ; } else { OnError ( Resources . Error_FailedInvokePreviewWindow ) ; } }
Method to show the preview window.
Method to show the preview window .
// Prepare Preview UI Data. // Create preview tree nodes from list of FileChanges. // Get RefactoringPreviewData for this RefactorOperation and assign the FileChanges list // and Preview tree nodes to this preview data. // After everything is set to that preview data, create a PreviewChangesEngine // and pass this operation to the engine.  Preview engine will use PreviewData  // property of this operation to populate the preview dialog.  And the engine // will also call back this operation's ApplyChanges method to apply all the changes. // Get the Preview Changes Service // Preview the Changes