From 62ebfc7fb0dc91fceec9cec964839ecdfe4e757d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Tue, 27 Mar 2012 17:39:16 +0200 Subject: [PATCH] Disabled out name filter for create field,property and method. --- .../CodeActions/CreateFieldAction.cs | 8 ++++---- .../CreateMethodDeclarationAction.cs | 8 ++++---- .../CodeActions/CreatePropertyAction.cs | 8 ++++---- .../CSharp/CodeActions/CreateFieldTests.cs | 17 +---------------- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs index 8c1d94b253e..673a638e4d3 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs @@ -66,10 +66,10 @@ public IEnumerable GetActions(RefactoringContext context) var state = context.GetResolverStateBefore(identifier); bool isStatic = state.CurrentMember.IsStatic; - var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); - if (service != null && !service.IsValidName(identifier.Identifier, AffectedEntity.Field, Modifiers.Private, isStatic)) { - yield break; - } +// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); +// if (service != null && !service.IsValidName(identifier.Identifier, AffectedEntity.Field, Modifiers.Private, isStatic)) { +// yield break; +// } yield return new CodeAction(context.TranslateString("Create field"), script => { var decl = new FieldDeclaration() { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateMethodDeclarationAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateMethodDeclarationAction.cs index 2245e2e9a34..29b0ccd1210 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateMethodDeclarationAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateMethodDeclarationAction.cs @@ -132,10 +132,10 @@ public IEnumerable GetActionsFromInvocation(RefactoringContext conte isStatic = invocation.Target is IdentifierExpression && state.CurrentMember.IsStatic; } - var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); - if (service != null && !service.IsValidName(methodName, AffectedEntity.Method, Modifiers.Private, isStatic)) { - yield break; - } +// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); +// if (service != null && !service.IsValidName(methodName, AffectedEntity.Method, Modifiers.Private, isStatic)) { +// yield break; +// } yield return new CodeAction(context.TranslateString("Create method"), script => { var decl = new MethodDeclaration() { diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs index 0253c19b881..d6a4408ab33 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreatePropertyAction.cs @@ -83,10 +83,10 @@ public IEnumerable GetActions(RefactoringContext context) isStatic = identifier is IdentifierExpression && state.CurrentMember.IsStatic; } - var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); - if (service != null && !service.IsValidName(propertyName, AffectedEntity.Property, Modifiers.Private, isStatic)) { - yield break; - } +// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService)); +// if (service != null && !service.IsValidName(propertyName, AffectedEntity.Property, Modifiers.Private, isStatic)) { +// yield break; +// } yield return new CodeAction(context.TranslateString("Create property"), script => { var decl = new PropertyDeclaration() { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateFieldTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateFieldTests.cs index 4bd55042b73..368efc463fc 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateFieldTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeActions/CreateFieldTests.cs @@ -32,22 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions [TestFixture] public class CreateFieldTests : ContextActionTestBase { - [Test()] - public void TestWrongContext1 () - { - TestWrongContext ( - "using System;" + Environment.NewLine + - "class TestClass" + Environment.NewLine + - "{" + Environment.NewLine + - " void Test ()" + Environment.NewLine + - " {" + Environment.NewLine + - " Console.WriteLine ($Foo);" + Environment.NewLine + - " }" + Environment.NewLine + - "}" - ); - } - - [Test()] + [Test()] public void TestWrongContext2 () { TestWrongContext (