[mapguide-commits] r5207 - in sandbox/maestro-3.0/Maestro.Base:
Commands/SiteExplorer UI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Sep 29 01:53:44 EDT 2010
Author: jng
Date: 2010-09-29 05:53:44 +0000 (Wed, 29 Sep 2010)
New Revision: 5207
Modified:
sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs
sandbox/maestro-3.0/Maestro.Base/UI/RepositoryTreeModel.cs
Log:
Wrap rename operation in progress dialog and fix model refresh exception when path to refresh is the root
Modified: sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs 2010-09-29 01:17:12 UTC (rev 5206)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SiteExplorer/RenameCommand.cs 2010-09-29 05:53:44 UTC (rev 5207)
@@ -23,6 +23,8 @@
using ICSharpCode.Core;
using Maestro.Base.Services;
using Maestro.Base.UI;
+using Maestro.Shared.UI;
+using OSGeo.MapGuide.MaestroAPI;
namespace Maestro.Base.Commands.SiteExplorer
{
@@ -63,25 +65,39 @@
newid = parent.ResourceId + dlg.NewName + "." + current.ResourceType;
}
- //Perform the operation
- if (current.IsFolder)
+ var prog = new ProgressDialog();
+ prog.RunOperationAsync(wb, (worker, e, args) =>
{
- if (dlg.UpdateReferences)
- conn.ResourceService.MoveFolderWithReferences(oldid, newid, null, null);
+ LengthyOperationProgressCallBack cb = (s, cbArgs) =>
+ {
+ worker.ReportProgress(cbArgs.Progress, cbArgs.StatusMessage);
+ };
+
+ //Perform the operation
+ if (current.IsFolder)
+ {
+ if (dlg.UpdateReferences)
+ conn.ResourceService.MoveFolderWithReferences(oldid, newid, null, cb);
+ else
+ conn.ResourceService.MoveFolder(oldid, newid, dlg.Overwrite);
+ }
else
- conn.ResourceService.MoveFolder(oldid, newid, dlg.Overwrite);
- }
- else
- {
- if (dlg.UpdateReferences)
- conn.ResourceService.MoveResourceWithReferences(oldid, newid, null, null);
- else
- conn.ResourceService.MoveResource(oldid, newid, dlg.Overwrite);
- }
+ {
+ if (dlg.UpdateReferences)
+ {
+ conn.ResourceService.MoveResourceWithReferences(oldid, newid, null, cb);
+ }
+ else
+ conn.ResourceService.MoveResource(oldid, newid, dlg.Overwrite);
+ }
+
+ current.Name = dlg.NewName;
+ if (dlg.Overwrite)
+ parent.RemoveChild(parent[dlg.NewName]);
+
+ return true;
+ });
- current.Name = dlg.NewName;
- if (dlg.Overwrite)
- parent.RemoveChild(parent[dlg.NewName]);
//Need to refresh the model because it still is called by the old name
var rid = new OSGeo.MapGuide.MaestroAPI.Resource.ResourceIdentifier(oldid);
Modified: sandbox/maestro-3.0/Maestro.Base/UI/RepositoryTreeModel.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/RepositoryTreeModel.cs 2010-09-29 01:17:12 UTC (rev 5206)
+++ sandbox/maestro-3.0/Maestro.Base/UI/RepositoryTreeModel.cs 2010-09-29 05:53:44 UTC (rev 5207)
@@ -437,6 +437,9 @@
internal TreePath GetPathFromResourceId(string resId)
{
+ if ("Library://".Equals(resId))
+ return GetPath(_rootNode);
+
string[] components = ResourceIdentifier.GetPath(resId).Split('/');
if (!ResourceIdentifier.IsFolderResource(resId))
{
More information about the mapguide-commits
mailing list