Browse Source

Remove disabled context actions from AddInTree.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
27d2586752
  1. 4
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
  2. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/IssueManager.cs
  3. 3
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SearchForIssuesDialog.xaml.cs
  4. 17
      src/AddIns/BackendBindings/CSharpBinding/Tests/RegistrationTests.cs

4
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin

@ -140,8 +140,8 @@ @@ -140,8 +140,8 @@
</Path>
<Path path = "/SharpDevelop/ViewContent/TextEditor/C#/IssueProviders">
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.AccessToDisposedClosureIssue" />
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.AccessToModifiedClosureIssue" />
<!--<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.AccessToDisposedClosureIssue" />
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.AccessToModifiedClosureIssue" />-->
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.AssignmentMadeToSameVariableIssue" />
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.BitwiseOperationOnNonFlagsEnumIssue" />
<Class class = "ICSharpCode.NRefactory.CSharp.Refactoring.CallToObjectEqualsViaBaseIssue" />

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/IssueManager.cs

@ -52,6 +52,8 @@ namespace CSharpBinding.Refactoring @@ -52,6 +52,8 @@ namespace CSharpBinding.Refactoring
if (attributes.Length == 1) {
this.Attribute = (IssueDescriptionAttribute)attributes[0];
defaultSeverity = this.Attribute.Severity;
} else {
SD.Log.Warn("Issue provider without attribute: " + ProviderType);
}
var properties = PropertyService.NestedProperties("CSharpIssueSeveritySettings");
this.CurrentSeverity = properties.Get(ProviderType.FullName, defaultSeverity);

3
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/SearchForIssuesDialog.xaml.cs

@ -68,7 +68,8 @@ namespace CSharpBinding.Refactoring @@ -68,7 +68,8 @@ namespace CSharpBinding.Refactoring
{
internal RootTreeNode(IEnumerable<IssueManager.IssueProvider> providers)
{
this.Children.AddRange(providers.GroupBy(p => p.Attribute.Category, (key, g) => new CategoryTreeNode(key, g)));
this.Children.AddRange(providers.Where(p => p.Attribute != null)
.GroupBy(p => p.Attribute.Category, (key, g) => new CategoryTreeNode(key, g)));
this.IsChecked = false;
this.IsExpanded = true;
}

17
src/AddIns/BackendBindings/CSharpBinding/Tests/RegistrationTests.cs

@ -7,6 +7,7 @@ using System.Linq; @@ -7,6 +7,7 @@ using System.Linq;
using System.Reflection;
using CSharpBinding.Refactoring;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.CSharp.Refactoring;
using NUnit.Framework;
using Rhino.Mocks;
@ -46,11 +47,11 @@ namespace CSharpBinding.Tests @@ -46,11 +47,11 @@ namespace CSharpBinding.Tests
registeredIssueProviders = addIn.Paths["/SharpDevelop/ViewContent/TextEditor/C#/IssueProviders"].Codons
.Select(c => FindType(c.Properties["class"])).ToList();
NRissueProviders = NRCSharp.ExportedTypes.Where(t => !t.IsAbstract && t.GetInterface(typeof(ICodeIssueProvider).FullName) != null).ToList();
NRissueProviders = NRCSharp.ExportedTypes.Where(t => t.GetCustomAttribute<IssueDescriptionAttribute>() != null).ToList();
registeredContextActions = addIn.Paths["/SharpDevelop/ViewContent/TextEditor/C#/ContextActions"].Codons
.Select(c => FindType(c.Properties["class"])).ToList();
NRcontextActions = NRCSharp.ExportedTypes.Where(t => !t.IsAbstract && t.GetInterface(typeof(ICodeActionProvider).FullName) != null).ToList();
NRcontextActions = NRCSharp.ExportedTypes.Where(t => t.GetCustomAttribute<ContextActionAttribute>() != null).ToList();
}
[Test]
@ -60,6 +61,18 @@ namespace CSharpBinding.Tests @@ -60,6 +61,18 @@ namespace CSharpBinding.Tests
Assert.AreEqual(registeredContextActions, registeredContextActions.Distinct());
}
[Test]
public void AllAreRegisteredIssueProvidersHaveAttribute()
{
Assert.IsTrue(registeredIssueProviders.All(t => t.GetCustomAttribute<IssueDescriptionAttribute>() != null));
}
[Test]
public void AllAreRegisteredContextActionsHaveAttribute()
{
Assert.IsTrue(registeredContextActions.All(t => t.GetCustomAttribute<ContextActionAttribute>() != null));
}
[Test]
public void AllNRefactoryIssueProvidersAreRegistered()
{

Loading…
Cancel
Save