Author: mkrueger
Date: 2007-09-12 06:21:35 -0400 (Wed, 12 Sep 2007)
New Revision: 85673

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs
Log:
* MonoDevelop.Ide.Commands/RefactoryCommands.cs: Implemented 82241:
  Can't navigate to the base method.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-09-12 
10:03:44 UTC (rev 85672)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-09-12 
10:21:35 UTC (rev 85673)
@@ -1,3 +1,8 @@
+2007-09-12  Mike Krüger <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Ide.Commands/RefactoryCommands.cs: Implemented 82241: 
Can't
+         navigate to the base method.
+
 2007-09-10  Michael Hutchinson <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Ide.Templates/FileTemplate.cs: Add additional check to

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs
    2007-09-12 10:03:44 UTC (rev 85672)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs
    2007-09-12 10:21:35 UTC (rev 85673)
@@ -288,10 +288,13 @@
                        } else if (item is IMethod) {
                                IMethod method = item as IMethod;
                                
-                               if (method.IsConstructor)
+                               if (method.IsConstructor) {
                                        txt = GettextCatalog.GetString 
("Constructor <b>{0}</b>", EscapeName (method.DeclaringType.Name));
-                               else
+                               } else {
                                        txt = GettextCatalog.GetString ("Method 
<b>{0}</b>", itemName);
+                                       if (method.IsOverride) 
+                                               ciset.CommandInfos.Add 
(GettextCatalog.GetString ("Go to _base"), new RefactoryOperation 
(refactorer.GoToBase));
+                               }
                        } else if (item is IIndexer) {
                                txt = GettextCatalog.GetString ("Indexer 
<b>{0}</b>", itemName);
                        } else if (item is IParameter) {
@@ -385,10 +388,8 @@
                
                public void GoToBase ()
                {
-                       IClass cls = (IClass) item;
-                       if (cls == null) return;
-                       
-                       if (cls.BaseTypes != null) {
+                       IClass cls = item as IClass;
+                       if (cls != null && cls.BaseTypes != null) {
                                foreach (IReturnType bc in cls.BaseTypes) {
                                        IClass bcls = ctx.GetClass 
(bc.FullyQualifiedName, true, true);
                                        if (bcls != null && bcls.ClassType != 
ClassType.Interface && bcls.Region != null) {
@@ -396,7 +397,27 @@
                                                return;
                                        }
                                }
+                               return;
                        }
+                       IMethod method = item as IMethod;
+                       if (method != null) {
+                               foreach (IReturnType bc in 
method.DeclaringType.BaseTypes) {
+                                       IClass bcls = ctx.GetClass 
(bc.FullyQualifiedName, true, true);
+                                       if (bcls != null && bcls.ClassType != 
ClassType.Interface && bcls.Region != null) {
+                                               IMethod baseMethod = null;
+                                               foreach (IMethod m in 
bcls.Methods) {
+                                                       if (m.Name == 
method.Name && m.Parameters.Count == m.Parameters.Count) {
+                                                               baseMethod = m;
+                                                               break;
+                                                       }
+                                               }
+                                               if (baseMethod != null)
+                                                       
IdeApp.Workbench.OpenDocument (bcls.Region.FileName, 
baseMethod.Region.BeginLine, baseMethod.Region.BeginColumn, true);
+                                               return;
+                                       }
+                               }
+                               return;
+                       }
                }
                
                public void FindDerivedClasses ()

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

Reply via email to