From 928d26fca82aeeac658499ae6929015d0bc7d6b1 Mon Sep 17 00:00:00 2001 From: Marius Ungureanu Date: Tue, 5 Feb 2019 02:29:23 +0200 Subject: [API] Remove a few obsolete items (#7042) * Remove some obsolete members * Remove unused C# policy item * Make toolbox item internal * Remove obsolete ToggleCategoryMode method * Remove obsolete XmlSchemaCompletionData constructor * Remove obsolete CloseAllDocuments * Remove RPC.Disconnect obsolete method * Remove obsolete Fold API * Remove obsolete IsCompileableFile * [MSBuildFileFormat] Add IEquatable and IComparable interfaces --- .../Mono.TextEditor/Document/TextDocument.cs | 6 --- .../RemoteProcessConnection.cs | 9 ---- .../MSBuildFileFormat.cs | 52 ++++++++++++---------- .../CompletionListWindow.cs | 6 --- .../MonoDevelop.Ide.Gui/Workbench.cs | 6 --- .../TypeSystemParserNode.cs | 11 ----- 6 files changed, 29 insertions(+), 61 deletions(-) (limited to 'main/src/core') diff --git a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs index d42a97274a..b2f5e61359 100644 --- a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs +++ b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs @@ -1397,12 +1397,6 @@ namespace Mono.TextEditor update = foldedSegmentAdded || countChanged || foldedFoldingRemoved; return newFoldedSegments; } - - [Obsolete("Doesn't do anything anymore")] - public void WaitForFoldUpdateFinished () - { - // nothing - } internal void InterruptFoldWorker () { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemoteProcessConnection.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemoteProcessConnection.cs index aa974f8028..2d804cf738 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemoteProcessConnection.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemoteProcessConnection.cs @@ -156,15 +156,6 @@ namespace MonoDevelop.Core.Execution } } - [Obsolete ("Use Disconnect()")] - public void Disconnect (bool waitUntilDone) - { - if (waitUntilDone) - Disconnect ().Wait (TimeSpan.FromSeconds (7)); - else - Disconnect ().Ignore (); - } - public async Task Disconnect () { StopPinger (); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs index e35886fdfe..57f4a1f42b 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildFileFormat.cs @@ -37,7 +37,7 @@ using System.Linq; namespace MonoDevelop.Projects.MSBuild { - public abstract class MSBuildFileFormat + public abstract class MSBuildFileFormat : IComparable, IEquatable { readonly SlnFileFormat slnFileFormat; @@ -51,9 +51,6 @@ namespace MonoDevelop.Projects.MSBuild public static readonly MSBuildFileFormat VS2010 = new MSBuildFileFormatVS10 (); public static readonly MSBuildFileFormat VS2012 = new MSBuildFileFormatVS12 (); - [Obsolete("This is the same as VS2012")] - public static readonly MSBuildFileFormat VS2017 = VS2012; - public static IEnumerable GetSupportedFormats () { yield return VS2012; @@ -68,12 +65,6 @@ namespace MonoDevelop.Projects.MSBuild } public static MSBuildFileFormat DefaultFormat => VS2012; - - [Obsolete ("Use ProductDescription or ID")] - public string Name => "MSBuild"; - - [Obsolete] - public abstract Version Version { get; } internal SlnFileFormat SlnFileFormat { get { return slnFileFormat; } @@ -229,17 +220,41 @@ namespace MonoDevelop.Projects.MSBuild } return string.Empty; } - + public abstract string Id { get; } + + #region IComparable implementation and overloads + + public override bool Equals (object obj) => obj is MSBuildFileFormat other && Equals (other); + public bool Equals (MSBuildFileFormat other) => other != null && Id == other.Id; + public override int GetHashCode () => Id.GetHashCode (); + + public int CompareTo (MSBuildFileFormat other) => Version.Parse (SlnVersion).CompareTo (Version.Parse (other.SlnVersion)); + + public static bool operator == (MSBuildFileFormat a, MSBuildFileFormat b) + { + if (ReferenceEquals (a, b)) + return true; + + if (a is null) + return b is null; + + return a.Equals (b); + } + + public static bool operator != (MSBuildFileFormat a, MSBuildFileFormat b) => !(a == b); + public static bool operator < (MSBuildFileFormat a, MSBuildFileFormat b) => a.CompareTo (b) < 0; + public static bool operator > (MSBuildFileFormat a, MSBuildFileFormat b) => a.CompareTo (b) > 0; + public static bool operator <= (MSBuildFileFormat a, MSBuildFileFormat b) => a.CompareTo (b) <= 0; + public static bool operator >= (MSBuildFileFormat a, MSBuildFileFormat b) => a.CompareTo (b) >= 0; + + #endregion } class MSBuildFileFormatVS05 : MSBuildFileFormat { public override string Id => "MSBuild05"; - [Obsolete("Unused")] - public override Version Version => new Version ("2005"); - public override string DefaultProductVersion => "8.0.50727"; public override string DefaultToolsVersion => "2.0"; public override string DefaultSchemaVersion => "2.0"; @@ -255,9 +270,6 @@ namespace MonoDevelop.Projects.MSBuild { public override string Id => "MSBuild08"; - [Obsolete ("Unused")] - public override Version Version => new Version ("2008"); - public override string DefaultProductVersion => "9.0.21022"; public override string DefaultToolsVersion => "3.5"; public override string DefaultSchemaVersion => "2.0"; @@ -279,9 +291,6 @@ namespace MonoDevelop.Projects.MSBuild { public override string Id => "MSBuild10"; - [Obsolete ("Unused")] - public override Version Version => new Version ("2010"); - public override string DefaultProductVersion => "8.0.30703"; public override string DefaultSchemaVersion => "2.0"; public override string DefaultToolsVersion => "4.0"; @@ -294,9 +303,6 @@ namespace MonoDevelop.Projects.MSBuild { public override string Id => "MSBuild12"; - [Obsolete ("Unused")] - public override Version Version => new Version ("2012"); - // This is mostly irrelevant, the builder always uses the latest // tools version. It's only used for new projects created with // the old project template engine. diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs index 9e7fef13ea..a954a6d4b2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs @@ -263,12 +263,6 @@ namespace MonoDevelop.Ide.CodeCompletion controller.HideWindow (); } - [Obsolete("Use CompletionWindowManager.ToggleCategoryMode")] - public void ToggleCategoryMode () - { - controller.ToggleCategoryMode (); - } - /// /// Gets or sets a value indicating that shift was pressed during enter. /// diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 70e04f0f73..6a780c7408 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -416,12 +416,6 @@ namespace MonoDevelop.Ide.Gui AlertButton.CloseWithoutSave, AlertButton.Cancel, doc.Window.ViewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save); } - [Obsolete("Use CloseAllDocumentsAsync")] - public void CloseAllDocuments (bool leaveActiveDocumentOpen) - { - CloseAllDocumentsAsync (leaveActiveDocumentOpen).Ignore (); - } - public async Task CloseAllDocumentsAsync (bool leaveActiveDocumentOpen) { Document[] docs = new Document [Documents.Count]; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs index fbd88c1e4c..3124ad9a0d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs @@ -84,16 +84,5 @@ namespace MonoDevelop.Ide.TypeSystem } return false; } - - [Obsolete ("Use p.IsCompileable")] - public static bool IsCompileableFile (ProjectFile file, out Microsoft.CodeAnalysis.SourceCodeKind sck) - => IsCompileableFile (null, file, out sck); - - [Obsolete ("Use p.IsCompileable")] - public static bool IsCompileableFile (MonoDevelop.Projects.Project p, ProjectFile file, out Microsoft.CodeAnalysis.SourceCodeKind sck) - { - sck = file.SourceCodeKind; - return p.IsCompileable (file.FilePath); - } } } -- cgit v1.2.3