[mapguide-commits] r7839 - in trunk/Tools/Maestro: Maestro.Base Maestro.Base/Editor Maestro.Editors/Generic
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Sep 5 02:51:06 PDT 2013
Author: jng
Date: 2013-09-05 02:51:05 -0700 (Thu, 05 Sep 2013)
New Revision: 7839
Modified:
trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Strings.resx
trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.resx
Log:
#2354: Implement ability to re-read XML content from the source resource in the Generic XML editor.
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.Designer.cs 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.Designer.cs 2013-09-05 09:51:05 UTC (rev 7839)
@@ -43,10 +43,12 @@
this.editor.BackgroundColor = System.Drawing.SystemColors.Window;
resources.ApplyResources(this.editor, "editor");
this.editor.Name = "editor";
+ this.editor.SupportsReReadFromSource = true;
this.editor.TextColor = System.Drawing.SystemColors.WindowText;
this.editor.TextFont = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.editor.Validator = null;
this.editor.XmlContent = "";
+ this.editor.RequestReloadFromSource += new System.EventHandler(this.editor_RequestReloadFromSource);
//
// XmlEditor
//
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/XmlEditor.cs 2013-09-05 09:51:05 UTC (rev 7839)
@@ -196,5 +196,22 @@
return Properties.Resources.icon_xmleditor;
}
}
+
+ private void editor_RequestReloadFromSource(object sender, EventArgs e)
+ {
+ if (MessageService.AskQuestion(Strings.ConfirmReloadXmlFromSource))
+ {
+ var resId = this.EditorService.ResourceID;
+ using (var stream = this.EditorService.ResourceService.GetResourceXmlData(resId))
+ {
+ using (var sr = new StreamReader(stream))
+ {
+ var xml = sr.ReadToEnd();
+ editor.XmlContent = xml;
+ MessageService.ShowMessage(Strings.XmlReloadedFromSource);
+ }
+ }
+ }
+ }
}
}
Modified: trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Base/Strings.Designer.cs 2013-09-05 09:51:05 UTC (rev 7839)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18047
+// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -370,6 +370,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Are you sure you want to reload the XML from source? This will discard any un-saved changes you have made..
+ /// </summary>
+ internal static string ConfirmReloadXmlFromSource {
+ get {
+ return ResourceManager.GetString("ConfirmReloadXmlFromSource", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to You are about to reset all preferences to default values. Are you sure you want to do this?.
/// </summary>
internal static string ConfirmResetPrefs {
@@ -2537,6 +2546,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to XML content reloaded from source.
+ /// </summary>
+ internal static string XmlReloadedFromSource {
+ get {
+ return ResourceManager.GetString("XmlReloadedFromSource", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Load this resource into the Site Repository.
/// </summary>
internal static string XmlResHandlerAction {
Modified: trunk/Tools/Maestro/Maestro.Base/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Strings.resx 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Base/Strings.resx 2013-09-05 09:51:05 UTC (rev 7839)
@@ -965,4 +965,10 @@
<data name="Label_ResourceID" xml:space="preserve">
<value>Resource ID:</value>
</data>
+ <data name="ConfirmReloadXmlFromSource" xml:space="preserve">
+ <value>Are you sure you want to reload the XML from source? This will discard any un-saved changes you have made.</value>
+ </data>
+ <data name="XmlReloadedFromSource" xml:space="preserve">
+ <value>XML content reloaded from source</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.Designer.cs 2013-09-05 09:51:05 UTC (rev 7839)
@@ -43,6 +43,7 @@
this.lblCursorPos = new System.Windows.Forms.ToolStripLabel();
this.btnFind = new System.Windows.Forms.ToolStripButton();
this.btnFindAndReplace = new System.Windows.Forms.ToolStripButton();
+ this.btnReRead = new System.Windows.Forms.ToolStripButton();
this.resDataCtrl = new Maestro.Editors.Generic.ResourceDataPanel();
this.nodeNumericUpDown1 = new Aga.Controls.Tree.NodeControls.NodeNumericUpDown();
this.txtXmlContent = new Maestro.Editors.Generic.XmlTextEditorControl();
@@ -71,7 +72,8 @@
this.toolStripSeparator3,
this.lblCursorPos,
this.btnFind,
- this.btnFindAndReplace});
+ this.btnFindAndReplace,
+ this.btnReRead});
resources.ApplyResources(this.toolStrip1, "toolStrip1");
this.toolStrip1.Name = "toolStrip1";
//
@@ -158,6 +160,13 @@
this.btnFindAndReplace.Name = "btnFindAndReplace";
this.btnFindAndReplace.Click += new System.EventHandler(this.btnFindAndReplace_Click);
//
+ // btnReRead
+ //
+ this.btnReRead.Image = global::Maestro.Editors.Properties.Resources.arrow_circle_135;
+ resources.ApplyResources(this.btnReRead, "btnReRead");
+ this.btnReRead.Name = "btnReRead";
+ this.btnReRead.Click += new System.EventHandler(this.btnReRead_Click);
+ //
// resDataCtrl
//
this.resDataCtrl.ContentBackgroundColor = System.Drawing.SystemColors.Control;
@@ -284,5 +293,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem findReplaceToolStripMenuItem;
+ private System.Windows.Forms.ToolStripButton btnReRead;
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.cs 2013-09-05 09:51:05 UTC (rev 7839)
@@ -404,6 +404,32 @@
{
DoFindReplace();
}
+
+ /// <summary>
+ /// Gets or sets whether this editor can support reloading XML content
+ /// from a source resource. If true, subscribe to the
+ /// <see cref="E:Maestro.Editors.Generic.XmlEditorCtrl.RequestReloadFromSource"/>
+ /// event to handle this particular action
+ /// </summary>
+ public bool SupportsReReadFromSource
+ {
+ get { return btnReRead.Enabled; }
+ set { btnReRead.Enabled = value; }
+ }
+
+ /// <summary>
+ /// Raised if the user wishes to reload the XML content from source. To handle this
+ /// action, read the XML content from the requested source resource and load it into
+ /// this editor
+ /// </summary>
+ public event EventHandler RequestReloadFromSource;
+
+ private void btnReRead_Click(object sender, EventArgs e)
+ {
+ var h = this.RequestReloadFromSource;
+ if (h != null)
+ h(this, EventArgs.Empty);
+ }
}
/// <summary>
Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.resx 2013-09-04 14:09:13 UTC (rev 7838)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorCtrl.resx 2013-09-05 09:51:05 UTC (rev 7839)
@@ -205,6 +205,18 @@
<data name="btnFindAndReplace.Text" xml:space="preserve">
<value>Find/Replace</value>
</data>
+ <data name="btnReRead.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnReRead.Size" type="System.Drawing.Size, System.Drawing">
+ <value>133, 22</value>
+ </data>
+ <data name="btnReRead.Text" xml:space="preserve">
+ <value>Reload From Source</value>
+ </data>
+ <data name="btnReRead.ToolTipText" xml:space="preserve">
+ <value>Re-loads the XML content from the source resource ID</value>
+ </data>
<data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
@@ -405,6 +417,12 @@
<data name=">>btnFindAndReplace.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name=">>btnReRead.Name" xml:space="preserve">
+ <value>btnReRead</value>
+ </data>
+ <data name=">>btnReRead.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name=">>nodeNumericUpDown1.Name" xml:space="preserve">
<value>nodeNumericUpDown1</value>
</data>
More information about the mapguide-commits
mailing list