[mono/monodevelop] a82ec206: [CodeIssuesPad] Add Project grouping

"Therzok ([email protected])" <[email protected]> Mon, 11 Nov 2013 14:00:22 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014247769111-c4b60638-55c3-433d-b695-cc65b50f266d-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/ae9523c2fa28...a82ec20632c3

   Commit: a82ec20632c3bbc09d7218ffe4b254b8d6e2d611
   Author: Therzok <[email protected]> (Therzok)
     Date: 2013-11-11 13:58:53 GMT
      URL: https://github.com/mono/monodevelop/commit/a82ec20632c3bbc09d7218ffe4b254b8d6e2d611

[CodeIssuesPad] Add Project grouping

Also has unit tests! =D

Changed paths:
  M main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePad.cs
  M main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
  M main/tests/UnitTests/MonoDevelop.Refactoring/GroupingProviderTestBase.cs
  M main/tests/UnitTests/UnitTests.csproj
Added paths:
  A main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/ProjectGroupingProvider.cs
  A main/tests/UnitTests/MonoDevelop.Refactoring/ProjectGroupingProviderTests.cs

Modified: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeIssuePad.cs
===================================================================
@@ -78,7 +78,8 @@ public class CodeIssuePadControl : VBox
 		static readonly Type[] groupingProviders = {
 			typeof(CategoryGroupingProvider),
 			typeof(ProviderGroupingProvider),
-			typeof(SeverityGroupingProvider)
+			typeof(SeverityGroupingProvider),
+			typeof(ProjectGroupingProvider)
 		};
 
 		public CodeIssuePadControl ()

Added: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/ProjectGroupingProvider.cs
===================================================================
@@ -0,0 +1,46 @@
+//
+// ProjectGroupingProvider.cs
+//
+// Author:
+//       Marius Ungureanu <[email protected]>
+//
+// Copyright (c) 2013 Marius Ungureanu
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using MonoDevelop.Projects;
+using System;
+
+namespace MonoDevelop.CodeIssues
+{
+	[GroupingDescription("Project")]
+	public class ProjectGroupingProvider : AbstractGroupingProvider<Project>
+	{
+		#region implemented abstract members of AbstractGroupingProvider
+		protected override Project GetGroupingKey (IssueSummary issue)
+		{
+			return issue.Project;
+		}
+		protected override string GetGroupName (IssueSummary issue)
+		{
+			return issue.Project.Name;
+		}
+		#endregion
+	}
+}
+


Modified: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
===================================================================
@@ -19,8 +19,8 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>False</ConsolePause>
-    <GenerateDocumentation>true</GenerateDocumentation>
     <NoWarn>1591;1573</NoWarn>
+    <DocumentationFile>..\..\..\build\AddIns\MonoDevelop.Refactoring\MonoDevelop.Refactoring.xml</DocumentationFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -30,8 +30,8 @@
     <WarningLevel>4</WarningLevel>
     <ConsolePause>False</ConsolePause>
     <DebugSymbols>true</DebugSymbols>
-    <GenerateDocumentation>true</GenerateDocumentation>
     <NoWarn>1591;1573</NoWarn>
+    <DocumentationFile>..\..\..\build\AddIns\MonoDevelop.Refactoring\MonoDevelop.Refactoring.xml</DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
@@ -152,6 +152,7 @@
     <Compile Include="MonoDevelop.CodeIssues\Runner\IJobContext.cs" />
     <Compile Include="MonoDevelop.CodeIssues\Runner\JobSlice.cs" />
     <Compile Include="MonoDevelop.CodeIssues\Runner\JobStatus.cs" />
+    <Compile Include="MonoDevelop.CodeIssues\ProjectGroupingProvider.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="MonoDevelop.Refactoring\" />

Modified: main/tests/UnitTests/MonoDevelop.Refactoring/GroupingProviderTestBase.cs
===================================================================
@@ -28,6 +28,7 @@
 using ICSharpCode.NRefactory.Refactoring;
 using ICSharpCode.NRefactory.TypeSystem;
 using ICSharpCode.NRefactory;
+using MonoDevelop.Projects;
 
 namespace MonoDevelop.Refactoring
 {
@@ -65,7 +66,10 @@ public abstract class GroupingProviderTestBase<T> where T: IGroupingProvider
 				ProviderDescription = "ProviderDescription",
 				ProviderTitle = "ProviderTitle",
 				Region = new DomRegion("fileName", new TextLocation(2, 3), new TextLocation(2, 10)),
-				Severity = Severity.None
+				Severity = Severity.None,
+				Project = new DotNetAssemblyProject {
+					Name = "ProjectName"
+				}
 			};
 		}
 		

Added: main/tests/UnitTests/MonoDevelop.Refactoring/ProjectGroupingProviderTests.cs
===================================================================
@@ -0,0 +1,56 @@
+//
+// ProjectGroupingProviderTests.cs
+//
+// Author:
+//       Marius Ungureanu <[email protected]>
+//
+// Copyright (c) 2013 Marius Ungureanu
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using MonoDevelop.CodeIssues;
+using ICSharpCode.NRefactory.Refactoring;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Refactoring
+{
+	public class ProjectGroupingProviderTests : GroupingProviderTestBase<ProjectGroupingProvider>
+	{
+		#region implemented abstract members of GroupingProviderTestBase
+
+		protected override ProjectGroupingProvider CreateProviderInstance ()
+		{
+			return new ProjectGroupingProvider ();
+		}
+
+		protected override IssueSummary[] GetDistinctSummaries ()
+		{
+			return new [] {
+				new IssueSummary {
+					Project = new DotNetAssemblyProject { Name = "Project1" }
+				},
+				new IssueSummary {
+					Project = new DotNetAssemblyProject { Name = "Project2" }
+				}
+			};
+		}
+
+		#endregion
+	}
+}
+


Modified: main/tests/UnitTests/UnitTests.csproj
===================================================================
@@ -296,6 +296,7 @@
     <Compile Include="MonoDevelop.CSharpBinding\UnitTesteditorIntegrationTests.cs" />
     <Compile Include="MonoDevelop.Refactoring\AnalysisJobQueueTests.cs" />
     <Compile Include="MonoDevelop.Refactoring\SimpleAnalysisJobTests.cs" />
+    <Compile Include="MonoDevelop.Refactoring\ProjectGroupingProviderTests.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="..\..\md.targets" />


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches