[Monodevelop-patches-list] r2589 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Internal/Project/Combine Internal/Project/Project
Jacob Ilsø Christensen <jacobilsoe@gmail.com>
jacobilsoe at mono-cvs.ximian.com
Tue Jun 7 15:51:17 EDT 2005
Author: jacobilsoe
Date: 2005-06-07 15:51:17 -0400 (Tue, 07 Jun 2005)
New Revision: 2589
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
Log:
Update references when a project is renamed
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-06-05 11:26:17 UTC (rev 2588)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-06-07 19:51:17 UTC (rev 2589)
@@ -1,3 +1,9 @@
+2005-06-07 Jacob Ilsø Christensen <jacobilsoe at gmail.com>
+
+ * Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs:
+ * Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs:
+ When a project is renamed make sure that references to it are updated.
+
2005-06-04 John Luke <john.luke at gmail.com>
* MonoDevelopCore.addin.xml: remove workaround
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-06-05 11:26:17 UTC (rev 2588)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-06-07 19:51:17 UTC (rev 2589)
@@ -186,6 +186,22 @@
protected virtual void OnNameChanged (CombineEntryRenamedEventArgs e)
{
+ Combine topMostParentCombine = this.parentCombine;
+
+ if (topMostParentCombine != null) {
+ while (topMostParentCombine.ParentCombine != null) {
+ topMostParentCombine = topMostParentCombine.ParentCombine;
+ }
+
+ foreach (Project project in topMostParentCombine.GetAllProjects()) {
+ if (project == this) {
+ continue;
+ }
+
+ project.RenameReferences(e.OldName, e.NewName);
+ }
+ }
+
if (NameChanged != null) {
NameChanged (this, e);
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-06-05 11:26:17 UTC (rev 2588)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-06-07 19:51:17 UTC (rev 2589)
@@ -243,6 +243,26 @@
}
}
+ internal void RenameReferences(string oldName, string newName)
+ {
+ ArrayList toBeRemoved = new ArrayList();
+
+ foreach (ProjectReference refInfo in this.ProjectReferences) {
+ if (refInfo.ReferenceType == ReferenceType.Project) {
+ if (refInfo.Reference == oldName) {
+ toBeRemoved.Add(refInfo);
+ }
+ }
+ }
+
+ foreach (ProjectReference pr in toBeRemoved) {
+ this.ProjectReferences.Remove(pr);
+ ProjectReference prNew = (ProjectReference)pr.Clone();
+ prNew.Reference = newName;
+ this.ProjectReferences.Add(prNew);
+ }
+ }
+
public void CopyReferencesToOutputPath (bool force)
{
AbstractProjectConfiguration config = ActiveConfiguration as AbstractProjectConfiguration;
More information about the Monodevelop-patches-list
mailing list