[mapguide-commits] r5628 -
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Mar 16 06:26:13 EDT 2011
Author: jng
Date: 2011-03-16 03:26:13 -0700 (Wed, 16 Mar 2011)
New Revision: 5628
Modified:
trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
Log:
Fix #1628: Clean up the delete confirmation logic to take children of to-be-deleted folders into account as well
Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2011-03-15 13:18:04 UTC (rev 5627)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/DeleteSelectedItemsCommand.cs 2011-03-16 10:26:13 UTC (rev 5628)
@@ -52,10 +52,26 @@
foreach (var i in items)
{
omgr.CloseEditors(i.ResourceId, true);
+
+ foreach (var ed in omgr.OpenEditors)
+ {
+ if (i.IsFolder && ed.EditorService.ResourceID.StartsWith(i.ResourceId))
+ {
+ ed.Close(true);
+ }
+ }
}
DoDelete(wb, resSvc, items);
}
+ else
+ {
+ return;
+ }
}
+ else
+ {
+ return;
+ }
//Refresh the parent. Multi-select is only allowed from same parent
//so we should get the same result
@@ -80,7 +96,8 @@
bool isDeletingOpenResource = false;
foreach (var ed in editors)
{
- if (resIds.ContainsKey(ed.EditorService.ResourceID))
+ string resId = ed.EditorService.ResourceID;
+ if (resIds.ContainsKey(resId) || IsChild(resIds, resId))
{
isDeletingOpenResource = true;
break;
@@ -93,6 +110,16 @@
return true;
}
+ private static bool IsChild(Dictionary<string, string> resIds, string resId)
+ {
+ foreach (var r in resIds.Keys)
+ {
+ if (ResourceIdentifier.IsFolderResource(r) && resId.StartsWith(r))
+ return true;
+ }
+ return false;
+ }
+
private void DoDelete(Workbench wb, OSGeo.MapGuide.MaestroAPI.Services.IResourceService resSvc, RepositoryItem[] items)
{
var pdlg = new ProgressDialog();
More information about the mapguide-commits
mailing list