[mono/monodevelop] d3ebaa22: [Refactoring] Tweaked refactoring menu in case of user defined

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141bfc2c4cf-1c887d88-76fe-4f58-bd96-cb27bbda80f8-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/6d51a2ce560f...d3ebaa22e421

   Commit: d3ebaa22e42107b3369cb14f1e293529ec015b20
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-16 05:33:37 GMT
      URL: https://github.com/mono/monodevelop/commit/d3ebaa22e42107b3369cb14f1e293529ec015b20

[Refactoring] Tweaked refactoring menu in case of user defined
operators.

Changed paths:
  M main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
  M main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs

Modified: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
===================================================================
@@ -70,8 +70,11 @@ public override bool IsValid (RefactoringOptions options)
 			if (options.SelectedItem is IType && ((IType)options.SelectedItem).Kind == TypeKind.TypeParameter)
 				return !string.IsNullOrEmpty (((ITypeParameter)options.SelectedItem).Region.FileName);
 
-			if (options.SelectedItem is IMember) {
-				var cls = ((IMember)options.SelectedItem).DeclaringTypeDefinition;
+			var member = options.SelectedItem as IMember;
+			if (member != null) {
+				if (member.SymbolKind == SymbolKind.Operator)
+					return false;
+				var cls = member.DeclaringTypeDefinition;
 				return cls != null;
 			}
 			return false;

Modified: main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs
===================================================================
@@ -336,7 +336,8 @@ protected override void Update (CommandArrayInfo ainfo)
 				}
 			}
 
-			if (item is IEntity || item is ITypeParameter || item is IVariable || item is INamespace) {
+			if (!(item is IMethod && ((IMethod)item).SymbolKind == SymbolKind.Operator) && (item is IEntity || item is ITypeParameter || item is IVariable || item is INamespace)) {
+
 				ainfo.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.FindReferences), new System.Action (new FindRefs (item, false).Run));
 				if (doc.HasProject && HasOverloads (doc.Project.ParentSolution, item))
 					ainfo.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.FindAllReferences), new System.Action (new FindRefs (item, true).Run));
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.