[MonoDevelop] [PATCH] Fix Improper MemberNodeCommandHandling in ClassPad

Balaji Rao balajirrao at gmail.com
Wed May 23 05:05:50 EDT 2007


When a member in a ClassPad was clicked, the correct source file was
not being opened. This patch fixes it by including filename
information in all Region objects.

This is my first patch. So please point out any mistakes and omissions.

--- monodevelop-0.13.1/Extras/CSharpBinding/Parser/Parser.cs	2007-03-08
04:32:26.000000000 +0530
+++ monodevelop-0.13.1.patch/Extras/CSharpBinding/Parser/Parser.cs	2007-05-23
13:53:40.000000000 +0530
@@ -95,8 +95,17 @@
 			// FIXME: track api changes
 			//visitor.Cu.ErrorInformation = p.Errors.ErrorInformation;
 			RetrieveRegions (visitor.Cu, p.Lexer.SpecialTracker);
-			foreach (IClass c in visitor.Cu.Classes)
+			foreach (IClass c in visitor.Cu.Classes) {
 				c.Region.FileName = fileName;
+				foreach (IField f in c.Fields)
+					f.Region.FileName = fileName;
+				foreach (IMethod m in c.Methods)
+					m.Region.FileName = fileName;
+				foreach (IProperty pr in c.Properties)
+					pr.Region.FileName = fileName;
+				foreach (IEvent ev in c.Events)
+					ev.Region.FileName = fileName;				
+			}
 			AddCommentTags (visitor.Cu, p.Lexer.TagComments);
             return visitor.Cu;
       	}


--- md/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs	2007-03-08
04:31:51.000000000 +0530
+++ monodevelop-0.13.1.patch/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs	2007-05-23
13:52:22.000000000 +0530
@@ -39,21 +39,10 @@
 	{
 		public override void ActivateItem ()
 		{
-			string file = GetFileName ();
 			IMember member = CurrentNode.DataItem as IMember;
+			string file = member.Region.FileName;
 			int line = member.Region.BeginLine;
 			IdeApp.Workbench.OpenDocument (file, Math.Max (1, line), 1, true);
 		}
-		
-		string GetFileName ()
-		{
-			IMember member = (IMember) CurrentNode.GetParentDataItem
(typeof(IMember), true);
-			if (member != null && member.Region.FileName != null) return
member.Region.FileName;
-			
-			ClassData cls = (ClassData) CurrentNode.GetParentDataItem
(typeof(ClassData), true);
-			if (cls != null && cls.Class.Region.FileName != null) return
cls.Class.Region.FileName;
-			
-			return null;
-		}
 	}
 }

--- md/Core/src/MonoDevelop.Ide/ChangeLog	2007-03-08 04:31:53.000000000 +0530
+++ monodevelop-0.13.1.patch/Core/src/MonoDevelop.Ide/ChangeLog	2007-05-23
14:08:51.000000000 +0530
@@ -1,3 +1,7 @@
+2007-05-23  Balaji Rao R <balajirrao at gmail.com>
+	* MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs : Made
+	to obtain FileName information directly from the respective regions.
+
 2007-02-24  Lluis Sanchez Gual <lluis at novell.com>

 	* MonoDevelop.Ide.addin.xml: Fix compatible version number.


--- monodevelop-0.13.1/Extras/CSharpBinding/ChangeLog	2007-03-08
04:32:26.000000000 +0530
+++ monodevelop-0.13.1.patch/Extras/CSharpBinding/ChangeLog	2007-05-23
14:04:10.000000000 +0530
@@ -1,3 +1,7 @@
+2007-05-23 Balaji Rao R <balajirrao at gmail.com>
+	* Parser/Parser.cs : Include FileName information in all regions
+	belonging to a class.
+
 2007-02-16  Lluis Sanchez Gual <lluis at novell.com>

 	* Gui/CSharpTextEditorExtension.cs: Don't show completion windo for


-- 
warm regards

Balaji Rao


More information about the Monodevelop-list mailing list