[mapguide-commits] r5826 - in trunk/Tools/Maestro/Maestro.Base: Commands Services

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri May 20 10:02:25 EDT 2011


Author: jng
Date: 2011-05-20 07:02:25 -0700 (Fri, 20 May 2011)
New Revision: 5826

Modified:
   trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
Log:
#1697: Fix small defect where items are incorrectly highlighted after an existing resource has been saved as another resource id


Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs	2011-05-20 13:50:13 UTC (rev 5825)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SaveResourceAsCommand.cs	2011-05-20 14:02:25 UTC (rev 5826)
@@ -57,7 +57,10 @@
 
                         using (new WaitCursor(wb))
                         {
+                            var oldId = ed.EditorService.ResourceID;
                             ed.EditorService.SaveAs(picker.ResourceID);
+                            if (oldId != ed.EditorService.ResourceID)
+                                omgr.RenameResourceId(oldId, ed.EditorService.ResourceID, exp);
 
                             try
                             {

Modified: trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs	2011-05-20 13:50:13 UTC (rev 5825)
+++ trunk/Tools/Maestro/Maestro.Base/Services/OpenResourceManager.cs	2011-05-20 14:02:25 UTC (rev 5826)
@@ -97,6 +97,27 @@
             return GetRegisteredEditor(rtd);
         }
 
+        internal void RenameResourceId(string oldId, string newId, ISiteExplorer siteExp)
+        {
+            Check.NotEmpty(oldId, "oldId");
+            Check.NotEmpty(newId, "newId");
+            Check.NotNull(siteExp, "siteExp");
+
+            if (oldId.Equals(newId))
+                return;
+
+            //Original must exist and new id must not
+            if (_openItems.ContainsKey(oldId) && !_openItems.ContainsKey(newId))
+            {
+                var ed = _openItems[oldId];
+                _openItems.Remove(oldId);
+                _openItems[newId] = ed;
+
+                siteExp.FlagNode(oldId, NodeFlagAction.None);
+                siteExp.FlagNode(newId, NodeFlagAction.HighlightOpen);
+            }
+        }
+
         /// <summary>
         /// Opens the specified resource using its assigned editor. If the resource is already
         /// open, the the existing editor view is activated instead. If the resource has no assigned



More information about the mapguide-commits mailing list