[mapguide-commits] r7521 - in trunk/Tools/Maestro: Maestro.Base Maestro.Base/Commands/SiteExplorer Maestro.Base/UI Maestro.Editors Maestro.Editors/Common OSGeo.MapGuide.MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon May 27 04:33:23 PDT 2013


Author: jng
Date: 2013-05-27 04:33:22 -0700 (Mon, 27 May 2013)
New Revision: 7521

Added:
   trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.cs
   trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.resx
Removed:
   trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.Designer.cs
   trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.cs
   trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.resx
Modified:
   trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
   trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
   trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
Log:
#2278: Re-pointer enhancements
 - Move RepointerDialog into Maestro.Editors
 - MaestroAPI: Add a new ReplaceResourceIds method in Utility. This is the backbone of our repointer functionality and allows us to support all resource types that have downstream dependencies.
 - Refactor the RepointCommand to use the new generic resource id replacement logic.

Modified: trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Base/Commands/SiteExplorer/RepointCommand.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -30,6 +30,11 @@
 using OSGeo.MapGuide.MaestroAPI;
 using OSGeo.MapGuide.ObjectModels.WebLayout;
 using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+using Maestro.Editors.Common;
+using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using OSGeo.MapGuide.ObjectModels.WatermarkDefinition;
+using System.Xml;
+using System.IO;
 
 namespace Maestro.Base.Commands.SiteExplorer
 {
@@ -51,14 +56,12 @@
             {
                 var selected = exp.SelectedItems[0];
                 var resId = new ResourceIdentifier(selected.ResourceId);
-                if (resId.ResourceType == OSGeo.MapGuide.MaestroAPI.ResourceTypes.LayerDefinition)
+                if (resId.ResourceType != ResourceTypes.WebLayout &&
+                    resId.ResourceType != ResourceTypes.ApplicationDefinition &&
+                    resId.ResourceType != ResourceTypes.LoadProcedure)
                 {
-                    DoRepointLayer(wb, conn, resId);
+                    DoRepointResource(wb, conn, resId);
                 }
-                else if (resId.ResourceType == OSGeo.MapGuide.MaestroAPI.ResourceTypes.MapDefinition)
-                {
-                    DoRepointMap(wb, conn, resId);
-                }
                 else
                 {
                     MessageService.ShowMessage(Strings.ResourceNotRepointable);
@@ -71,13 +74,13 @@
             return conn.Capabilities.SupportsResourceReferences;
         }
 
-        private void DoRepointMap(Workbench wb, OSGeo.MapGuide.MaestroAPI.IServerConnection conn, ResourceIdentifier resId)
+        private static void DoRepointResource(Workbench wb, IServerConnection conn, ResourceIdentifier resId)
         {
             var diag = new RepointerDialog(resId, conn.ResourceService);
             if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                string srcMap = diag.Source;
-                string dstMap = diag.Target;
+                string srcId = diag.Source;
+                string dstId = diag.Target;
 
                 var deps = diag.Dependents;
 
@@ -88,125 +91,30 @@
                     wk.ReportProgress(0, Strings.ProgressUpdatingReferences);
                     foreach (var dep in deps)
                     {
-                        //Only web and flexible layouts depend on maps
-                        var rt = ResourceIdentifier.GetResourceType(dep);
-                        Debug.Assert(rt == ResourceTypes.WebLayout || rt == ResourceTypes.ApplicationDefinition);
-
-                        bool changed = false;
-
-                        IResource res = null;
-                        if (rt == ResourceTypes.WebLayout)
+                        using (var stream = conn.ResourceService.GetResourceXmlData(dep))
                         {
-                            IWebLayout wl = (IWebLayout)conn.ResourceService.GetResource(dep);
-                            if (wl.Map.ResourceId.Equals(srcMap))
+                            XmlDocument doc = new XmlDocument();
+                            doc.Load(stream);
+                            bool changed = Utility.ReplaceResourceIds(doc, srcId, dstId);
+                            if (changed)
                             {
-                                wl.Map.ResourceId = dstMap;
-                                changed = true;
-                                res = wl;
-                            }
-                        }
-                        else //Flexible layout
-                        {
-                            IApplicationDefinition appDef = (IApplicationDefinition)conn.ResourceService.GetResource(dep);
-                            foreach (var mg in appDef.MapSet.MapGroups)
-                            {
-                                foreach (var map in mg.Map)
+                                using (var ms = new MemoryStream())
                                 {
-                                    if (map.Type.Equals("MapGuide")) //NOXLATE
-                                    {
-                                        string mdfId = map.GetMapDefinition();
-                                        if (mdfId.Equals(srcMap))
-                                        {
-                                            map.SetMapDefinition(dstMap);
-                                            changed = true;
-                                            res = appDef;
-                                        }
-                                    }
+                                    doc.Save(ms);
+                                    ms.Position = 0L; //Rewind
+                                    conn.ResourceService.SetResourceXmlData(dep, ms);
                                 }
+                                updated++;
+                                wk.ReportProgress((updated / total) * 100);
                             }
                         }
-
-                        //If it wasn't changed why did the resource service
-                        //list this map as a dependent resource?
-                        if (changed)
-                        {
-                            Debug.Assert(res != null);
-                            conn.ResourceService.SaveResource(res);
-                            updated++;
-
-                            wk.ReportProgress((updated / total) * 100);
-                        }
                     }
                     return updated;
                 };
                 var prd = new ProgressDialog();
                 int result = (int)prd.RunOperationAsync(wb, worker);
-                MessageService.ShowMessage(string.Format(Strings.ResourcesRepointed, result, dstMap));
+                MessageService.ShowMessage(string.Format(Strings.ResourcesRepointed, result, dstId));
             }
         }
-
-        private static void DoRepointLayer(Workbench wb, OSGeo.MapGuide.MaestroAPI.IServerConnection conn, ResourceIdentifier resId)
-        {
-            var diag = new RepointerDialog(resId, conn.ResourceService);
-            if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
-                string srcLayer = diag.Source;
-                string targetLayer = diag.Target;
-
-                var deps = diag.Dependents;
-
-                ProgressDialog.DoBackgroundWork worker = (wk, e, args) =>
-                {
-                    int updated = 0;
-                    int total = deps.Count;
-                    wk.ReportProgress(0, Strings.ProgressUpdatingReferences);
-                    foreach (var dep in deps)
-                    {
-                        //Only maps depend on layers
-                        Debug.Assert(ResourceIdentifier.GetResourceType(dep) == OSGeo.MapGuide.MaestroAPI.ResourceTypes.MapDefinition);
-
-                        IMapDefinition mdf = (IMapDefinition)conn.ResourceService.GetResource(dep);
-                        bool changed = false;
-                        //Find all references to source and replace with target
-                        foreach (var layer in mdf.MapLayer)
-                        {
-                            if (layer.ResourceId.Equals(srcLayer))
-                            {
-                                layer.ResourceId = targetLayer;
-                                changed = true;
-                            }
-                        }
-                        if (mdf.BaseMap != null)
-                        {
-                            foreach (var group in mdf.BaseMap.BaseMapLayerGroup)
-                            {
-                                foreach (var layer in group.BaseMapLayer)
-                                {
-                                    if (layer.ResourceId.Equals(srcLayer))
-                                    {
-                                        layer.ResourceId = targetLayer;
-                                        changed = true;
-                                    }
-                                }
-                            }
-                        }
-
-                        //If it wasn't changed why did the resource service
-                        //list this map as a dependent resource?
-                        if (changed)
-                        {
-                            conn.ResourceService.SaveResource(mdf);
-                            updated++;
-
-                            wk.ReportProgress((updated / total) * 100);
-                        }
-                    }
-                    return updated;
-                };
-                var prd = new ProgressDialog();
-                int result = (int)prd.RunOperationAsync(wb, worker);
-                MessageService.ShowMessage(string.Format(Strings.ResourcesRepointed, result, targetLayer));
-            }
-        }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Base/Maestro.Base.csproj	2013-05-27 11:33:22 UTC (rev 7521)
@@ -392,12 +392,6 @@
     <Compile Include="UI\RenameItemDialog.Designer.cs">
       <DependentUpon>RenameItemDialog.cs</DependentUpon>
     </Compile>
-    <Compile Include="UI\RepointerDialog.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="UI\RepointerDialog.Designer.cs">
-      <DependentUpon>RepointerDialog.cs</DependentUpon>
-    </Compile>
     <Compile Include="UI\RepositoryTreeModel.cs" />
     <Compile Include="UI\ResourceDependencyListDialog.cs">
       <SubType>Form</SubType>
@@ -635,9 +629,6 @@
     <EmbeddedResource Include="UI\RenameItemDialog.resx">
       <DependentUpon>RenameItemDialog.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="UI\RepointerDialog.resx">
-      <DependentUpon>RepointerDialog.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="UI\ResourceDependencyListDialog.resx">
       <DependentUpon>ResourceDependencyListDialog.cs</DependentUpon>
     </EmbeddedResource>

Deleted: trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.Designer.cs	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.Designer.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -1,150 +0,0 @@
-namespace Maestro.Base.UI
-{
-    partial class RepointerDialog
-    {
-        /// <summary>
-        /// Required designer variable.
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// Clean up any resources being used.
-        /// </summary>
-        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows Form Designer generated code
-
-        /// <summary>
-        /// Required method for Designer support - do not modify
-        /// the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RepointerDialog));
-            this.groupBox1 = new System.Windows.Forms.GroupBox();
-            this.txtSource = new System.Windows.Forms.TextBox();
-            this.groupBox2 = new System.Windows.Forms.GroupBox();
-            this.btnBrowse = new System.Windows.Forms.Button();
-            this.txtTarget = new System.Windows.Forms.TextBox();
-            this.groupBox3 = new System.Windows.Forms.GroupBox();
-            this.lstAffectedResources = new System.Windows.Forms.ListBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.btnOK = new System.Windows.Forms.Button();
-            this.btnCancel = new System.Windows.Forms.Button();
-            this.groupBox1.SuspendLayout();
-            this.groupBox2.SuspendLayout();
-            this.groupBox3.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // groupBox1
-            // 
-            this.groupBox1.Controls.Add(this.txtSource);
-            resources.ApplyResources(this.groupBox1, "groupBox1");
-            this.groupBox1.Name = "groupBox1";
-            this.groupBox1.TabStop = false;
-            // 
-            // txtSource
-            // 
-            resources.ApplyResources(this.txtSource, "txtSource");
-            this.txtSource.Name = "txtSource";
-            this.txtSource.ReadOnly = true;
-            // 
-            // groupBox2
-            // 
-            this.groupBox2.Controls.Add(this.btnBrowse);
-            this.groupBox2.Controls.Add(this.txtTarget);
-            resources.ApplyResources(this.groupBox2, "groupBox2");
-            this.groupBox2.Name = "groupBox2";
-            this.groupBox2.TabStop = false;
-            // 
-            // btnBrowse
-            // 
-            resources.ApplyResources(this.btnBrowse, "btnBrowse");
-            this.btnBrowse.Name = "btnBrowse";
-            this.btnBrowse.UseVisualStyleBackColor = true;
-            this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
-            // 
-            // txtTarget
-            // 
-            resources.ApplyResources(this.txtTarget, "txtTarget");
-            this.txtTarget.Name = "txtTarget";
-            this.txtTarget.ReadOnly = true;
-            // 
-            // groupBox3
-            // 
-            resources.ApplyResources(this.groupBox3, "groupBox3");
-            this.groupBox3.Controls.Add(this.lstAffectedResources);
-            this.groupBox3.Name = "groupBox3";
-            this.groupBox3.TabStop = false;
-            // 
-            // lstAffectedResources
-            // 
-            resources.ApplyResources(this.lstAffectedResources, "lstAffectedResources");
-            this.lstAffectedResources.FormattingEnabled = true;
-            this.lstAffectedResources.Name = "lstAffectedResources";
-            // 
-            // label1
-            // 
-            resources.ApplyResources(this.label1, "label1");
-            this.label1.Name = "label1";
-            // 
-            // btnOK
-            // 
-            resources.ApplyResources(this.btnOK, "btnOK");
-            this.btnOK.Name = "btnOK";
-            this.btnOK.UseVisualStyleBackColor = true;
-            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
-            // 
-            // btnCancel
-            // 
-            resources.ApplyResources(this.btnCancel, "btnCancel");
-            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.btnCancel.Name = "btnCancel";
-            this.btnCancel.UseVisualStyleBackColor = true;
-            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
-            // 
-            // RepointerDialog
-            // 
-            this.AcceptButton = this.btnOK;
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
-            this.CancelButton = this.btnCancel;
-            resources.ApplyResources(this, "$this");
-            this.ControlBox = false;
-            this.Controls.Add(this.btnCancel);
-            this.Controls.Add(this.btnOK);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.groupBox3);
-            this.Controls.Add(this.groupBox2);
-            this.Controls.Add(this.groupBox1);
-            this.Name = "RepointerDialog";
-            this.groupBox1.ResumeLayout(false);
-            this.groupBox1.PerformLayout();
-            this.groupBox2.ResumeLayout(false);
-            this.groupBox2.PerformLayout();
-            this.groupBox3.ResumeLayout(false);
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private System.Windows.Forms.GroupBox groupBox1;
-        private System.Windows.Forms.GroupBox groupBox2;
-        private System.Windows.Forms.GroupBox groupBox3;
-        private System.Windows.Forms.TextBox txtSource;
-        private System.Windows.Forms.Button btnBrowse;
-        private System.Windows.Forms.TextBox txtTarget;
-        private System.Windows.Forms.ListBox lstAffectedResources;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Button btnOK;
-        private System.Windows.Forms.Button btnCancel;
-    }
-}
\ No newline at end of file

Deleted: trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.cs	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -1,89 +0,0 @@
-#region Disclaimer / License
-// Copyright (C) 2010, Jackie Ng
-// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-// 
-#endregion
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.Windows.Forms;
-using OSGeo.MapGuide.MaestroAPI;
-using OSGeo.MapGuide.MaestroAPI.Resource;
-using Maestro.Editors.Generic;
-using OSGeo.MapGuide.MaestroAPI.Services;
-
-namespace Maestro.Base.UI
-{
-    internal partial class RepointerDialog : Form
-    {
-        private RepointerDialog()
-        {
-            InitializeComponent();
-        }
-
-        private IResourceService _resSvc;
-
-        public RepointerDialog(ResourceIdentifier resId, IResourceService resSvc)
-            : this()
-        {
-            _resSvc = resSvc;
-            txtSource.Text = resId.ToString();
-            this.ResourceType = resId.ResourceType;
-
-            var dependents = resSvc.EnumerateResourceReferences(resId.ToString());
-
-            lstAffectedResources.DataSource = dependents.ResourceId;
-        }
-
-        public ICollection<string> Dependents { get { return (ICollection<string>)lstAffectedResources.DataSource; } }
-
-        public string Source { get { return txtSource.Text; } }
-
-        public string Target { get { return txtTarget.Text; } }
-
-        public ResourceTypes ResourceType
-        {
-            get;
-            private set;
-        }
-
-        private void btnCancel_Click(object sender, EventArgs e)
-        {
-            this.DialogResult = DialogResult.Cancel;
-        }
-
-        private void btnOK_Click(object sender, EventArgs e)
-        {
-            this.DialogResult = DialogResult.OK;
-        }
-
-        private void btnBrowse_Click(object sender, EventArgs e)
-        {
-            using (var picker = new ResourcePicker(_resSvc, this.ResourceType, ResourcePickerMode.OpenResource))
-            {
-                if (picker.ShowDialog() == DialogResult.OK)
-                {
-                    txtTarget.Text = picker.ResourceID;
-                    btnOK.Enabled = !string.IsNullOrEmpty(txtSource.Text) && !string.IsNullOrEmpty(txtTarget.Text);
-                }
-            }
-        }
-    }
-}

Deleted: trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.resx	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Base/UI/RepointerDialog.resx	2013-05-27 11:33:22 UTC (rev 7521)
@@ -1,390 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
-  <data name="txtSource.Location" type="System.Drawing.Point, System.Drawing">
-    <value>15, 28</value>
-  </data>
-  <data name="txtSource.Size" type="System.Drawing.Size, System.Drawing">
-    <value>276, 20</value>
-  </data>
-  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-  <data name="txtSource.TabIndex" type="System.Int32, mscorlib">
-    <value>0</value>
-  </data>
-  <data name=">>txtSource.Name" xml:space="preserve">
-    <value>txtSource</value>
-  </data>
-  <data name=">>txtSource.Type" xml:space="preserve">
-    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>txtSource.Parent" xml:space="preserve">
-    <value>groupBox1</value>
-  </data>
-  <data name=">>txtSource.ZOrder" xml:space="preserve">
-    <value>0</value>
-  </data>
-  <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>13, 13</value>
-  </data>
-  <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>342, 62</value>
-  </data>
-  <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
-    <value>0</value>
-  </data>
-  <data name="groupBox1.Text" xml:space="preserve">
-    <value>Source</value>
-  </data>
-  <data name=">>groupBox1.Name" xml:space="preserve">
-    <value>groupBox1</value>
-  </data>
-  <data name=">>groupBox1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>groupBox1.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>groupBox1.ZOrder" xml:space="preserve">
-    <value>5</value>
-  </data>
-  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
-  <data name="btnBrowse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
-    <value>NoControl</value>
-  </data>
-  <data name="btnBrowse.Location" type="System.Drawing.Point, System.Drawing">
-    <value>296, 17</value>
-  </data>
-  <data name="btnBrowse.Size" type="System.Drawing.Size, System.Drawing">
-    <value>29, 23</value>
-  </data>
-  <data name="btnBrowse.TabIndex" type="System.Int32, mscorlib">
-    <value>2</value>
-  </data>
-  <data name="btnBrowse.Text" xml:space="preserve">
-    <value>...</value>
-  </data>
-  <data name=">>btnBrowse.Name" xml:space="preserve">
-    <value>btnBrowse</value>
-  </data>
-  <data name=">>btnBrowse.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>btnBrowse.Parent" xml:space="preserve">
-    <value>groupBox2</value>
-  </data>
-  <data name=">>btnBrowse.ZOrder" xml:space="preserve">
-    <value>0</value>
-  </data>
-  <data name="txtTarget.Location" type="System.Drawing.Point, System.Drawing">
-    <value>14, 19</value>
-  </data>
-  <data name="txtTarget.Size" type="System.Drawing.Size, System.Drawing">
-    <value>276, 20</value>
-  </data>
-  <data name="txtTarget.TabIndex" type="System.Int32, mscorlib">
-    <value>1</value>
-  </data>
-  <data name=">>txtTarget.Name" xml:space="preserve">
-    <value>txtTarget</value>
-  </data>
-  <data name=">>txtTarget.Type" xml:space="preserve">
-    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>txtTarget.Parent" xml:space="preserve">
-    <value>groupBox2</value>
-  </data>
-  <data name=">>txtTarget.ZOrder" xml:space="preserve">
-    <value>1</value>
-  </data>
-  <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
-    <value>14, 81</value>
-  </data>
-  <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
-    <value>342, 55</value>
-  </data>
-  <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
-    <value>1</value>
-  </data>
-  <data name="groupBox2.Text" xml:space="preserve">
-    <value>Target</value>
-  </data>
-  <data name=">>groupBox2.Name" xml:space="preserve">
-    <value>groupBox2</value>
-  </data>
-  <data name=">>groupBox2.Type" xml:space="preserve">
-    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>groupBox2.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>groupBox2.ZOrder" xml:space="preserve">
-    <value>4</value>
-  </data>
-  <data name="groupBox3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
-    <value>Top, Bottom, Left, Right</value>
-  </data>
-  <data name="lstAffectedResources.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
-    <value>Top, Bottom, Left, Right</value>
-  </data>
-  <data name="lstAffectedResources.HorizontalScrollbar" type="System.Boolean, mscorlib">
-    <value>True</value>
-  </data>
-  <data name="lstAffectedResources.Location" type="System.Drawing.Point, System.Drawing">
-    <value>17, 26</value>
-  </data>
-  <data name="lstAffectedResources.Size" type="System.Drawing.Size, System.Drawing">
-    <value>179, 147</value>
-  </data>
-  <data name="lstAffectedResources.TabIndex" type="System.Int32, mscorlib">
-    <value>0</value>
-  </data>
-  <data name=">>lstAffectedResources.Name" xml:space="preserve">
-    <value>lstAffectedResources</value>
-  </data>
-  <data name=">>lstAffectedResources.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ListBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>lstAffectedResources.Parent" xml:space="preserve">
-    <value>groupBox3</value>
-  </data>
-  <data name=">>lstAffectedResources.ZOrder" xml:space="preserve">
-    <value>0</value>
-  </data>
-  <data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing">
-    <value>362, 13</value>
-  </data>
-  <data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing">
-    <value>217, 193</value>
-  </data>
-  <data name="groupBox3.TabIndex" type="System.Int32, mscorlib">
-    <value>2</value>
-  </data>
-  <data name="groupBox3.Text" xml:space="preserve">
-    <value>Resources Referencing Source</value>
-  </data>
-  <data name=">>groupBox3.Name" xml:space="preserve">
-    <value>groupBox3</value>
-  </data>
-  <data name=">>groupBox3.Type" xml:space="preserve">
-    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>groupBox3.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>groupBox3.ZOrder" xml:space="preserve">
-    <value>3</value>
-  </data>
-  <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>28, 156</value>
-  </data>
-  <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
-    <value>311, 50</value>
-  </data>
-  <data name="label1.TabIndex" type="System.Int32, mscorlib">
-    <value>3</value>
-  </data>
-  <data name="label1.Text" xml:space="preserve">
-    <value>All resources currently pointing to the specified source will be pointed to the target instead</value>
-  </data>
-  <data name=">>label1.Name" xml:space="preserve">
-    <value>label1</value>
-  </data>
-  <data name=">>label1.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>label1.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>label1.ZOrder" xml:space="preserve">
-    <value>2</value>
-  </data>
-  <data name="btnOK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
-    <value>Bottom, Right</value>
-  </data>
-  <data name="btnOK.Enabled" type="System.Boolean, mscorlib">
-    <value>False</value>
-  </data>
-  <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
-    <value>414, 220</value>
-  </data>
-  <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
-    <value>75, 23</value>
-  </data>
-  <data name="btnOK.TabIndex" type="System.Int32, mscorlib">
-    <value>4</value>
-  </data>
-  <data name="btnOK.Text" xml:space="preserve">
-    <value>OK</value>
-  </data>
-  <data name=">>btnOK.Name" xml:space="preserve">
-    <value>btnOK</value>
-  </data>
-  <data name=">>btnOK.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>btnOK.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>btnOK.ZOrder" xml:space="preserve">
-    <value>1</value>
-  </data>
-  <data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
-    <value>Bottom, Right</value>
-  </data>
-  <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
-    <value>495, 220</value>
-  </data>
-  <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
-    <value>75, 23</value>
-  </data>
-  <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
-    <value>5</value>
-  </data>
-  <data name="btnCancel.Text" xml:space="preserve">
-    <value>Cancel</value>
-  </data>
-  <data name=">>btnCancel.Name" xml:space="preserve">
-    <value>btnCancel</value>
-  </data>
-  <data name=">>btnCancel.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-  <data name=">>btnCancel.Parent" xml:space="preserve">
-    <value>$this</value>
-  </data>
-  <data name=">>btnCancel.ZOrder" xml:space="preserve">
-    <value>0</value>
-  </data>
-  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>594, 255</value>
-  </data>
-  <data name="$this.Text" xml:space="preserve">
-    <value>Re-Point</value>
-  </data>
-  <data name=">>$this.Name" xml:space="preserve">
-    <value>RepointerDialog</value>
-  </data>
-  <data name=">>$this.Type" xml:space="preserve">
-    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </data>
-</root>
\ No newline at end of file

Added: trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.Designer.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.Designer.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -0,0 +1,150 @@
+namespace Maestro.Editors.Common
+{
+    partial class RepointerDialog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RepointerDialog));
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.txtSource = new System.Windows.Forms.TextBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.btnBrowse = new System.Windows.Forms.Button();
+            this.txtTarget = new System.Windows.Forms.TextBox();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.lstAffectedResources = new System.Windows.Forms.ListBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.btnOK = new System.Windows.Forms.Button();
+            this.btnCancel = new System.Windows.Forms.Button();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.groupBox3.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.txtSource);
+            resources.ApplyResources(this.groupBox1, "groupBox1");
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.TabStop = false;
+            // 
+            // txtSource
+            // 
+            resources.ApplyResources(this.txtSource, "txtSource");
+            this.txtSource.Name = "txtSource";
+            this.txtSource.ReadOnly = true;
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.btnBrowse);
+            this.groupBox2.Controls.Add(this.txtTarget);
+            resources.ApplyResources(this.groupBox2, "groupBox2");
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.TabStop = false;
+            // 
+            // btnBrowse
+            // 
+            resources.ApplyResources(this.btnBrowse, "btnBrowse");
+            this.btnBrowse.Name = "btnBrowse";
+            this.btnBrowse.UseVisualStyleBackColor = true;
+            this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+            // 
+            // txtTarget
+            // 
+            resources.ApplyResources(this.txtTarget, "txtTarget");
+            this.txtTarget.Name = "txtTarget";
+            this.txtTarget.ReadOnly = true;
+            // 
+            // groupBox3
+            // 
+            resources.ApplyResources(this.groupBox3, "groupBox3");
+            this.groupBox3.Controls.Add(this.lstAffectedResources);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.TabStop = false;
+            // 
+            // lstAffectedResources
+            // 
+            resources.ApplyResources(this.lstAffectedResources, "lstAffectedResources");
+            this.lstAffectedResources.FormattingEnabled = true;
+            this.lstAffectedResources.Name = "lstAffectedResources";
+            // 
+            // label1
+            // 
+            resources.ApplyResources(this.label1, "label1");
+            this.label1.Name = "label1";
+            // 
+            // btnOK
+            // 
+            resources.ApplyResources(this.btnOK, "btnOK");
+            this.btnOK.Name = "btnOK";
+            this.btnOK.UseVisualStyleBackColor = true;
+            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+            // 
+            // btnCancel
+            // 
+            resources.ApplyResources(this.btnCancel, "btnCancel");
+            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.btnCancel.Name = "btnCancel";
+            this.btnCancel.UseVisualStyleBackColor = true;
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+            // 
+            // RepointerDialog
+            // 
+            this.AcceptButton = this.btnOK;
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+            this.CancelButton = this.btnCancel;
+            resources.ApplyResources(this, "$this");
+            this.ControlBox = false;
+            this.Controls.Add(this.btnCancel);
+            this.Controls.Add(this.btnOK);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.groupBox3);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Name = "RepointerDialog";
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
+            this.groupBox3.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.GroupBox groupBox3;
+        private System.Windows.Forms.TextBox txtSource;
+        private System.Windows.Forms.Button btnBrowse;
+        private System.Windows.Forms.TextBox txtTarget;
+        private System.Windows.Forms.ListBox lstAffectedResources;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Button btnOK;
+        private System.Windows.Forms.Button btnCancel;
+    }
+}
\ No newline at end of file

Added: trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.cs	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -0,0 +1,113 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using Maestro.Editors.Generic;
+using OSGeo.MapGuide.MaestroAPI.Services;
+
+namespace Maestro.Editors.Common
+{
+    /// <summary>
+    /// A dialog that prompts the user to re-point the dependent resources of a given resource
+    /// to a new resource of the user's choosing.
+    /// 
+    /// This dialog does not perform the re-pointer logic. This dialog simply captures the parameters
+    /// required for a re-pointer operation.
+    /// </summary>
+    public partial class RepointerDialog : Form
+    {
+        private RepointerDialog()
+        {
+            InitializeComponent();
+        }
+
+        private IResourceService _resSvc;
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="resId">The given resource, whose dependencies we want to re-point</param>
+        /// <param name="resSvc">The resource service</param>
+        public RepointerDialog(ResourceIdentifier resId, IResourceService resSvc)
+            : this()
+        {
+            _resSvc = resSvc;
+            txtSource.Text = resId.ToString();
+            this.ResourceType = resId.ResourceType;
+
+            var dependents = resSvc.EnumerateResourceReferences(resId.ToString());
+
+            lstAffectedResources.DataSource = dependents.ResourceId;
+        }
+
+        /// <summary>
+        /// Returns a list of resource ids which are the dependent resources of the specified resource
+        /// </summary>
+        public ICollection<string> Dependents { get { return (ICollection<string>)lstAffectedResources.DataSource; } }
+
+        /// <summary>
+        /// Gets the specified resource id
+        /// </summary>
+        public string Source { get { return txtSource.Text; } }
+
+        /// <summary>
+        /// Gets the target resource id we want to re-point 
+        /// </summary>
+        public string Target { get { return txtTarget.Text; } }
+
+        internal ResourceTypes ResourceType
+        {
+            get;
+            private set;
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+        }
+
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.OK;
+        }
+
+        private void btnBrowse_Click(object sender, EventArgs e)
+        {
+            using (var picker = new ResourcePicker(_resSvc, this.ResourceType, ResourcePickerMode.OpenResource))
+            {
+                if (string.IsNullOrEmpty(LastSelectedFolder.FolderId))
+                    picker.SetStartingPoint(ResourceIdentifier.GetParentFolder(this.Source));
+                if (picker.ShowDialog() == DialogResult.OK)
+                {
+                    txtTarget.Text = picker.ResourceID;
+                    btnOK.Enabled = !string.IsNullOrEmpty(txtSource.Text) && !string.IsNullOrEmpty(txtTarget.Text) &&
+                                    lstAffectedResources.Items.Count > 0 && txtSource.Text != txtTarget.Text;
+                }
+            }
+        }
+    }
+}

Added: trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.resx	                        (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/RepointerDialog.resx	2013-05-27 11:33:22 UTC (rev 7521)
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="txtSource.Location" type="System.Drawing.Point, System.Drawing">
+    <value>15, 28</value>
+  </data>
+  <data name="txtSource.Size" type="System.Drawing.Size, System.Drawing">
+    <value>276, 20</value>
+  </data>
+  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="txtSource.TabIndex" type="System.Int32, mscorlib">
+    <value>0</value>
+  </data>
+  <data name=">>txtSource.Name" xml:space="preserve">
+    <value>txtSource</value>
+  </data>
+  <data name=">>txtSource.Type" xml:space="preserve">
+    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>txtSource.Parent" xml:space="preserve">
+    <value>groupBox1</value>
+  </data>
+  <data name=">>txtSource.ZOrder" xml:space="preserve">
+    <value>0</value>
+  </data>
+  <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
+    <value>13, 13</value>
+  </data>
+  <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
+    <value>342, 62</value>
+  </data>
+  <data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
+    <value>0</value>
+  </data>
+  <data name="groupBox1.Text" xml:space="preserve">
+    <value>Source</value>
+  </data>
+  <data name=">>groupBox1.Name" xml:space="preserve">
+    <value>groupBox1</value>
+  </data>
+  <data name=">>groupBox1.Type" xml:space="preserve">
+    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>groupBox1.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>groupBox1.ZOrder" xml:space="preserve">
+    <value>5</value>
+  </data>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="btnBrowse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+    <value>NoControl</value>
+  </data>
+  <data name="btnBrowse.Location" type="System.Drawing.Point, System.Drawing">
+    <value>296, 17</value>
+  </data>
+  <data name="btnBrowse.Size" type="System.Drawing.Size, System.Drawing">
+    <value>29, 23</value>
+  </data>
+  <data name="btnBrowse.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="btnBrowse.Text" xml:space="preserve">
+    <value>...</value>
+  </data>
+  <data name=">>btnBrowse.Name" xml:space="preserve">
+    <value>btnBrowse</value>
+  </data>
+  <data name=">>btnBrowse.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnBrowse.Parent" xml:space="preserve">
+    <value>groupBox2</value>
+  </data>
+  <data name=">>btnBrowse.ZOrder" xml:space="preserve">
+    <value>0</value>
+  </data>
+  <data name="txtTarget.Location" type="System.Drawing.Point, System.Drawing">
+    <value>14, 19</value>
+  </data>
+  <data name="txtTarget.Size" type="System.Drawing.Size, System.Drawing">
+    <value>276, 20</value>
+  </data>
+  <data name="txtTarget.TabIndex" type="System.Int32, mscorlib">
+    <value>1</value>
+  </data>
+  <data name=">>txtTarget.Name" xml:space="preserve">
+    <value>txtTarget</value>
+  </data>
+  <data name=">>txtTarget.Type" xml:space="preserve">
+    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>txtTarget.Parent" xml:space="preserve">
+    <value>groupBox2</value>
+  </data>
+  <data name=">>txtTarget.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
+    <value>14, 81</value>
+  </data>
+  <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>342, 55</value>
+  </data>
+  <data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
+    <value>1</value>
+  </data>
+  <data name="groupBox2.Text" xml:space="preserve">
+    <value>Target</value>
+  </data>
+  <data name=">>groupBox2.Name" xml:space="preserve">
+    <value>groupBox2</value>
+  </data>
+  <data name=">>groupBox2.Type" xml:space="preserve">
+    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>groupBox2.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>groupBox2.ZOrder" xml:space="preserve">
+    <value>4</value>
+  </data>
+  <data name="groupBox3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Bottom, Left, Right</value>
+  </data>
+  <data name="lstAffectedResources.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Bottom, Left, Right</value>
+  </data>
+  <data name="lstAffectedResources.HorizontalScrollbar" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="lstAffectedResources.Location" type="System.Drawing.Point, System.Drawing">
+    <value>17, 26</value>
+  </data>
+  <data name="lstAffectedResources.Size" type="System.Drawing.Size, System.Drawing">
+    <value>179, 147</value>
+  </data>
+  <data name="lstAffectedResources.TabIndex" type="System.Int32, mscorlib">
+    <value>0</value>
+  </data>
+  <data name=">>lstAffectedResources.Name" xml:space="preserve">
+    <value>lstAffectedResources</value>
+  </data>
+  <data name=">>lstAffectedResources.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ListBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>lstAffectedResources.Parent" xml:space="preserve">
+    <value>groupBox3</value>
+  </data>
+  <data name=">>lstAffectedResources.ZOrder" xml:space="preserve">
+    <value>0</value>
+  </data>
+  <data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing">
+    <value>362, 13</value>
+  </data>
+  <data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing">
+    <value>217, 193</value>
+  </data>
+  <data name="groupBox3.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="groupBox3.Text" xml:space="preserve">
+    <value>Resources Referencing Source</value>
+  </data>
+  <data name=">>groupBox3.Name" xml:space="preserve">
+    <value>groupBox3</value>
+  </data>
+  <data name=">>groupBox3.Type" xml:space="preserve">
+    <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>groupBox3.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>groupBox3.ZOrder" xml:space="preserve">
+    <value>3</value>
+  </data>
+  <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+    <value>28, 156</value>
+  </data>
+  <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+    <value>311, 50</value>
+  </data>
+  <data name="label1.TabIndex" type="System.Int32, mscorlib">
+    <value>3</value>
+  </data>
+  <data name="label1.Text" xml:space="preserve">
+    <value>All resources currently pointing to the specified source will be pointed to the target instead</value>
+  </data>
+  <data name=">>label1.Name" xml:space="preserve">
+    <value>label1</value>
+  </data>
+  <data name=">>label1.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>label1.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>label1.ZOrder" xml:space="preserve">
+    <value>2</value>
+  </data>
+  <data name="btnOK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom, Right</value>
+  </data>
+  <data name="btnOK.Enabled" type="System.Boolean, mscorlib">
+    <value>False</value>
+  </data>
+  <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
+    <value>414, 220</value>
+  </data>
+  <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
+    <value>75, 23</value>
+  </data>
+  <data name="btnOK.TabIndex" type="System.Int32, mscorlib">
+    <value>4</value>
+  </data>
+  <data name="btnOK.Text" xml:space="preserve">
+    <value>OK</value>
+  </data>
+  <data name=">>btnOK.Name" xml:space="preserve">
+    <value>btnOK</value>
+  </data>
+  <data name=">>btnOK.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnOK.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>btnOK.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom, Right</value>
+  </data>
+  <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
+    <value>495, 220</value>
+  </data>
+  <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
+    <value>75, 23</value>
+  </data>
+  <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
+    <value>5</value>
+  </data>
+  <data name="btnCancel.Text" xml:space="preserve">
+    <value>Cancel</value>
+  </data>
+  <data name=">>btnCancel.Name" xml:space="preserve">
+    <value>btnCancel</value>
+  </data>
+  <data name=">>btnCancel.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnCancel.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>btnCancel.ZOrder" xml:space="preserve">
+    <value>0</value>
+  </data>
+  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+    <value>594, 255</value>
+  </data>
+  <data name="$this.Text" xml:space="preserve">
+    <value>Re-Point</value>
+  </data>
+  <data name=">>$this.Name" xml:space="preserve">
+    <value>RepointerDialog</value>
+  </data>
+  <data name=">>$this.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+</root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj	2013-05-27 11:33:22 UTC (rev 7521)
@@ -145,6 +145,12 @@
       <DependentUpon>MonoCompatibleExpressionEditor.cs</DependentUpon>
     </Compile>
     <Compile Include="Common\NsDoc.cs" />
+    <Compile Include="Common\RepointerDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Common\RepointerDialog.Designer.cs">
+      <DependentUpon>RepointerDialog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Common\RepositoryTreeModel.cs" />
     <Compile Include="Common\RepositoryView.cs">
       <SubType>UserControl</SubType>
@@ -1241,6 +1247,9 @@
     <EmbeddedResource Include="Common\MonoCompatibleExpressionEditor.resx">
       <DependentUpon>MonoCompatibleExpressionEditor.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Common\RepointerDialog.resx">
+      <DependentUpon>RepointerDialog.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Common\RepositoryView.resx">
       <DependentUpon>RepositoryView.cs</DependentUpon>
     </EmbeddedResource>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs	2013-05-27 11:00:47 UTC (rev 7520)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs	2013-05-27 11:33:22 UTC (rev 7521)
@@ -1419,6 +1419,33 @@
                 ReturnType = "String" //NOXLATE
             };
         }
+
+        /// <summary>
+        /// Replaces all references of the given resource id
+        /// </summary>
+        /// <param name="doc">A resource document</param>
+        /// <param name="srcId">The resource id to replace</param>
+        /// <param name="dstId">The resource id to replace with</param>
+        /// <returns>true if a replacement was made. false if no replacements were made</returns>
+        public static bool ReplaceResourceIds(XmlDocument doc, string srcId, string dstId)
+        {
+            Check.NotEmpty(srcId, "srcId"); //NOXLATE
+            Check.NotEmpty(dstId, "dstId"); //NOXLATE
+            bool changed = false;
+            //There's an unwritten spec that all elements that refer to a Resource ID are named "ResourceId".
+            //This is why this method can be relied upon to cover all resource id references.
+            var resIdNodes = Utility.GetResourceIdPointers(doc);
+            for (int i = 0; i < resIdNodes.Count; i++)
+            {
+                var kvp = resIdNodes[i];
+                if (kvp.Value.Equals(srcId))
+                {
+                    kvp.Key.InnerXml = dstId;
+                    changed = true;
+                }
+            }
+            return changed;
+        }
     }
 
     /// <summary>



More information about the mapguide-commits mailing list