From 3f4aeb0331f7787ac7e158fc9082fdd5e9ae8e95 Mon Sep 17 00:00:00 2001 From: Bill Menees Date: Sat, 25 Apr 2020 15:41:35 -0500 Subject: [PATCH] Split off Highlight and Tasks options classes --- src/Menees.VsTools/BaseConverter/Options.cs | 25 +-- src/Menees.VsTools/Editor/ClassifierBase.cs | 4 +- .../Editor/FindResultsClassifier.cs | 2 +- src/Menees.VsTools/Editor/HighlightOptions.cs | 169 ++++++++++++++++ src/Menees.VsTools/Editor/OutputClassifier.cs | 4 +- src/Menees.VsTools/Guids.cs | 4 + .../MainPackage.VsAttributes.cs | 38 +++- src/Menees.VsTools/MainPackage.cs | 42 +++- src/Menees.VsTools/Menees.VsTools.csproj | 9 + src/Menees.VsTools/Options.cs | 187 +----------------- src/Menees.VsTools/OptionsBase.cs | 47 +++++ src/Menees.VsTools/Resources/VSPackage.resx | 8 + src/Menees.VsTools/SortMembersDialog.xaml | 6 +- src/Menees.VsTools/SortMembersDialog.xaml.cs | 11 ++ .../Tasks/CommentTaskProvider.cs | 11 +- src/Menees.VsTools/Tasks/HierarchyVisitor.cs | 54 +++-- src/Menees.VsTools/Tasks/Options.cs | 94 +++++++++ src/Menees.VsTools/Tasks/TasksControl.xaml.cs | 4 +- 18 files changed, 463 insertions(+), 256 deletions(-) create mode 100644 src/Menees.VsTools/Editor/HighlightOptions.cs create mode 100644 src/Menees.VsTools/OptionsBase.cs create mode 100644 src/Menees.VsTools/Tasks/Options.cs diff --git a/src/Menees.VsTools/BaseConverter/Options.cs b/src/Menees.VsTools/BaseConverter/Options.cs index 199084f..c3f9041 100644 --- a/src/Menees.VsTools/BaseConverter/Options.cs +++ b/src/Menees.VsTools/BaseConverter/Options.cs @@ -31,7 +31,7 @@ [Guid(Guids.BaseConverterOptionsString)] [DefaultProperty(nameof(TrimLeadingZerosEndian))] // Make this get focus in the PropertyGrid first since its category is alphabetically first. [SuppressMessage("Internal class never created.", "CA1812", Justification = "Created via reflection by VS.")] - internal class Options : DialogPage + internal class Options : OptionsBase { #region Constructors @@ -44,12 +44,6 @@ public Options() #endregion - #region Public Events - - public event EventHandler Applied; - - #endregion - #region Public Browsable Properties (for Options page) [Category("Base Converter")] @@ -93,22 +87,5 @@ public Options() public NumberType BaseConverterNumberType { get; set; } #endregion - - #region Protected Methods - - protected override void OnApply(PageApplyEventArgs e) - { - base.OnApply(e); - - // Raise an event so non-modal windows like BaseConverterControl - // can get a notification that they may need to update. - if (e.ApplyBehavior == ApplyKind.Apply && this.Applied != null) - { - EventHandler eh = this.Applied; - eh(this, e); - } - } - - #endregion } } diff --git a/src/Menees.VsTools/Editor/ClassifierBase.cs b/src/Menees.VsTools/Editor/ClassifierBase.cs index 3b8529f..8a8fd06 100644 --- a/src/Menees.VsTools/Editor/ClassifierBase.cs +++ b/src/Menees.VsTools/Editor/ClassifierBase.cs @@ -58,7 +58,7 @@ public IList GetClassificationSpans(SnapshotSpan span) ThreadHelper.ThrowIfNotOnUIThread(); if (span.Length > 0) { - this.GetClassificationSpans(result, span, MainPackage.GeneralOptions); + this.GetClassificationSpans(result, span, MainPackage.HighlightOptions); } return result; @@ -104,7 +104,7 @@ protected virtual void Dispose(bool disposing) } } - protected abstract void GetClassificationSpans(List result, SnapshotSpan span, Options options); + protected abstract void GetClassificationSpans(List result, SnapshotSpan span, HighlightOptions options); // If we're passed a specific option ID, then return false because we can't read it here to tell if it changed. // If we're passed null or empty, then return true as if something changed. diff --git a/src/Menees.VsTools/Editor/FindResultsClassifier.cs b/src/Menees.VsTools/Editor/FindResultsClassifier.cs index 88a7f9f..c4a300f 100644 --- a/src/Menees.VsTools/Editor/FindResultsClassifier.cs +++ b/src/Menees.VsTools/Editor/FindResultsClassifier.cs @@ -58,7 +58,7 @@ public FindResultsClassifier(ITextBuffer buffer, IClassificationTypeRegistryServ #region Protected Methods - protected override void GetClassificationSpans(List result, SnapshotSpan span, Options options) + protected override void GetClassificationSpans(List result, SnapshotSpan span, HighlightOptions options) { bool showFileNames = options.HighlightFindResultsFileNames; bool showMatches = options.HighlightFindResultsMatches; diff --git a/src/Menees.VsTools/Editor/HighlightOptions.cs b/src/Menees.VsTools/Editor/HighlightOptions.cs new file mode 100644 index 0000000..16bc5e9 --- /dev/null +++ b/src/Menees.VsTools/Editor/HighlightOptions.cs @@ -0,0 +1,169 @@ +namespace Menees.VsTools.Editor +{ + #region Using Directives + + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.ComponentModel.Design; + using System.Diagnostics.CodeAnalysis; + using System.Drawing.Design; + using System.Linq; + using System.Runtime.InteropServices; + using System.Text; + using System.Threading.Tasks; + + #endregion + + // Note: The MainPackage has ProvideOptionPage and ProvideProfile attributes + // that associate this class with our package. Helpful pages: + // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.dialogpage(v=vs.110).aspx + // http://msdn.microsoft.com/en-us/library/bb162586(v=vs.110).aspx + // http://bloggingabout.net/blogs/perikles/archive/2006/11/22/How-to-dynamically-Import_2F00_Export-setting-in-Visual-Studio-2005_2E00_.aspx + [Guid(Guids.HighlightOptionsString)] + [DefaultProperty(nameof(HighlightFindResultsDetails))] // Make this get focus in the PropertyGrid first since its category is alphabetically first. + [SuppressMessage("Internal class never created.", "CA1812", Justification = "Created via reflection by VS.")] + internal sealed class HighlightOptions : OptionsBase + { + #region Internal Constants + + internal const string DefaultCaption = "Highlight"; + + #endregion + + #region Private Data Members + + private List outputHighlights; + + #endregion + + #region Constructors + + public HighlightOptions() + { + this.HighlightOutputText = true; + this.OutputHighlights = CreateDefaultOutputHighlights(); + this.HighlightFindResultsDetails = true; + this.HighlightFindResultsFileNames = true; + this.HighlightFindResultsMatches = true; + } + + #endregion + + #region Public Browsable Properties (for Options page) + + [Category("Output Windows")] + [DisplayName("Highlight output window text")] + [Description("Whether pattern-matched lines in output windows should be highlighted.")] + [DefaultValue(true)] + public bool HighlightOutputText { get; set; } + + [Category("Output Windows")] + [DisplayName("Output patterns to highlight")] + [Description("Defines regular expressions used to highlight lines in output windows.")] + [TypeConverter(typeof(OutputHighlightListTypeConverter))] + [Editor(typeof(CollectionEditor), typeof(UITypeEditor))] + public List OutputHighlights + { + get + { + return this.outputHighlights; + } + + set + { + // Reset to the default highlights if the user deletes them all. + if (value == null || value.Count == 0) + { + this.outputHighlights = CreateDefaultOutputHighlights(); + } + else + { + this.outputHighlights = value; + } + } + } + + [Category("Find Windows")] + [DisplayName("Highlight Find Results details")] + [Description("Whether non-matched details in Find Results windows should be highlighted.")] + [DefaultValue(true)] + public bool HighlightFindResultsDetails { get; set; } + + [Category("Find Windows")] + [DisplayName("Highlight Find Results file names")] + [Description("Whether file names in Find Results windows should be highlighted.")] + [DefaultValue(true)] + public bool HighlightFindResultsFileNames { get; set; } + + [Category("Find Windows")] + [DisplayName("Highlight Find Results matches")] + [Description("Whether search term/expression matches in Find Results windows should be highlighted.")] + [DefaultValue(true)] + public bool HighlightFindResultsMatches { get; set; } + + #endregion + + #region Private Methods + + private static List CreateDefaultOutputHighlights() + { + List result = new List(); + + ISet knownOutputContentTypes = OutputHighlight.GetKnownOutputContentTypes(); + + string[] buildContent = OutputHighlight.ValidateContentTypes(new[] { "BuildOutput", "BuildOrderOutput" }, knownOutputContentTypes); + if (buildContent.Length > 0) + { + result.Add(new OutputHighlight("Code Analysis Success", OutputHighlightType.None, @"\s0 error\(s\), 0 warning\(s\)$", buildContent)); + } + + // The "Ext: ExceptionBreaker (Diagnostic)" pane uses a general Output content type. + // We have to match this before the normal "exception:" rule. + result.Add(new OutputHighlight( + "Previous/Conflicting Exception", + OutputHighlightType.None, + @"^\s*(Previous|Conflicting) exception:") + { MatchCase = true }); + + string[] debugContent = OutputHighlight.ValidateContentTypes(new[] { "DebugOutput" }, knownOutputContentTypes); + if (debugContent.Length > 0) + { + result.Add(new OutputHighlight("Exception", OutputHighlightType.Error, @"(exception:|stack trace:)", debugContent)); + result.Add(new OutputHighlight("Exception At", OutputHighlightType.Error, @"^\s+at\s", debugContent)); + } + + string[] testsContent = OutputHighlight.ValidateContentTypes(new[] { "TestsOutput" }, knownOutputContentTypes); + if (testsContent.Length > 0) + { + result.Add(new OutputHighlight("Test Host Abort", OutputHighlightType.Error, @"^The active (\w+\s)+was aborted\s", testsContent)); + result.Add(new OutputHighlight("Test Host Exception", OutputHighlightType.Error, @"\wException:\s", testsContent) { MatchCase = true }); + } + + string[] tfsContent = OutputHighlight.ValidateContentTypes(new[] { "TFSourceControlOutput" }, knownOutputContentTypes); + if (tfsContent.Length > 0) + { + result.Add(new OutputHighlight("TFS Error Code", OutputHighlightType.Error, @"^TF\d+\:\s", tfsContent)); + result.Add(new OutputHighlight("TFS Unable To Get", OutputHighlightType.Warning, @"\WUnable to perform the get operation\W", tfsContent)); + result.Add(new OutputHighlight("TFS Newer Version", OutputHighlightType.Warning, @"(\W|^)newer version exists in source control$", tfsContent)); + result.Add(new OutputHighlight("TFS Auto Resolve", OutputHighlightType.Information, @"^Automatically resolved conflict\:\W", tfsContent)); + result.Add(new OutputHighlight("TFS Check In", OutputHighlightType.Information, @"^Changeset \d+ successfully checked in\.$", tfsContent)); + result.Add(new OutputHighlight("TFS Check Out", OutputHighlightType.Detail, @"\Whas been automatically checked out\W", tfsContent)); + result.Add(new OutputHighlight("TFS Open For Edit", OutputHighlightType.Detail, @"^\s*opened for edit in\s", tfsContent)); + result.Add(new OutputHighlight("TFS File Path", OutputHighlightType.Detail, @"^\$/.+\:$", tfsContent)); + } + + // These apply to all Output windows, so put them last. The Header/Footer pattern has to come + // before the Error pattern because builds use the word "failed" in the output footer. + result.Add(new OutputHighlight("Header/Footer", OutputHighlightType.Header, @"------ |========== ")); + result.Add(new OutputHighlight("Exception cache is built", OutputHighlightType.None, @"^Exception cache is built\:")); + result.Add(new OutputHighlight("Error", OutputHighlightType.Error, @"(\W|^)(error|fail|failed|exception)\W")); + result.Add(new OutputHighlight("Warning", OutputHighlightType.Warning, @"(\W|^)warning\W")); + result.Add(new OutputHighlight("Information", OutputHighlightType.Information, @"(\W|^)information\W")); + + return result; + } + + #endregion + } +} diff --git a/src/Menees.VsTools/Editor/OutputClassifier.cs b/src/Menees.VsTools/Editor/OutputClassifier.cs index 2caeaf9..2ed9851 100644 --- a/src/Menees.VsTools/Editor/OutputClassifier.cs +++ b/src/Menees.VsTools/Editor/OutputClassifier.cs @@ -53,7 +53,7 @@ public OutputClassifier(ITextBuffer buffer, IClassificationTypeRegistryService r #region Protected Methods - protected override void GetClassificationSpans(List result, SnapshotSpan span, Options options) + protected override void GetClassificationSpans(List result, SnapshotSpan span, HighlightOptions options) { if (this.CacheHighlights(options)) { @@ -96,7 +96,7 @@ protected override void ContentTypeChanged(ITextBuffer buffer, ContentTypeChange #region Private Methods - private bool CacheHighlights(Options options) + private bool CacheHighlights(HighlightOptions options) { bool result = options != null && options.HighlightOutputText; diff --git a/src/Menees.VsTools/Guids.cs b/src/Menees.VsTools/Guids.cs index 3f3fe45..b543195 100644 --- a/src/Menees.VsTools/Guids.cs +++ b/src/Menees.VsTools/Guids.cs @@ -23,6 +23,10 @@ internal static class Guids public const string GeneralOptionsString = "bd511b61-46fe-4997-965b-c5408b6be977"; + public const string HighlightOptionsString = "47c7cdc7-44c2-4107-8aa0-a0cb73b468a0"; + + public const string TasksOptionsString = "3e8cab32-2743-4c91-9826-62e717281ea8"; + public static readonly Guid MeneesVsToolsPackage = new Guid(MeneesVsToolsPackageString); public static readonly Guid MeneesVsToolsCommandSet = new Guid(MeneesVsToolsCommandSetString); diff --git a/src/Menees.VsTools/MainPackage.VsAttributes.cs b/src/Menees.VsTools/MainPackage.VsAttributes.cs index b7487d5..8b414b9 100644 --- a/src/Menees.VsTools/MainPackage.VsAttributes.cs +++ b/src/Menees.VsTools/MainPackage.VsAttributes.cs @@ -20,7 +20,7 @@ #endregion -#pragma warning disable SA1515 +#pragma warning disable SA1515 // SingleLineCommentsMustBePrecededByBlankLine [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] // Tells the PkgDef creation utility (CreatePkgDef.exe) that this class is a package. // Registers the information needed to show this package in the Help/About dialog of Visual Studio. @@ -71,6 +71,42 @@ isToolsOptionPage: true, DescriptionResourceID = 114, MigrationType = ProfileMigrationType.PassThrough)] // Registers settings persistence. Affects Import/Export Settings. + [ProvideOptionPage( + typeof(Tasks.Options), + categoryName: Title, + pageName: TasksWindow.DefaultCaption, + categoryResourceID: 113, + pageNameResourceID: 116, + supportsAutomation: false, + SupportsProfiles = true, + ProfileMigrationType = ProfileMigrationType.PassThrough)] // Registers an Options page + [ProvideProfile( + typeof(Tasks.Options), + categoryName: Title, + objectName: TasksWindow.DefaultCaption, + categoryResourceID: 113, + objectNameResourceID: 116, + isToolsOptionPage: true, + DescriptionResourceID = 114, + MigrationType = ProfileMigrationType.PassThrough)] // Registers settings persistence. Affects Import/Export Settings. + [ProvideOptionPage( + typeof(HighlightOptions), + categoryName: Title, + pageName: HighlightOptions.DefaultCaption, + categoryResourceID: 113, + pageNameResourceID: 117, + supportsAutomation: false, + SupportsProfiles = true, + ProfileMigrationType = ProfileMigrationType.PassThrough)] // Registers an Options page + [ProvideProfile( + typeof(HighlightOptions), + categoryName: Title, + objectName: HighlightOptions.DefaultCaption, + categoryResourceID: 113, + objectNameResourceID: 117, + isToolsOptionPage: true, + DescriptionResourceID = 114, + MigrationType = ProfileMigrationType.PassThrough)] // Registers settings persistence. Affects Import/Export Settings. #pragma warning restore SA1515 public sealed partial class MainPackage { diff --git a/src/Menees.VsTools/MainPackage.cs b/src/Menees.VsTools/MainPackage.cs index e93a8b9..1f8155f 100644 --- a/src/Menees.VsTools/MainPackage.cs +++ b/src/Menees.VsTools/MainPackage.cs @@ -26,6 +26,8 @@ public sealed partial class MainPackage : AsyncPackage, IDisposable private static Options generalOptions; private static BaseConverter.Options baseConverterOptions; + private static Tasks.Options tasksOptions; + private static HighlightOptions highlightOptions; private CommandProcessor processor; private ClassificationFormatManager formatManager; @@ -52,6 +54,21 @@ public MainPackage() #region Internal Properties + internal static BaseConverter.Options BaseConverterOptions + { + get + { + ThreadHelper.ThrowIfNotOnUIThread(); + + if (baseConverterOptions == null) + { + ForceLoad(); + } + + return baseConverterOptions; + } + } + internal static Options GeneralOptions { get @@ -67,18 +84,33 @@ internal static Options GeneralOptions } } - internal static BaseConverter.Options BaseConverterOptions + internal static HighlightOptions HighlightOptions { get { ThreadHelper.ThrowIfNotOnUIThread(); - if (baseConverterOptions == null) + if (highlightOptions == null) { ForceLoad(); } - return baseConverterOptions; + return highlightOptions; + } + } + + internal static Tasks.Options TasksOptions + { + get + { + ThreadHelper.ThrowIfNotOnUIThread(); + + if (tasksOptions == null) + { + ForceLoad(); + } + + return tasksOptions; } } @@ -188,6 +220,8 @@ protected override async System.Threading.Tasks.Task InitializeAsync(Cancellatio // From http://msdn.microsoft.com/en-us/library/bb165039.aspx generalOptions = this.GetDialogPage(typeof(Options)) as Options; baseConverterOptions = this.GetDialogPage(typeof(BaseConverter.Options)) as BaseConverter.Options; + tasksOptions = this.GetDialogPage(typeof(Tasks.Options)) as Tasks.Options; + highlightOptions = this.GetDialogPage(typeof(HighlightOptions)) as HighlightOptions; this.processor = new CommandProcessor(this); @@ -216,7 +250,7 @@ protected override async System.Threading.Tasks.Task InitializeAsync(Cancellatio // This option requires a restart if changed because the CommentTaskProvider and various // XxxMonitor classes attach to too many events and register too many things to easily // detach/unregister and clean them all up if this is toggled interactively. - if (GeneralOptions.EnableCommentScans) + if (TasksOptions.EnableCommentScans) { this.commentTaskProvider = new CommentTaskProvider(this); } diff --git a/src/Menees.VsTools/Menees.VsTools.csproj b/src/Menees.VsTools/Menees.VsTools.csproj index 1356e8d..09a4207 100644 --- a/src/Menees.VsTools/Menees.VsTools.csproj +++ b/src/Menees.VsTools/Menees.VsTools.csproj @@ -128,6 +128,9 @@ + + Component + @@ -152,6 +155,9 @@ Component + + Component + True @@ -188,6 +194,9 @@ + + Component + diff --git a/src/Menees.VsTools/Options.cs b/src/Menees.VsTools/Options.cs index 5d864d0..ac9d8f7 100644 --- a/src/Menees.VsTools/Options.cs +++ b/src/Menees.VsTools/Options.cs @@ -31,7 +31,7 @@ [Guid(Guids.GeneralOptionsString)] [DefaultProperty(nameof(IsMouseWheelZoomEnabled))] // Make this get focus in the PropertyGrid first since its category is alphabetically first. [SuppressMessage("Internal class never created.", "CA1812", Justification = "Created via reflection by VS.")] - internal class Options : DialogPage + internal class Options : OptionsBase { #region Private Data Members @@ -51,13 +51,7 @@ internal class Options : DialogPage "Private Event Handlers\r\n" + "Private Types"; - private const string DefaultExcludePatterns = @".+\.Designer\.\w+$" + "\r\n" + - @"modernizr-\d+\.\d+\.\d+(-vsdoc)?\.js$" + "\r\n" + - @"jquery-\d+\.\d+\.\d+(-vsdoc)?\.js$"; - private GuidFormat guidFormat; - private List outputHighlights; - private string excludeFromCommentScans; #endregion @@ -77,13 +71,6 @@ public Options() this.PredefinedRegions = DefaultPredefinedRegions; this.UppercaseGuids = true; this.IsMouseWheelZoomEnabled = true; - this.HighlightOutputText = true; - this.OutputHighlights = CreateDefaultOutputHighlights(); - this.HighlightFindResultsDetails = true; - this.HighlightFindResultsFileNames = true; - this.HighlightFindResultsMatches = true; - this.EnableCommentScans = true; - this.ExcludeFromCommentScans = DefaultExcludePatterns; // Other dialog state settings this.TrimEnd = true; @@ -93,12 +80,6 @@ public Options() #endregion - #region Public Events - - public event EventHandler Applied; - - #endregion - #region Public Browsable Properties (for Options page) [Category("Miscellaneous")] @@ -177,56 +158,6 @@ public string GuidFormatText [DefaultValue(true)] public bool IsMouseWheelZoomEnabled { get; set; } - [Category("Output and Find Windows")] - [DisplayName("Highlight output window text")] - [Description("Whether pattern-matched lines in output windows should be highlighted.")] - [DefaultValue(true)] - public bool HighlightOutputText { get; set; } - - [Category("Output and Find Windows")] - [DisplayName("Output patterns to highlight")] - [Description("Defines regular expressions used to highlight lines in output windows.")] - [TypeConverter(typeof(OutputHighlightListTypeConverter))] - [Editor(typeof(CollectionEditor), typeof(UITypeEditor))] - public List OutputHighlights - { - get - { - return this.outputHighlights; - } - - set - { - // Reset to the default highlights if the user deletes them all. - if (value == null || value.Count == 0) - { - this.outputHighlights = CreateDefaultOutputHighlights(); - } - else - { - this.outputHighlights = value; - } - } - } - - [Category("Output and Find Windows")] - [DisplayName("Highlight Find Results details")] - [Description("Whether non-matched details in Find Results windows should be highlighted.")] - [DefaultValue(true)] - public bool HighlightFindResultsDetails { get; set; } - - [Category("Output and Find Windows")] - [DisplayName("Highlight Find Results file names")] - [Description("Whether file names in Find Results windows should be highlighted.")] - [DefaultValue(true)] - public bool HighlightFindResultsFileNames { get; set; } - - [Category("Output and Find Windows")] - [DisplayName("Highlight Find Results matches")] - [Description("Whether search term/expression matches in Find Results windows should be highlighted.")] - [DefaultValue(true)] - public bool HighlightFindResultsMatches { get; set; } - [Category("Miscellaneous")] [DisplayName("Sort Members order")] [Description("A comma-separated list of member properties to order by. Prefix a property with '-' to order it descending. " + @@ -241,38 +172,6 @@ public List OutputHighlights [DefaultValue(false)] public bool OnlyShowSortMembersDialogWhenShiftIsPressed { get; set; } - [Category(nameof(Tasks))] - [DisplayName("Enable tasks provider (requires restart)")] - [Description("Whether open documents and files referenced by the current solution should be scanned for task comments.")] - [DefaultValue(true)] - public bool EnableCommentScans { get; set; } - - [Category(nameof(Tasks))] - [DisplayName("Exclude file name patterns")] - [Description("Regular expressions used to exclude solution items or open documents from being scanned for comments. " + - "Enter one pattern per line. Each pattern is matched against the fully-qualified file name.")] - [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))] - [DefaultValue(DefaultExcludePatterns)] - public string ExcludeFromCommentScans - { - get - { - return this.excludeFromCommentScans; - } - - set - { - if (string.IsNullOrEmpty(value)) - { - this.excludeFromCommentScans = DefaultExcludePatterns; - } - else - { - this.excludeFromCommentScans = value; - } - } - } - [Category("Miscellaneous")] [DisplayName("Build timing")] [Description("Whether build timing information should be added to the Build output window.")] @@ -331,12 +230,6 @@ public string ExcludeFromCommentScans [DefaultValue(false)] public bool SortEliminateDuplicates { get; set; } - [Browsable(false)] - [Category(nameof(Tasks))] - [DisplayName("Tasks Status Xml")] - [DefaultValue(null)] - public string TasksStatusXml { get; set; } - #endregion #region Internal Properties @@ -355,83 +248,5 @@ public static string[] SplitValues(string multiLineValue) } #endregion - - #region Protected Methods - - protected override void OnApply(PageApplyEventArgs e) - { - base.OnApply(e); - - // Raise an event so non-modal windows like BaseConverterControl - // can get a notification that they may need to update. - if (e.ApplyBehavior == ApplyKind.Apply && this.Applied != null) - { - EventHandler eh = this.Applied; - eh(this, e); - } - } - - #endregion - - #region Private Methods - - private static List CreateDefaultOutputHighlights() - { - List result = new List(); - - ISet knownOutputContentTypes = OutputHighlight.GetKnownOutputContentTypes(); - - string[] buildContent = OutputHighlight.ValidateContentTypes(new[] { "BuildOutput", "BuildOrderOutput" }, knownOutputContentTypes); - if (buildContent.Length > 0) - { - result.Add(new OutputHighlight("Code Analysis Success", OutputHighlightType.None, @"\s0 error\(s\), 0 warning\(s\)$", buildContent)); - } - - // The "Ext: ExceptionBreaker (Diagnostic)" pane uses a general Output content type. - // We have to match this before the normal "exception:" rule. - result.Add(new OutputHighlight( - "Previous/Conflicting Exception", - OutputHighlightType.None, - @"^\s*(Previous|Conflicting) exception:") { MatchCase = true }); - - string[] debugContent = OutputHighlight.ValidateContentTypes(new[] { "DebugOutput" }, knownOutputContentTypes); - if (debugContent.Length > 0) - { - result.Add(new OutputHighlight("Exception", OutputHighlightType.Error, @"(exception:|stack trace:)", debugContent)); - result.Add(new OutputHighlight("Exception At", OutputHighlightType.Error, @"^\s+at\s", debugContent)); - } - - string[] testsContent = OutputHighlight.ValidateContentTypes(new[] { "TestsOutput" }, knownOutputContentTypes); - if (testsContent.Length > 0) - { - result.Add(new OutputHighlight("Test Host Abort", OutputHighlightType.Error, @"^The active (\w+\s)+was aborted\s", testsContent)); - result.Add(new OutputHighlight("Test Host Exception", OutputHighlightType.Error, @"\wException:\s", testsContent) { MatchCase = true }); - } - - string[] tfsContent = OutputHighlight.ValidateContentTypes(new[] { "TFSourceControlOutput" }, knownOutputContentTypes); - if (tfsContent.Length > 0) - { - result.Add(new OutputHighlight("TFS Error Code", OutputHighlightType.Error, @"^TF\d+\:\s", tfsContent)); - result.Add(new OutputHighlight("TFS Unable To Get", OutputHighlightType.Warning, @"\WUnable to perform the get operation\W", tfsContent)); - result.Add(new OutputHighlight("TFS Newer Version", OutputHighlightType.Warning, @"(\W|^)newer version exists in source control$", tfsContent)); - result.Add(new OutputHighlight("TFS Auto Resolve", OutputHighlightType.Information, @"^Automatically resolved conflict\:\W", tfsContent)); - result.Add(new OutputHighlight("TFS Check In", OutputHighlightType.Information, @"^Changeset \d+ successfully checked in\.$", tfsContent)); - result.Add(new OutputHighlight("TFS Check Out", OutputHighlightType.Detail, @"\Whas been automatically checked out\W", tfsContent)); - result.Add(new OutputHighlight("TFS Open For Edit", OutputHighlightType.Detail, @"^\s*opened for edit in\s", tfsContent)); - result.Add(new OutputHighlight("TFS File Path", OutputHighlightType.Detail, @"^\$/.+\:$", tfsContent)); - } - - // These apply to all Output windows, so put them last. The Header/Footer pattern has to come - // before the Error pattern because builds use the word "failed" in the output footer. - result.Add(new OutputHighlight("Header/Footer", OutputHighlightType.Header, @"------ |========== ")); - result.Add(new OutputHighlight("Exception cache is built", OutputHighlightType.None, @"^Exception cache is built\:")); - result.Add(new OutputHighlight("Error", OutputHighlightType.Error, @"(\W|^)(error|fail|failed|exception)\W")); - result.Add(new OutputHighlight("Warning", OutputHighlightType.Warning, @"(\W|^)warning\W")); - result.Add(new OutputHighlight("Information", OutputHighlightType.Information, @"(\W|^)information\W")); - - return result; - } - - #endregion } } diff --git a/src/Menees.VsTools/OptionsBase.cs b/src/Menees.VsTools/OptionsBase.cs new file mode 100644 index 0000000..504b3e1 --- /dev/null +++ b/src/Menees.VsTools/OptionsBase.cs @@ -0,0 +1,47 @@ +namespace Menees.VsTools +{ + #region Using Directives + + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using Microsoft.VisualStudio.Shell; + + #endregion + + internal abstract class OptionsBase : DialogPage + { + #region Constructors + + protected OptionsBase() + { + } + + #endregion + + #region Public Events + + public event EventHandler Applied; + + #endregion + + #region Protected Methods + + protected override void OnApply(PageApplyEventArgs e) + { + base.OnApply(e); + + // Raise an event so non-modal windows like BaseConverterControl + // can get a notification that they may need to update. + if (e.ApplyBehavior == ApplyKind.Apply && this.Applied != null) + { + EventHandler eh = this.Applied; + eh(this, e); + } + } + + #endregion + } +} diff --git a/src/Menees.VsTools/Resources/VSPackage.resx b/src/Menees.VsTools/Resources/VSPackage.resx index adb35e3..835cd3b 100644 --- a/src/Menees.VsTools/Resources/VSPackage.resx +++ b/src/Menees.VsTools/Resources/VSPackage.resx @@ -141,6 +141,14 @@ Base Converter Name of Base Converter options page + + Tasks + Name of the Tasks options page + + + Highlight + Name of the Highlight options page + images.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/src/Menees.VsTools/SortMembersDialog.xaml b/src/Menees.VsTools/SortMembersDialog.xaml index 2a1c98f..9db37d7 100644 --- a/src/Menees.VsTools/SortMembersDialog.xaml +++ b/src/Menees.VsTools/SortMembersDialog.xaml @@ -17,9 +17,9 @@ - + -