[mapguide-commits] r5698 - in trunk/Tools/Maestro:
Maestro.Base/Commands/SiteExplorer Maestro.Base/Editor
Maestro.Editors/Generic
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Apr 12 08:22:01 EDT 2011
Author: jng
Date: 2011-04-12 05:22:01 -0700 (Tue, 12 Apr 2011)
New Revision: 5698
Modified:
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs
trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
Log:
#1661: Instead of doing auto find/replace, open the resource in an XML editor and then do the find/replace, triggering dirty state and allowing the user to review the modifications before saving. This is in line with previous behaviour in Maestro 2.x
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs 2011-04-12 12:02:22 UTC (rev 5697)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/FindReplaceXmlContentCommand.cs 2011-04-12 12:22:01 UTC (rev 5698)
@@ -61,23 +61,15 @@
continue;
}
}
-
- //Do the find/replace
- using (var s = conn.ResourceService.GetResourceXmlData(item.ResourceId))
- {
- using (var sr = new StreamReader(s))
- {
- string xml = sr.ReadToEnd();
- xml = xml.Replace(diag.FindToken, diag.ReplaceToken);
- using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(xml)))
- {
- conn.ResourceService.SetResourceXmlData(item.ResourceId, ms);
- }
- //Re-open in XML editor for user review
- omgr.Open(item.ResourceId, conn, true, wb.ActiveSiteExplorer);
- replaced++;
- }
- }
+
+ //Re-open in XML editor for user review
+ var ed = (XmlEditor)omgr.Open(item.ResourceId, conn, true, wb.ActiveSiteExplorer);
+
+ //Do the find/replace. Dirty state would be triggered if any replacements were made
+ //It is then up to the user to review the change and decide whether to save or not
+ ed.FindAndReplace(diag.FindToken, diag.ReplaceToken);
+
+ replaced++;
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2011-04-12 12:02:22 UTC (rev 5697)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2011-04-12 12:22:01 UTC (rev 5698)
@@ -216,5 +216,10 @@
_edSvc.ResourceService.SetResourceXmlData(_edSvc.EditedResourceID, new MemoryStream(Encoding.UTF8.GetBytes(this.XmlContent)));
//base.SyncSessionCopy();
}
+
+ internal void FindAndReplace(string find, string replace)
+ {
+ editor.FindAndReplace(find, replace);
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs 2011-04-12 12:02:22 UTC (rev 5697)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs 2011-04-12 12:22:01 UTC (rev 5698)
@@ -151,7 +151,7 @@
FindAndReplace(txtFind.Text, txtReplace.Text);
}
- private void FindAndReplace(string szFind, string szReplace)
+ public void FindAndReplace(string szFind, string szReplace)
{
var textEditor = txtXmlContent;
More information about the mapguide-commits
mailing list