diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-11-10 19:23:27 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-11-10 19:23:27 +0400 |
commit | 5c59ef89e8e8db94a79122ae065867d7f9ec555e (patch) | |
tree | 4e5c0bd8a738e9008b3acc2ae0397790695fff1c /main/src/addins/MonoDevelop.Refactoring | |
parent | 6c2449841f5277c673b19e717b6346d53d5d8a79 (diff) |
[CSharpBinding] Implemented unused usings indicator.
Diffstat (limited to 'main/src/addins/MonoDevelop.Refactoring')
8 files changed, 5 insertions, 426 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/FindTypeReferencesVisitor.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/FindTypeReferencesVisitor.cs deleted file mode 100644 index 6122a6e3c9..0000000000 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/FindTypeReferencesVisitor.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// FindTypeReferencesVisitor.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// 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 System; -using System.Linq; -using System.Collections.Generic; -using ICSharpCode.NRefactory.CSharp; -using Mono.TextEditor; -using ICSharpCode.NRefactory.CSharp.Resolver; - -namespace MonoDevelop.Refactoring.RefactorImports -{ - public class FindTypeReferencesVisitor : DepthFirstAstVisitor<object, object> - { - TextEditorData data; - ResolveVisitor resolver; - List<AstType> possibleTypeReferences = new List<AstType> (); - - public List<AstType> PossibleTypeReferences { - get { return this.possibleTypeReferences; } - } - - public FindTypeReferencesVisitor (TextEditorData data, ResolveVisitor resolver) - { - this.data = data; - this.resolver = resolver; - } - - public override object VisitIdentifierExpression (IdentifierExpression identifierExpression, object data) - { - possibleTypeReferences.Add (new SimpleType (identifierExpression.Identifier)); - - return base.VisitIdentifierExpression (identifierExpression, data); - } - - public override object VisitComposedType (ComposedType composedType, object data) - { - possibleTypeReferences.Add (composedType); - return null; - } - - public override object VisitMemberType (ICSharpCode.NRefactory.CSharp.MemberType memberType, object data) - { - possibleTypeReferences.Add (memberType); - return null; - } - - public override object VisitSimpleType (SimpleType simpleType, object data) - { - possibleTypeReferences.Add (simpleType); - return null; - } - - public override object VisitAttribute (ICSharpCode.NRefactory.CSharp.Attribute attribute, object data) - { - possibleTypeReferences.Add (attribute.Type); - var t = attribute.Type.Clone (); - if (t is SimpleType) { - ((SimpleType)t).IdentifierToken.Name += "Attribute"; - possibleTypeReferences.Add (t); - } else if (t is ICSharpCode.NRefactory.CSharp.MemberType) { - ((ICSharpCode.NRefactory.CSharp.MemberType)t).MemberNameToken.Name += "Attribute"; - possibleTypeReferences.Add (t); - } - return base.VisitAttribute (attribute, data); - } - - public override object VisitInvocationExpression (InvocationExpression invocationExpression, object data) - { - string invocation = ""; - if (!invocationExpression.StartLocation.IsEmpty && !invocationExpression.EndLocation.IsEmpty) { - invocation = this.data.Document.GetTextBetween (this.data.Document.LocationToOffset (invocationExpression.StartLocation.Line, invocationExpression.StartLocation.Column), - this.data.Document.LocationToOffset (invocationExpression.EndLocation.Line, invocationExpression.EndLocation.Column)); - } - base.VisitInvocationExpression (invocationExpression, data); - - var mrr = resolver.Resolve (invocationExpression) as MethodGroupResolveResult; - if (mrr != null && mrr.Methods.Count > 0 && mrr.Methods.First ().IsExtensionMethod) { - // todo convert ts -> ast type -// mrr.Methods.First ().DeclaringTypeDefinition -// possibleTypeReferences.Add (new SimpleType (originalMethod.DeclaringType.Name)); - } - return null; - } - } -} diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RefactorImportsHandler.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RefactorImportsHandler.cs deleted file mode 100644 index 24f7bfd70c..0000000000 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RefactorImportsHandler.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// ImportsHandler.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// 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 System; -using System.Collections.Generic; -using System.Text; -using System.CodeDom; -using System.Threading; - -using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Components.Commands; -using MonoDevelop.Projects; -using MonoDevelop.Projects.Text; -using MonoDevelop.Projects.Dom; -using MonoDevelop.Projects.Dom.Parser; -using MonoDevelop.Projects.Dom.Output; -using MonoDevelop.Ide.Gui.Content; -using MonoDevelop.Projects.CodeGeneration; -using MonoDevelop.Ide.Gui.Dialogs; -using MonoDevelop.Ide.FindInFiles; -using MonoDevelop.Refactoring; - -namespace MonoDevelop.Refactoring.RefactorImports -{ - public class RemoveUnusedImportsHandler: AbstractRefactoringCommandHandler - { - protected override void Run (RefactoringOptions options) - { - RemoveUnusedImportsRefactoring removeUnusedImportsRefactoring = new RemoveUnusedImportsRefactoring (); - if (removeUnusedImportsRefactoring.IsValid (options)) - removeUnusedImportsRefactoring.Run (options); - } - } - - public class SortImportsHandler: AbstractRefactoringCommandHandler - { - protected override void Run (RefactoringOptions options) - { - SortImportsRefactoring sortImportsRefactoring = new SortImportsRefactoring (); - if (sortImportsRefactoring.IsValid (options)) - sortImportsRefactoring.Run (options); - } - } - - public class RemoveSortImportsHandler: AbstractRefactoringCommandHandler - { - protected override void Run (RefactoringOptions options) - { - RemoveUnusedImportsRefactoring removeUnusedImportsRefactoring = new RemoveUnusedImportsRefactoring (); - SortImportsRefactoring sortImportsRefactoring = new SortImportsRefactoring (); - if (removeUnusedImportsRefactoring.IsValid (options) && sortImportsRefactoring.IsValid (options)) { - sortImportsRefactoring.Run (options); - removeUnusedImportsRefactoring.Run (options); - } - } - } -} diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RemoveUnusedImportsRefactoring.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RemoveUnusedImportsRefactoring.cs deleted file mode 100644 index 6a27ae05a6..0000000000 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/RemoveUnusedImportsRefactoring.cs +++ /dev/null @@ -1,88 +0,0 @@ -// -// RemoveUnusedUsingsRefactoring.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// 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 System; -using System.Collections.Generic; -using System.Linq; -using ICSharpCode.NRefactory.CSharp; - -namespace MonoDevelop.Refactoring.RefactorImports -{ - public class RemoveUnusedImportsRefactoring : RefactoringOperation - { - public RemoveUnusedImportsRefactoring () - { - Name = "Remove unused imports"; - } - - public override bool IsValid (RefactoringOptions options) - { - return true; - } - - public override List<Change> PerformChanges (RefactoringOptions options, object properties) - { - List<Change> result = new List<Change> (); - ICSharpCode.NRefactory.CSharp.CompilationUnit unit = options.GetASTProvider ().ParseFile (options.Document.Editor.Text); - FindTypeReferencesVisitor visitor = new FindTypeReferencesVisitor (options.GetTextEditorData (), options.GetResolver ()); - visitor.VisitCompilationUnit (unit, null); - - ITypeResolveContext dom = options.Dom; - - IParsedFile compilationUnit = options.ParseDocument ().CompilationUnit; - HashSet<string> usedUsings = new HashSet<string> (); - foreach (var r in visitor.PossibleTypeReferences) { - if (r is PrimitiveType) - continue; - IType type = dom.SearchType (compilationUnit, options.ResolveResult != null ? options.ResolveResult.CallingType : null, new TextLocation (options.Document.Editor.Caret.Line, options.Document.Editor.Caret.Column), r.ConvertToReturnType ()); - if (type != null) { - usedUsings.Add (type.Namespace); - } - } - - Mono.TextEditor.TextEditorData textEditorData = options.GetTextEditorData (); - HashSet<string> currentUsings = new HashSet<string> (); - foreach (IUsing u in compilationUnit.Usings) { - if (u.IsFromNamespace) - continue; - if (!u.Aliases.Any () && u.Namespaces.All (name => currentUsings.Contains (name) || !usedUsings.Contains (name)) ) { - TextReplaceChange change = new TextReplaceChange (); - change.FileName = options.Document.FileName; - change.Offset = textEditorData.Document.LocationToOffset (u.Region.BeginLine, u.Region.BeginColumn); - change.RemovedChars = textEditorData.Document.LocationToOffset (u.Region.EndLine, u.Region.EndColumn) - change.Offset; - Mono.TextEditor.LineSegment line = textEditorData.Document.GetLineByOffset (change.Offset); - if (line != null && line.EditableLength == change.RemovedChars) - change.RemovedChars += line.DelimiterLength; - result.Add (change); - } - foreach (string nspace in u.Namespaces) - currentUsings.Add (nspace); - } - - return result; - } - } -} diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/SortImportsRefactoring.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/SortImportsRefactoring.cs deleted file mode 100644 index ddb3f1cf62..0000000000 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.RefactorImports/SortImportsRefactoring.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -// SortImportsRefactoring.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (c) 2009 Novell, Inc (http://www.novell.com) -// -// 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 System; -using System.Collections.Generic; -using System.Linq; -using ICSharpCode.NRefactory.CSharp; -using System.Text; - -namespace MonoDevelop.Refactoring.RefactorImports -{ - public class SortImportsRefactoring : RefactoringOperation - { - public SortImportsRefactoring () - { - Name = "Sort imports"; - } - - public override bool IsValid (RefactoringOptions options) - { - return true; - } - - static int UsingComparer (IUsing left, IUsing right) - { - if (left.Aliases.Any () && right.Aliases.Any ()) - return left.Aliases.First ().Key.CompareTo (right.Aliases.First ().Key); - - if (left.Aliases.Any ()) - return 1; - if (right.Aliases.Any ()) - return -1; - bool leftIsSystem = left.Namespaces.First ().StartsWith ("System"); - bool rightIsSystem = right.Namespaces.First ().StartsWith ("System"); - if (leftIsSystem && !rightIsSystem) - return -1; - if (!leftIsSystem && rightIsSystem) - return 1; - return left.Namespaces.First ().CompareTo (right.Namespaces.First ()); - } - - public override List<Change> PerformChanges (RefactoringOptions options, object properties) - { - List<Change> result = new List<Change> (); - IParsedFile compilationUnit = options.ParseDocument ().CompilationUnit; - Mono.TextEditor.TextEditorData textEditorData = options.GetTextEditorData (); - int minOffset = int.MaxValue; - foreach (IUsing u in compilationUnit.Usings) { - if (u.IsFromNamespace) - continue; - int offset = textEditorData.Document.LocationToOffset (u.Region.BeginLine, u.Region.BeginColumn); - TextReplaceChange change = new TextReplaceChange () { - FileName = options.Document.FileName, - Offset = offset, - RemovedChars = textEditorData.Document.LocationToOffset (u.Region.EndLine, u.Region.EndColumn) - offset - }; - Mono.TextEditor.LineSegment line = textEditorData.Document.GetLineByOffset (change.Offset); - if (line != null && line.EditableLength == change.RemovedChars) - change.RemovedChars += line.DelimiterLength; - result.Add (change); - minOffset = Math.Min (minOffset, offset); - } - StringBuilder output = new StringBuilder (); - List<IUsing> usings = new List<IUsing> (compilationUnit.Usings); - usings.Sort (UsingComparer); - INRefactoryASTProvider astProvider = options.GetASTProvider (); - foreach (IUsing u in usings) { - AstNode declaration; - if (u.IsFromNamespace) - continue; - if (u.Aliases.Any ()) { - KeyValuePair<string, IReturnType> alias = u.Aliases.First (); - declaration = new UsingAliasDeclaration (alias.Key, alias.Value.ConvertToTypeReference ()); - } else { - declaration = new UsingDeclaration (u.Namespaces.First ()); - } - output.Append (astProvider.OutputNode (options.Dom, declaration)); - } - TextReplaceChange insertSortedUsings = new TextReplaceChange () { - FileName = options.Document.FileName, - Offset = minOffset, - InsertedText = output.ToString () - }; - result.Add (insertSortedUsings); - return result; - } - } -} diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml index 5538d18c95..12d0810b5a 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml @@ -124,20 +124,6 @@ _label = "S_how Code Generation Window" shortcut = "Alt|Insert" /> - <Command id = "MonoDevelop.Refactoring.RefactoryCommands.RemoveUnusedImports" - defaultHandler = "MonoDevelop.Refactoring.RefactorImports.RemoveUnusedImportsHandler" - icon = "md-remove-namespace" - _label = "_Remove unused usings"/> - - <Command id = "MonoDevelop.Refactoring.RefactoryCommands.SortImports" - defaultHandler = "MonoDevelop.Refactoring.RefactorImports.SortImportsHandler" - icon = "md-sort-namespace" - _label = "_Sort usings"/> - - <Command id = "MonoDevelop.Refactoring.RefactoryCommands.RemoveSortImports" - defaultHandler = "MonoDevelop.Refactoring.RefactorImports.RemoveSortImportsHandler" - _label = "R_emove and Sort usings"/> - <Command id = "MonoDevelop.Refactoring.RefactoryCommands.IntroduceConstant" defaultHandler = "MonoDevelop.Refactoring.CreateMethod.IntroduceConstantHandler" _label = "_Introduce Constant..."/> diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj index 8bb9b4cd7b..7a2dfe6b8d 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj @@ -119,6 +119,7 @@ <Compile Include="MonoDevelop.Refactoring.IntegrateTemporaryVariable\IntegrateTemporaryVariableRefactoring.cs" /> <Compile Include="MonoDevelop.Refactoring.IntegrateTemporaryVariable\IntegrateTemporaryVariableHandler.cs" /> <Compile Include="MonoDevelop.Refactoring\ImportSymbolHandler.cs" /> + <Compile Include="MonoDevelop.Refactoring\HelperMethods.cs" /> </ItemGroup> <ItemGroup> <Folder Include="MonoDevelop.Refactoring\" /> @@ -201,7 +202,6 @@ <None Include="MonoDevelop.Refactoring.IntroduceConstant\IntroduceConstantDialog.cs" /> <None Include="MonoDevelop.Refactoring.CreateClass\CreateClassCodeGenerator.cs" /> <None Include="MonoDevelop.Refactoring.CreateClass\CreateStructCodeGenerator.cs" /> - <None Include="MonoDevelop.Refactoring\HelperMethods.cs" /> <None Include="MonoDevelop.Refactoring.IntroduceConstant\IntroduceConstantHandler.cs" /> <None Include="MonoDevelop.Refactoring\QuickFixHandler.cs" /> <None Include="MonoDevelop.Refactoring\EncapsulateFieldDialog.cs" /> @@ -209,9 +209,5 @@ <None Include="gtk-gui\MonoDevelop.Refactoring.IntroduceConstant.IntroduceConstantDialog.cs" /> <None Include="gtk-gui\MonoDevelop.Refactoring.OverridesImplementsDialog.cs" /> <None Include="gtk-gui\MonoDevelop.Refactoring.EncapsulateFieldDialog.cs" /> - <None Include="MonoDevelop.Refactoring.RefactorImports\RemoveUnusedImportsRefactoring.cs" /> - <None Include="MonoDevelop.Refactoring.RefactorImports\RefactorImportsHandler.cs" /> - <None Include="MonoDevelop.Refactoring.RefactorImports\FindTypeReferencesVisitor.cs" /> - <None Include="MonoDevelop.Refactoring.RefactorImports\SortImportsRefactoring.cs" /> </ItemGroup> </Project> diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/HelperMethods.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/HelperMethods.cs index 5922713d73..2198a5c6d4 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/HelperMethods.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/HelperMethods.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; using ICSharpCode.NRefactory.CSharp; -using MonoDevelop.Projects.Dom; using Mono.TextEditor; using System.Linq; @@ -35,7 +34,7 @@ namespace MonoDevelop.Refactoring { public static class HelperMethods { - static Dictionary<string, string> TypeTable = new Dictionary<string, string> (); + /*static Dictionary<string, string> TypeTable = new Dictionary<string, string> (); static HelperMethods () { TypeTable[DomReturnType.Void.FullName] = "void"; @@ -92,21 +91,7 @@ namespace MonoDevelop.Refactoring } } - /* - List<TypeReference> genericTypes = new List<TypeReference> (); - foreach (MonoDevelop.Projects.Dom.IReturnType genericType in returnType.GenericArguments) { - genericTypes.Add (ConvertToTypeReference (genericType)); - } - TypeReference result = new AstType (returnType.FullName, genericTypes); - result.IsKeyword = true; - result.PointerNestingLevel = returnType.PointerNestingLevel; - if (returnType.ArrayDimensions > 0) { - int[] rankSpecfier = new int[returnType.ArrayDimensions]; - for (int i = 0; i < returnType.ArrayDimensions; i++) { - rankSpecfier[i] = returnType.GetDimension (i); - } - result.RankSpecifier = rankSpecfier; - }*/ + return result; } @@ -156,5 +141,6 @@ namespace MonoDevelop.Refactoring return result; } + */ } } diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOperation.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOperation.cs index 7efeddf698..f23c3a2189 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOperation.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOperation.cs @@ -56,7 +56,7 @@ namespace MonoDevelop.Refactoring public virtual bool IsValid (RefactoringOptions options) { - return false; + return true; } public virtual List<Change> PerformChanges (RefactoringOptions options, object properties) |