[mapguide-commits] r5329 - in sandbox/maestro-3.0: Maestro.Base Maestro.Base/Commands Maestro.Base/Commands/Test Maestro.Base/Editor Maestro.Base/Services Maestro.Base/UI Maestro.Editors Maestro.Editors/Common Maestro.Editors/Properties

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Oct 26 04:57:42 EDT 2010


Author: jng
Date: 2010-10-26 01:57:42 -0700 (Tue, 26 Oct 2010)
New Revision: 5329

Modified:
   sandbox/maestro-3.0/Maestro.Base/Commands/NewItemCommand.cs
   sandbox/maestro-3.0/Maestro.Base/Commands/SaveResourceAsCommand.cs
   sandbox/maestro-3.0/Maestro.Base/Commands/Test/OpenResourceCommand.cs
   sandbox/maestro-3.0/Maestro.Base/Editor/ResourceEditorService.cs
   sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
   sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs
   sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs
   sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx
   sandbox/maestro-3.0/Maestro.Editors/IEditorService.cs
   sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
   sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
Log:
3.0 sandbox changes:
 - #1500: Use vanilla TreeView in ResourcePicker.
 - Productivity enhancements
   - Also add a SetStartingPoint() API to allow auto-drilldown to the specified folder
   - Add a SuggestedSaveFolder property to IEditorService that specifies where the ResourcePicker should start from when prompting for save.
   - Thus a "Save As" command on a new resource will display the resource picker starting from where they right clicked when they chose "New Resource"


Modified: sandbox/maestro-3.0/Maestro.Base/Commands/NewItemCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/NewItemCommand.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/NewItemCommand.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -39,12 +39,12 @@
             var nits = ServiceRegistry.GetService<NewItemTemplateService>();
 
             NewResourceDialog dlg = null;
-
+            string startPoint = null;
             if (exp.SelectedItems.Length == 1)
             {
                 var item = exp.SelectedItems[0];
                 if (item.IsFolder)
-                    dlg = new NewResourceDialog(conn.ResourceService, conn.SiteVersion, nits, item.ResourceId);
+                    startPoint = item.ResourceId;
             }
 
             if (dlg == null)
@@ -60,7 +60,9 @@
                     res.ResourceID = "Session:" + conn.SessionID + "//" + Guid.NewGuid().ToString() + "." + res.ResourceType.ToString();
                     conn.ResourceService.SaveResource(res);
 
-                    orm.Open(res.ResourceID, conn, false, exp);
+                    var ed = orm.Open(res.ResourceID, conn, false, exp);
+                    if (!string.IsNullOrEmpty(startPoint))
+                        ed.EditorService.SuggestedSaveFolder = startPoint;
                 }
             }
         }

Modified: sandbox/maestro-3.0/Maestro.Base/Commands/SaveResourceAsCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/SaveResourceAsCommand.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/SaveResourceAsCommand.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -43,6 +43,9 @@
             {
                 using (var picker = new ResourcePicker(conn.ResourceService, ed.Resource.ResourceType, ResourcePickerMode.SaveResource))
                 {
+                    if (!string.IsNullOrEmpty(ed.EditorService.SuggestedSaveFolder))
+                        picker.SetStartingPoint(ed.EditorService.SuggestedSaveFolder);
+
                     if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                     {
                         using (new WaitCursor(wb))

Modified: sandbox/maestro-3.0/Maestro.Base/Commands/Test/OpenResourceCommand.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Commands/Test/OpenResourceCommand.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Commands/Test/OpenResourceCommand.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -47,6 +47,28 @@
         }
     }
 
+    public class OpenResourceFromStartingPointCommand : AbstractMenuCommand
+    {
+        public override void Run()
+        {
+            var wb = Workbench.Instance;
+            var exp = wb.ActiveSiteExplorer;
+            var mgr = ServiceRegistry.GetService<ServerConnectionManager>();
+            var conn = mgr.GetConnection(exp.ConnectionName);
+
+            var picker = new ResourcePicker(conn.ResourceService, ResourcePickerMode.OpenResource);
+            picker.SetStartingPoint("Library://Samples/Sheboygan/");
+            if (picker.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK)
+            {
+                MessageService.ShowMessage(picker.ResourceID);
+            }
+            else
+            {
+                MessageService.ShowMessage("Cancelled");
+            }
+        }
+    }
+
     public class OpenFolderCommand : AbstractMenuCommand
     {
         public override void Run()

Modified: sandbox/maestro-3.0/Maestro.Base/Editor/ResourceEditorService.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Editor/ResourceEditorService.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Editor/ResourceEditorService.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -310,5 +310,11 @@
         {
             _orm.Open(resourceId, _conn, false, _siteExp);
         }
+
+        public string SuggestedSaveFolder
+        {
+            get;
+            set;
+        }
     }
 }

Modified: sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Maestro.Base.addin	2010-10-26 08:57:42 UTC (rev 5329)
@@ -114,6 +114,9 @@
                 <MenuItem id="Menu_Test_OpenResource"
                           label="Open Resource"
                           class="Maestro.Base.Commands.Test.OpenResourceCommand" />
+                <MenuItem id="Menu_Test_OpenResourceStartingPoint"
+                          label="Open Resource (from starting point)"
+                          class="Maestro.Base.Commands.Test.OpenResourceFromStartingPointCommand" />
                 <MenuItem id="Menu_Test_OpenResourceWithFilter"
                           label="Open Resource (with filter)"
                           class="Maestro.Base.Commands.Test.OpenResourceWithFilterCommand" />

Modified: sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/Services/OpenResourceManager.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -106,7 +106,7 @@
         /// <param name="res"></param>
         /// <param name="conn"></param>
         /// <param name="useXmlEditor"></param>
-        public void Open(IResource res, IServerConnection conn, bool useXmlEditor, ISiteExplorer siteExp)
+        public IEditorViewContent Open(IResource res, IServerConnection conn, bool useXmlEditor, ISiteExplorer siteExp)
         {
             string resourceId = res.ResourceID;
             if (!_openItems.ContainsKey(resourceId))
@@ -147,6 +147,7 @@
             }
             _openItems[resourceId].Activate();
             siteExp.FlagNode(resourceId, NodeFlagAction.HighlightOpen);
+            return _openItems[resourceId];
         }
 
         /// <summary>
@@ -158,18 +159,18 @@
         /// <param name="resourceId"></param>
         /// <param name="conn"></param>
         /// <param name="useXmlEditor"></param>
-        public void Open(string resourceId, IServerConnection conn, bool useXmlEditor, ISiteExplorer siteExp)
+        public IEditorViewContent Open(string resourceId, IServerConnection conn, bool useXmlEditor, ISiteExplorer siteExp)
         {
             IResource res = null;
             try
             {
                 res = (IResource)conn.ResourceService.GetResource(resourceId);
-                Open(res, conn, useXmlEditor, siteExp);
+                return Open(res, conn, useXmlEditor, siteExp);
             }
             catch (Exception ex)
             {
                 MessageService.ShowError(ex);
-                return;
+                return null;
             }
         }
 

Modified: sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Base/UI/NewResourceDialog.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -44,9 +44,7 @@
         private IResourceService _resSvc;
         private NewItemTemplateService _nits;
 
-        public NewResourceDialog(IResourceService resSvc, Version siteVersion, NewItemTemplateService nits) : this(resSvc, siteVersion, nits, "Library://") { }
-
-        public NewResourceDialog(IResourceService resSvc, Version siteVersion, NewItemTemplateService nits, string startPoint)
+        public NewResourceDialog(IResourceService resSvc, Version siteVersion, NewItemTemplateService nits)
             : this()
         {
             _siteVersion = siteVersion;

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.Designer.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -30,7 +30,6 @@
         {
             this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ResourcePicker));
-            this.trvFolders = new Aga.Controls.Tree.TreeViewAdv();
             this.nodeIcon1 = new Aga.Controls.Tree.NodeControls.NodeIcon();
             this.nodeTextBox1 = new Aga.Controls.Tree.NodeControls.NodeTextBox();
             this.lstResources = new System.Windows.Forms.ListView();
@@ -44,6 +43,8 @@
             this.label3 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.trvFolders = new System.Windows.Forms.TreeView();
+            this.folderImageList = new System.Windows.Forms.ImageList(this.components);
             this.label2 = new System.Windows.Forms.Label();
             this.txtFolder = new System.Windows.Forms.TextBox();
             this.label5 = new System.Windows.Forms.Label();
@@ -55,29 +56,6 @@
             this.resIdComponentPanel.SuspendLayout();
             this.SuspendLayout();
             // 
-            // trvFolders
-            // 
-            this.trvFolders.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                        | System.Windows.Forms.AnchorStyles.Left)
-                        | System.Windows.Forms.AnchorStyles.Right)));
-            this.trvFolders.BackColor = System.Drawing.SystemColors.Window;
-            this.trvFolders.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.trvFolders.DefaultToolTipProvider = null;
-            this.trvFolders.DragDropMarkColor = System.Drawing.Color.Black;
-            this.trvFolders.LineColor = System.Drawing.SystemColors.ControlDark;
-            this.trvFolders.LoadOnDemand = true;
-            this.trvFolders.Location = new System.Drawing.Point(12, 31);
-            this.trvFolders.Model = null;
-            this.trvFolders.Name = "trvFolders";
-            this.trvFolders.NodeControls.Add(this.nodeIcon1);
-            this.trvFolders.NodeControls.Add(this.nodeTextBox1);
-            this.trvFolders.SelectedNode = null;
-            this.trvFolders.Size = new System.Drawing.Size(160, 241);
-            this.trvFolders.TabIndex = 0;
-            this.trvFolders.SelectionChanged += new System.EventHandler(this.trvFolders_SelectionChanged);
-            this.trvFolders.Expanding += new System.EventHandler<Aga.Controls.Tree.TreeViewAdvEventArgs>(this.trvFolders_Expanding);
-            this.trvFolders.Expanded += new System.EventHandler<Aga.Controls.Tree.TreeViewAdvEventArgs>(this.trvFolders_Expanded);
-            // 
             // nodeIcon1
             // 
             this.nodeIcon1.DataPropertyName = "Icon";
@@ -106,6 +84,7 @@
             this.lstResources.TabIndex = 1;
             this.lstResources.UseCompatibleStateImageBehavior = false;
             this.lstResources.View = System.Windows.Forms.View.List;
+            this.lstResources.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstResources_MouseDoubleClick);
             this.lstResources.SelectedIndexChanged += new System.EventHandler(this.lstResources_SelectedIndexChanged);
             // 
             // resImageList
@@ -216,8 +195,8 @@
             // 
             // splitContainer1.Panel1
             // 
-            this.splitContainer1.Panel1.Controls.Add(this.label3);
             this.splitContainer1.Panel1.Controls.Add(this.trvFolders);
+            this.splitContainer1.Panel1.Controls.Add(this.label3);
             // 
             // splitContainer1.Panel2
             // 
@@ -227,6 +206,23 @@
             this.splitContainer1.SplitterDistance = 175;
             this.splitContainer1.TabIndex = 10;
             // 
+            // trvFolders
+            // 
+            this.trvFolders.ImageIndex = 0;
+            this.trvFolders.ImageList = this.folderImageList;
+            this.trvFolders.Location = new System.Drawing.Point(12, 31);
+            this.trvFolders.Name = "trvFolders";
+            this.trvFolders.SelectedImageIndex = 0;
+            this.trvFolders.Size = new System.Drawing.Size(160, 241);
+            this.trvFolders.TabIndex = 9;
+            // 
+            // folderImageList
+            // 
+            this.folderImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("folderImageList.ImageStream")));
+            this.folderImageList.TransparentColor = System.Drawing.Color.Transparent;
+            this.folderImageList.Images.SetKeyName(0, "server.png");
+            this.folderImageList.Images.SetKeyName(1, "folder-horizontal.png");
+            // 
             // label2
             // 
             this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -314,7 +310,6 @@
 
         #endregion
 
-        private Aga.Controls.Tree.TreeViewAdv trvFolders;
         private System.Windows.Forms.ListView lstResources;
         private System.Windows.Forms.Button btnOK;
         private System.Windows.Forms.Button btnCancel;
@@ -333,5 +328,7 @@
         private System.Windows.Forms.Label label5;
         private System.Windows.Forms.TextBox txtName;
         private System.Windows.Forms.Panel resIdComponentPanel;
+        private System.Windows.Forms.TreeView trvFolders;
+        private System.Windows.Forms.ImageList folderImageList;
     }
 }
\ No newline at end of file

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -74,6 +74,8 @@
 
         private bool _resourceMode = false;
 
+        private RepositoryFolderTreeModel _model;
+
         /// <summary>
         /// Constructs a new instance. Use this overload to select any resource type. If only
         /// folder selection is desired, set <see cref="SelectFoldersOnly"/> to true before
@@ -84,11 +86,24 @@
             : this()
         {
             _resSvc = resSvc;
-            trvFolders.Model = new RepositoryFolderTreeModel(_resSvc);
+            _model = new RepositoryFolderTreeModel(_resSvc, trvFolders);
+            _model.FolderSelected += OnFolderSelected;
             this.UseFilter = true;
             this.Mode = mode;
         }
 
+        void OnFolderSelected(object sender, EventArgs e)
+        {
+            UpdateDocumentList();
+        }
+
+        public void SetStartingPoint(string folderId)
+        {
+            if (!ResourceIdentifier.IsFolderResource(folderId))
+                throw new ArgumentException(string.Format(Properties.Resources.NotAFolder, folderId));
+            _model.NavigateTo(folderId);
+        }
+
         private ResourcePickerMode _mode = ResourcePickerMode.OpenResource;
 
         public ResourcePickerMode Mode
@@ -257,17 +272,11 @@
             this.DialogResult = DialogResult.OK;
         }
 
-        private void trvFolders_SelectionChanged(object sender, EventArgs e)
-        {
-            UpdateDocumentList();
-        }
-
         private void UpdateDocumentList()
         {
-            var node = trvFolders.SelectedNode;
-            if (node != null)
+            RepositoryFolder folder = _model.SelectedFolder;
+            if (folder != null)
             {
-                RepositoryFolder folder = node.Tag as RepositoryFolder;
                 txtFolder.Text = folder.ResourceId;
 
                 if (!this.SelectFoldersOnly)
@@ -351,36 +360,6 @@
             }
         }
 
-        private void trvFolders_Expanding(object sender, TreeViewAdvEventArgs e)
-        {
-            if (this.InvokeRequired)
-            {
-                this.Invoke(new MethodInvoker(() => 
-                {
-                    this.Cursor = Cursors.WaitCursor;
-                }));
-            }
-            else
-            {
-                this.Cursor = Cursors.WaitCursor;
-            }
-        }
-
-        private void trvFolders_Expanded(object sender, TreeViewAdvEventArgs e)
-        {
-            if (this.InvokeRequired)
-            {
-                this.Invoke(new MethodInvoker(() =>
-                {
-                    this.Cursor = Cursors.Default;
-                }));
-            }
-            else
-            {
-                this.Cursor = Cursors.Default;
-            }
-        }
-
         private void txtName_TextChanged(object sender, EventArgs e)
         {
             UpdateResourceId();
@@ -396,6 +375,20 @@
             UpdateResourceId();
             UpdateDocumentList();
         }
+
+        private void lstResources_MouseDoubleClick(object sender, MouseEventArgs e)
+        {
+            var item = lstResources.GetItemAt(e.X, e.Y);
+            if (item != null)
+            {
+                var doc = item.Tag as ResourceListResourceDocument;
+                if (doc != null)
+                {
+                    txtName.Text = ResourceIdentifier.GetName(doc.ResourceId);
+                    btnOK.PerformClick();
+                }
+            }
+        }
     }
 
     public enum ResourcePickerMode
@@ -441,15 +434,109 @@
         }
     }
 
-    internal class RepositoryFolderTreeModel : ITreeModel
+    internal class RepositoryFolderTreeModel
     {
+        class DummyNode : TreeNode
+        {
+
+        }
+
+        internal event EventHandler FolderSelected;
+
         private IResourceService _resSvc;
+        private TreeView _tree;
 
-        public RepositoryFolderTreeModel(IResourceService resSvc)
+        public RepositoryFolder SelectedFolder
         {
+            get;
+            private set;
+        }
+
+        private void StartUpdate()
+        {
+            _tree.BeginUpdate();
+            _tree.Cursor = Cursors.WaitCursor;
+        }
+
+        private void EndUpdate()
+        {
+            _tree.EndUpdate();
+            _tree.Cursor = Cursors.Default;
+        }
+
+        public RepositoryFolderTreeModel(IResourceService resSvc, TreeView tree)
+        {
             _resSvc = resSvc;
+            _tree = tree;
+
+            _tree.AfterExpand += new TreeViewEventHandler(OnNodeAfterExpand);
+            _tree.AfterSelect += new TreeViewEventHandler(OnNodeAfterSelect);
+
+            StartUpdate();
+            foreach (RepositoryFolder folder in GetChildren(null))
+            {
+                var node = CreateNode(folder);
+                _tree.Nodes.Add(node);
+            }
+            EndUpdate();
         }
 
+        void OnNodeAfterSelect(object sender, TreeViewEventArgs e)
+        {
+            RepositoryFolder folder = (RepositoryFolder)e.Node.Tag;
+            SetSelectedFolder(folder);
+        }
+
+        private void SetSelectedFolder(RepositoryFolder folder)
+        {
+            this.SelectedFolder = folder;
+            var handler = this.FolderSelected;
+            if (handler != null)
+                handler(this, EventArgs.Empty);
+        }
+
+        bool IsNodeNotPopulated(TreeNode node)
+        {
+            return node.Nodes.Count == 1 && node.Nodes[0].GetType() == typeof(DummyNode);
+        }
+
+        void OnNodeAfterExpand(object sender, TreeViewEventArgs e)
+        {
+            UpdateNode(e.Node);
+        }
+
+        private void UpdateNode(TreeNode nodeToUpdate)
+        {
+            RepositoryFolder folder = (RepositoryFolder)nodeToUpdate.Tag;
+            if (IsNodeNotPopulated(nodeToUpdate))
+                nodeToUpdate.Nodes.Clear();
+
+            if (folder.HasChildren && nodeToUpdate.Nodes.Count == 0)
+            {
+                StartUpdate();
+                foreach (RepositoryFolder f in GetChildren(folder))
+                {
+                    var node = CreateNode(f);
+                    nodeToUpdate.Nodes.Add(node);
+                }
+                EndUpdate();
+            }
+        }
+
+        const int IDX_SERVER = 0;
+        const int IDX_FOLDER = 1;
+
+        private static TreeNode CreateNode(RepositoryFolder folder)
+        {
+            var node = new TreeNode();
+            node.Name = folder.Name;
+            node.Text = folder.Name;
+            node.Tag = folder;
+            node.ImageIndex = node.SelectedImageIndex = folder.IsRoot ? IDX_SERVER : IDX_FOLDER;
+            node.Nodes.Add(new DummyNode());
+            return node;
+        }
+
         private System.Collections.IEnumerable GetSorted(ResourceList list)
         {
             //Sort them before returning them
@@ -465,19 +552,18 @@
             }
         }
 
-        public System.Collections.IEnumerable GetChildren(TreePath treePath)
+        public System.Collections.IEnumerable GetChildren(RepositoryFolder folder)
         {
-            if (treePath.IsEmpty())
+            if (folder == null)
             {
                 var list = _resSvc.GetRepositoryResources("Library://", 0);
                 return GetSorted(list);
             }
             else
             {
-                var node = treePath.LastNode as RepositoryFolder;
-                if (node.HasChildren)
+                if (folder.HasChildren)
                 {
-                    var list = _resSvc.GetRepositoryResources(node.ResourceId, ResourceTypes.Folder.ToString(), 1, true);
+                    var list = _resSvc.GetRepositoryResources(folder.ResourceId, ResourceTypes.Folder.ToString(), 1, true);
                     return GetSorted(list);
                 }
                 else
@@ -487,18 +573,42 @@
             }
         }
 
-        public bool IsLeaf(TreePath treePath)
+        internal void NavigateTo(string folderId)
         {
-            return !((RepositoryFolder)treePath.LastNode).HasChildren;
+            NavigateTo(folderId, null);
         }
 
-        public event EventHandler<TreeModelEventArgs> NodesChanged;
+        internal void NavigateTo(string folderId, TreeNode currentNode)
+        {
+            TreeNodeCollection nodeList = null;
 
-        public event EventHandler<TreeModelEventArgs> NodesInserted;
+            if (currentNode == null)
+            {
+                nodeList = _tree.Nodes;
+            }
+            else
+            {
+                var folder = (RepositoryFolder)currentNode.Tag;
+                if (folderId.Equals(folder.ResourceId))
+                {
+                    _tree.SelectedNode = currentNode;
+                    SetSelectedFolder(folder);
+                    return;
+                }
+                nodeList = currentNode.Nodes;
+            }
 
-        public event EventHandler<TreeModelEventArgs> NodesRemoved;
-
-        public event EventHandler<TreePathEventArgs> StructureChanged;
+            foreach (TreeNode node in nodeList)
+            {
+                var folder = (RepositoryFolder)node.Tag;
+                if (folderId.StartsWith(folder.ResourceId))
+                {
+                    UpdateNode(node);
+                    node.Expand();
+                    NavigateTo(folderId, node);
+                    break;
+                }
+            }
+        }
     }
-
 }

Modified: sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/Common/ResourcePicker.resx	2010-10-26 08:57:42 UTC (rev 5329)
@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADQ
-        EQAAAk1TRnQBSQFMAgEBCQEAAaABAAGgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        EQAAAk1TRnQBSQFMAgEBCQEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -204,6 +204,60 @@
         AQABAQs=
 </value>
   </data>
+  <metadata name="folderImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>137, 17</value>
+  </metadata>
+  <data name="folderImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
+    <value>
+        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
+        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
+        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA0
+        CgAAAk1TRnQBSQFMAgEBAgEAAQgBAAEIAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
+        AwABEAMAAQEBAAEgBgABEBYAAwcBCgMSARgDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMT
+        ARoDEwEaAxIBGAMIAQvIAAMOARMDMgFnAzABpAMwAaQDMAGkAzABpAMwAaQDMAGkAzABpAMwAaQDMAGk
+        AzABpAMyAWgDDwEVBAADBAEGAxABFgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMT
+        ARoDEwEaAxMBGgMQARYDBAEGiAADGgElAzUBjgOGAf8DggH/A4IB/wOCAf8DggH/A4IB/wOCAf8DhgH/
+        AzUBjgMaASUIAAEzAUoBVgGRASgBWwF2Ab0BKAFbAXYBvQEoAVsBdgG9ASgBWwF2Ab0BKAFbAXYBvQEo
+        AVsBdgG9ASgBWwF2Ab0BKAFbAXYBvQEoAVsBdgG9ASgBWwF2Ab0BKAFbAXYBvQEoAVsBdgG9ASgBWwF2
+        Ab0BKAFbAXYBvQEzAUoBVgGRjAADNAGTA2wB/wNoAf8DaAH/A2gB/wNoAf8DaAH/ATIBzAEyAf8DbAH/
+        AzQBkwwAASwBXgF2AbABhgHPAfAB/wGCAcsB7QH/AYIBywHtAf8BggHLAe0B/wGCAcsB7QH/AYIBywHt
+        Af8BggHLAe0B/wGCAcsB7QH/AYIBywHtAf8BggHLAe0B/wGCAcsB7QH/AYIBywHtAf8BggHLAe0B/wGG
+        Ac8B8AH/ASwBXgF2AbCMAAMvAagDVAH/A1QB/wNUAf8DVAH/A1QB/wNUAf8DVAH/A1QB/wMvAagMAAEw
+        AV4BdQGiAYYBzwHuAf8BfAHIAegB/wF8AcgB6AH/AXwByAHoAf8BfAHIAegB/wF8AcgB6AH/AXwByAHo
+        Af8BfAHIAegB/wF8AcgB6AH/AXwByAHoAf8BfAHIAegB/wF8AcgB6AH/AXwByAHoAf8BhgHPAe4B/wEw
+        AV4BdQGijAADPAF+A8cB/wO9Af8DvQH/A70B/wO9Af8DvQH/A70B/wPHAf8DPAF+DAABMQFdAXMBnQGK
+        AdMB8AH/AYIBzAHrAf8BggHMAesB/wGCAcwB6wH/AYIBzAHrAf8BggHMAesB/wGCAcwB6wH/AYIBzAHr
+        Af8BggHMAesB/wGCAcwB6wH/AYIBzAHrAf8BggHMAesB/wGCAcwB6wH/AYoB0wHwAf8BMQFdAXMBnYwA
+        Az8BeAPKAf8DwAH/A8AB/wPAAf8DwAH/A8AB/wPSAf8DygH/Az8BeAwAATIBXQFyAZkBjwHXAfIB/wGH
+        AdAB7QH/AYcB0AHtAf8BhwHQAe0B/wGHAdAB7QH/AYcB0AHtAf8BhwHQAe0B/wGHAdAB7QH/AYcB0AHt
+        Af8BhwHQAe0B/wGHAdAB7QH/AYcB0AHtAf8BhwHQAe0B/wGPAdcB8gH/ATIBXQFyAZmMAAM/AXUDzQH/
+        A8MB/wPDAf8DwwH/A8MB/wPDAf8DmQH/A80B/wM/AXUMAAEzAV0BcQGVAZQB2wH0Af8BjQHVAfAB/wGN
+        AdUB8AH/AY0B1QHwAf8BjQHVAfAB/wGNAdUB8AH/AY0B1QHwAf8BjQHVAfAB/wGNAdUB8AH/AY0B1QHw
+        Af8BjQHVAfAB/wGNAdUB8AH/AY0B1QHwAf8BlAHbAfQB/wEzAV0BcQGVjAADQAFzA9YB/wPRAf8D0QH/
+        A9EB/wPRAf8D0QH/A9EB/wPWAf8DQAFzDAABMwFcAXABkgGZAeAB9gH/AZIB2gHzAf8BkgHaAfMB/wGS
+        AdoB8wH/AZIB2gHzAf8BkgHaAfMB/wGSAdoB8wH/AZIB2gHzAf8BkgHaAfMB/wGSAdoB8wH/AZIB2gHz
+        Af8BkgHaAfMB/wGSAdoB8wH/AZkB4AH2Af8BMwFcAXABkowAA0ABcQO3Af8DuwH/A7sB/wO7Af8DuwH/
+        A7sB/wO7Af8DtwH/A0ABcQwAATQBXAFuAY4BnwHlAfkB/wGYAd8B9gH/AZgB3wH2Af8BmAHfAfYB/wGY
+        Ad8B9gH/AZgB3wH2Af8BmAHfAfYB/wGYAd8B9gH/AZgB3wH2Af8BmAHfAfYB/wGYAd8B9gH/AZgB3wH2
+        Af8BmAHfAfYB/wGfAeUB+QH/ATQBXAFuAY6MAANAAW8D2QH/A88B/wPPAf8DzwH/A88B/wPPAf8DzwH/
+        A9kB/wNAAW8MAAE0AVoBbQGLAaMB6QH7Af8BnQHjAfkB/wGdAeMB+QH/AZ0B4wH5Af8BnQHjAfkB/wGd
+        AeMB+QH/AZ0B4wH5Af8BowHpAfoB/wGjAekB+gH/AaMB6QH6Af8BowHpAfoB/wGjAekB+gH/AaMB6QH6
+        Af8BpgHsAfsB/wE0AVoBbQGLjAADQAFtA+EB/wPcAf8D3AH/A9wB/wPcAf8D3AH/A9wB/wPhAf8DQAFt
+        DAABNAFZAWwBiAGoAe0B/QH/AaIB5wH7Af8BogHnAfsB/wGiAecB+wH/AaIB5wH7Af8BogHnAfsB/wGr
+        AfAB/QH/AYUBygHmAf8BdwG8Ad4B/wF3AbwB3gH/AXcBvAHeAf8BdwG8Ad4B/wF3AbwB3gH/AXcBvAHe
+        Af8BNAFZAWwBiIwAA0ABawPBAf8DxgH/A8YB/wPGAf8DxgH/A8YB/wPGAf8DwQH/A0ABawwAATQBWAFr
+        AYUBrgHzAv8BqwHwAf4B/wGrAfAB/gH/AasB8AH+Af8BqwHwAf4B/wGuAfMC/wGJAc0B6QH/AYkBzQHp
+        Af8BqwHwAf4B/wGrAfAB/gH/AasB8AH+Af8BqwHwAf4B/wGrAfAB/gH/Aa4B8wL/ATQBWAFrAYWMAANA
+        AWkD4wH/A9oB/wPaAf8D2gH/A9oB/wPaAf8D2gH/A+MB/wNAAWkMAAEyAUYBUAFjATQBWAFqAYMBNAFY
+        AWoBgwE0AVgBagGDATQBWAFqAYMBNAFYAWoBgwE0AVgBagGDATQBWAFqAYMC/gH9Af8C+AHzAf8C8AHm
+        Af8C6QHbAf8B/gHJAUAB/wH0AbYBLQH/ATQBWAFqAYMBMgFGAVABY4wAA0ABaAPqAf8D5QH/A+UB/wPl
+        Af8D5QH/A+UB/wPlAf8D6gH/A0ABaCgAAR8BIwElAS4BNAFXAWgBgQE0AVcBaAGBATQBVwFoAYEBNAFX
+        AWgBgQE0AVcBaAGBATQBVwFoAYEBHwEjASUBLpAAAzQBTQNAAWcDQAFnA0ABZwNAAWcDQAFnA0ABZwNA
+        AWcDQAFnAzQBTcwAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/8BAAGAAQEC/wQA
+        AYABAQYAAcABAwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYAAeABBwYA
+        AeABBwYAAeABBwYAAeABBwYAAeABBwH+AQEEAAHgAQcC/wQACw==
+</value>
+  </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

Modified: sandbox/maestro-3.0/Maestro.Editors/IEditorService.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/IEditorService.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/IEditorService.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -65,6 +65,10 @@
         /// </summary>
         string SessionID { get; }
         /// <summary>
+        /// Gets the suggested save folder for a "save as" operation
+        /// </summary>
+        string SuggestedSaveFolder { get; set; }
+        /// <summary>
         /// Registers a custom notifier
         /// </summary>
         /// <param name="irc"></param>

Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.Designer.cs	2010-10-26 08:57:42 UTC (rev 5329)
@@ -1647,6 +1647,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Not a folder: {0}.
+        /// </summary>
+        internal static string NotAFolder {
+            get {
+                return ResourceManager.GetString("NotAFolder", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to You must select at least one type.
         /// </summary>
         internal static string NoTypesSelected {

Modified: sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx
===================================================================
--- sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx	2010-10-26 07:59:20 UTC (rev 5328)
+++ sandbox/maestro-3.0/Maestro.Editors/Properties/Resources.resx	2010-10-26 08:57:42 UTC (rev 5329)
@@ -986,4 +986,7 @@
   <data name="NoSiteService" xml:space="preserve">
     <value>No site service available</value>
   </data>
+  <data name="NotAFolder" xml:space="preserve">
+    <value>Not a folder: {0}</value>
+  </data>
 </root>
\ No newline at end of file



More information about the mapguide-commits mailing list