[mapguide-commits] r5688 - in trunk/Tools/Maestro/Maestro.Base: Editor UI/Preferences

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Apr 7 09:36:46 EDT 2011


Author: jng
Date: 2011-04-07 06:36:46 -0700 (Thu, 07 Apr 2011)
New Revision: 5688

Modified:
   trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs
   trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs
   trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.Designer.cs
   trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.cs
   trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.resx
Log:
#1655: Add preference to enable/disable validation on save. Disabling validation on save is more performant, but will most likely let many validation errors slip through for new users (though validation later on can always catch them). As a result this configuration value defaults to true.


Modified: trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs	2011-04-06 16:44:54 UTC (rev 5687)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/EditorContentBase.cs	2011-04-07 13:36:46 UTC (rev 5688)
@@ -30,6 +30,7 @@
 using ICSharpCode.Core;
 using OSGeo.MapGuide.MaestroAPI.Resource.Validation;
 using Maestro.Base.UI;
+using Maestro.Base.UI.Preferences;
 
 namespace Maestro.Base.Editor
 {
@@ -105,16 +106,25 @@
             _svc.UpdateResourceContent(GetXmlContent());
             try
             {
-                var errors = new List<ValidationIssue>(ValidateEditedResource()).ToArray();
-                if (errors.Length > 0)
+                var validate = PropertyService.Get(ConfigProperties.ValidateOnSave, true);
+                if (validate)
                 {
-                    MessageService.ShowError(Properties.Resources.FixErrorsBeforeSaving);
-                    ValidationResultsDialog diag = new ValidationResultsDialog(this.Resource.ResourceID, errors);
-                    diag.ShowDialog(Workbench.Instance);
-                    e.Cancel = true;
+                    var errors = new List<ValidationIssue>(ValidateEditedResource()).ToArray();
+                    if (errors.Length > 0)
+                    {
+                        MessageService.ShowError(Properties.Resources.FixErrorsBeforeSaving);
+                        ValidationResultsDialog diag = new ValidationResultsDialog(this.Resource.ResourceID, errors);
+                        diag.ShowDialog(Workbench.Instance);
+                        e.Cancel = true;
+                    }
+                    else
+                    {
+                        e.Cancel = false;
+                    }
                 }
                 else
                 {
+                    LoggingService.Info("Skipping validation on save");
                     e.Cancel = false;
                 }
             }

Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs	2011-04-06 16:44:54 UTC (rev 5687)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/ConfigProperties.cs	2011-04-07 13:36:46 UTC (rev 5688)
@@ -37,6 +37,7 @@
         public const string DirtyColor = "General.DirtyColor";
         public const string MgCookerPath = "General.MgCookerPath";
         public const string LocalFsPreviewPath = "General.LocalFsPreviewPath";
+        public const string ValidateOnSave = "General.ValidateResourceOnSave";
 
         internal static void ApplyDefaults()
         {
@@ -48,6 +49,7 @@
             Props.Set(ConfigProperties.DirtyColor, Color.Pink);
             Props.Set(ConfigProperties.MgCookerPath, Path.Combine(FileUtility.ApplicationRootPath, "MgCooker.exe"));
             Props.Set(ConfigProperties.LocalFsPreviewPath, Path.Combine(FileUtility.ApplicationRootPath, "MaestroFsPreview.exe"));
+            Props.Set(ConfigProperties.ValidateOnSave, true);
         }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.Designer.cs	2011-04-06 16:44:54 UTC (rev 5687)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.Designer.cs	2011-04-07 13:36:46 UTC (rev 5688)
@@ -50,9 +50,12 @@
             this.cmbOpenedColor = new Maestro.Editors.Common.ColorComboBox();
             this.label6 = new System.Windows.Forms.Label();
             this.label5 = new System.Windows.Forms.Label();
+            this.groupBox4 = new System.Windows.Forms.GroupBox();
+            this.chkValidateOnSave = new System.Windows.Forms.CheckBox();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
+            this.groupBox4.SuspendLayout();
             this.SuspendLayout();
             // 
             // label1
@@ -192,9 +195,23 @@
             resources.ApplyResources(this.label5, "label5");
             this.label5.Name = "label5";
             // 
+            // groupBox4
+            // 
+            this.groupBox4.Controls.Add(this.chkValidateOnSave);
+            resources.ApplyResources(this.groupBox4, "groupBox4");
+            this.groupBox4.Name = "groupBox4";
+            this.groupBox4.TabStop = false;
+            // 
+            // chkValidateOnSave
+            // 
+            resources.ApplyResources(this.chkValidateOnSave, "chkValidateOnSave");
+            this.chkValidateOnSave.Name = "chkValidateOnSave";
+            this.chkValidateOnSave.UseVisualStyleBackColor = true;
+            // 
             // GeneralPreferencesCtrl
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+            this.Controls.Add(this.groupBox4);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
@@ -212,6 +229,8 @@
             this.groupBox2.PerformLayout();
             this.groupBox3.ResumeLayout(false);
             this.groupBox3.PerformLayout();
+            this.groupBox4.ResumeLayout(false);
+            this.groupBox4.PerformLayout();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -240,5 +259,7 @@
         private System.Windows.Forms.Label label5;
         private Maestro.Editors.Common.ColorComboBox cmbModifiedColor;
         private Maestro.Editors.Common.ColorComboBox cmbOpenedColor;
+        private System.Windows.Forms.GroupBox groupBox4;
+        private System.Windows.Forms.CheckBox chkValidateOnSave;
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.cs	2011-04-06 16:44:54 UTC (rev 5687)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.cs	2011-04-07 13:36:46 UTC (rev 5688)
@@ -56,6 +56,8 @@
             chkMessages.Checked = msg;
             var outb = Props.Get(ConfigProperties.ShowOutboundRequests, true);
             chkOutbound.Checked = outb;
+            var validate = Props.Get(ConfigProperties.ValidateOnSave, true);
+            chkValidateOnSave.Checked = validate;
 
             txtFsPreview.Text = Props.Get(ConfigProperties.LocalFsPreviewPath, "");
             txtMgCooker.Text = Props.Get(ConfigProperties.MgCookerPath, "");
@@ -98,6 +100,7 @@
             Apply(ConfigProperties.LocalFsPreviewPath, txtFsPreview.Text);
             Apply(ConfigProperties.OpenColor, (Color)cmbOpenedColor.CurrentColor);
             Apply(ConfigProperties.DirtyColor, (Color)cmbModifiedColor.CurrentColor);
+            Apply(ConfigProperties.ValidateOnSave, chkValidateOnSave.Checked);
 
             //These changes require restart
             if (Apply(ConfigProperties.ShowMessages, chkMessages.Checked ? "True" : "False"))

Modified: trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.resx	2011-04-06 16:44:54 UTC (rev 5687)
+++ trunk/Tools/Maestro/Maestro.Base/UI/Preferences/GeneralPreferencesCtrl.resx	2011-04-07 13:36:46 UTC (rev 5688)
@@ -123,7 +123,7 @@
   </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>13, 16</value>
+    <value>13, 14</value>
   </data>
   <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
     <value>182, 13</value>
@@ -144,13 +144,13 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
-    <value>8</value>
+    <value>9</value>
   </data>
   <data name="rdAjax.AutoSize" type="System.Boolean, mscorlib">
     <value>True</value>
   </data>
   <data name="rdAjax.Location" type="System.Drawing.Point, System.Drawing">
-    <value>226, 14</value>
+    <value>226, 12</value>
   </data>
   <data name="rdAjax.Size" type="System.Drawing.Size, System.Drawing">
     <value>86, 17</value>
@@ -171,7 +171,7 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;rdAjax.ZOrder" xml:space="preserve">
-    <value>7</value>
+    <value>8</value>
   </data>
   <data name="rdFusion.AutoSize" type="System.Boolean, mscorlib">
     <value>True</value>
@@ -180,7 +180,7 @@
     <value>False</value>
   </data>
   <data name="rdFusion.Location" type="System.Drawing.Point, System.Drawing">
-    <value>226, 38</value>
+    <value>318, 12</value>
   </data>
   <data name="rdFusion.Size" type="System.Drawing.Size, System.Drawing">
     <value>56, 17</value>
@@ -201,13 +201,13 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;rdFusion.ZOrder" xml:space="preserve">
-    <value>6</value>
+    <value>7</value>
   </data>
   <data name="label2.AutoSize" type="System.Boolean, mscorlib">
     <value>True</value>
   </data>
   <data name="label2.Location" type="System.Drawing.Point, System.Drawing">
-    <value>13, 83</value>
+    <value>13, 42</value>
   </data>
   <data name="label2.Size" type="System.Drawing.Size, System.Drawing">
     <value>101, 13</value>
@@ -228,14 +228,14 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
-    <value>5</value>
+    <value>6</value>
   </data>
   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="txtTemplatePath.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Left, Right</value>
   </data>
   <data name="txtTemplatePath.Location" type="System.Drawing.Point, System.Drawing">
-    <value>120, 80</value>
+    <value>120, 39</value>
   </data>
   <data name="txtTemplatePath.Size" type="System.Drawing.Size, System.Drawing">
     <value>291, 20</value>
@@ -253,13 +253,13 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;txtTemplatePath.ZOrder" xml:space="preserve">
-    <value>4</value>
+    <value>5</value>
   </data>
   <data name="btnBrowseTemplatePath.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Right</value>
   </data>
   <data name="btnBrowseTemplatePath.Location" type="System.Drawing.Point, System.Drawing">
-    <value>417, 78</value>
+    <value>417, 37</value>
   </data>
   <data name="btnBrowseTemplatePath.Size" type="System.Drawing.Size, System.Drawing">
     <value>25, 23</value>
@@ -280,7 +280,7 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;btnBrowseTemplatePath.ZOrder" xml:space="preserve">
-    <value>3</value>
+    <value>4</value>
   </data>
   <data name="groupBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Left, Right</value>
@@ -289,7 +289,7 @@
     <value>True</value>
   </data>
   <data name="chkOutbound.Location" type="System.Drawing.Point, System.Drawing">
-    <value>116, 19</value>
+    <value>115, 19</value>
   </data>
   <data name="chkOutbound.Size" type="System.Drawing.Size, System.Drawing">
     <value>121, 17</value>
@@ -316,7 +316,7 @@
     <value>True</value>
   </data>
   <data name="chkMessages.Location" type="System.Drawing.Point, System.Drawing">
-    <value>20, 19</value>
+    <value>19, 19</value>
   </data>
   <data name="chkMessages.Size" type="System.Drawing.Size, System.Drawing">
     <value>74, 17</value>
@@ -340,7 +340,7 @@
     <value>1</value>
   </data>
   <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
-    <value>16, 107</value>
+    <value>16, 127</value>
   </data>
   <data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
     <value>426, 50</value>
@@ -361,7 +361,7 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
-    <value>2</value>
+    <value>3</value>
   </data>
   <data name="groupBox2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Left, Right</value>
@@ -523,7 +523,7 @@
     <value>5</value>
   </data>
   <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
-    <value>16, 246</value>
+    <value>16, 266</value>
   </data>
   <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
     <value>426, 78</value>
@@ -544,7 +544,7 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
-    <value>1</value>
+    <value>2</value>
   </data>
   <data name="groupBox3.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
     <value>Top, Left, Right</value>
@@ -562,7 +562,7 @@
     <value>cmbModifiedColor</value>
   </data>
   <data name="&gt;&gt;cmbModifiedColor.Type" xml:space="preserve">
-    <value>Maestro.Editors.Common.ColorComboBox, Maestro.Editors, Version=3.0.0.5334, Culture=neutral, PublicKeyToken=null</value>
+    <value>Maestro.Editors.Common.ColorComboBox, Maestro.Editors, Version=3.0.0.5676, Culture=neutral, PublicKeyToken=null</value>
   </data>
   <data name="&gt;&gt;cmbModifiedColor.Parent" xml:space="preserve">
     <value>groupBox3</value>
@@ -583,7 +583,7 @@
     <value>cmbOpenedColor</value>
   </data>
   <data name="&gt;&gt;cmbOpenedColor.Type" xml:space="preserve">
-    <value>Maestro.Editors.Common.ColorComboBox, Maestro.Editors, Version=3.0.0.5334, Culture=neutral, PublicKeyToken=null</value>
+    <value>Maestro.Editors.Common.ColorComboBox, Maestro.Editors, Version=3.0.0.5676, Culture=neutral, PublicKeyToken=null</value>
   </data>
   <data name="&gt;&gt;cmbOpenedColor.Parent" xml:space="preserve">
     <value>groupBox3</value>
@@ -646,7 +646,7 @@
     <value>3</value>
   </data>
   <data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing">
-    <value>16, 163</value>
+    <value>16, 183</value>
   </data>
   <data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing">
     <value>426, 77</value>
@@ -667,13 +667,67 @@
     <value>$this</value>
   </data>
   <data name="&gt;&gt;groupBox3.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="chkValidateOnSave.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="chkValidateOnSave.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+    <value>NoControl</value>
+  </data>
+  <data name="chkValidateOnSave.Location" type="System.Drawing.Point, System.Drawing">
+    <value>19, 19</value>
+  </data>
+  <data name="chkValidateOnSave.Size" type="System.Drawing.Size, System.Drawing">
+    <value>163, 17</value>
+  </data>
+  <data name="chkValidateOnSave.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="chkValidateOnSave.Text" xml:space="preserve">
+    <value>Validate Resources On Save</value>
+  </data>
+  <data name="&gt;&gt;chkValidateOnSave.Name" xml:space="preserve">
+    <value>chkValidateOnSave</value>
+  </data>
+  <data name="&gt;&gt;chkValidateOnSave.Type" xml:space="preserve">
+    <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="&gt;&gt;chkValidateOnSave.Parent" xml:space="preserve">
+    <value>groupBox4</value>
+  </data>
+  <data name="&gt;&gt;chkValidateOnSave.ZOrder" xml:space="preserve">
     <value>0</value>
   </data>
+  <data name="groupBox4.Location" type="System.Drawing.Point, System.Drawing">
+    <value>16, 71</value>
+  </data>
+  <data name="groupBox4.Size" type="System.Drawing.Size, System.Drawing">
+    <value>426, 50</value>
+  </data>
+  <data name="groupBox4.TabIndex" type="System.Int32, mscorlib">
+    <value>9</value>
+  </data>
+  <data name="groupBox4.Text" xml:space="preserve">
+    <value>Editing</value>
+  </data>
+  <data name="&gt;&gt;groupBox4.Name" xml:space="preserve">
+    <value>groupBox4</value>
+  </data>
+  <data name="&gt;&gt;groupBox4.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="&gt;&gt;groupBox4.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name="&gt;&gt;groupBox4.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.Size" type="System.Drawing.Size, System.Drawing">
-    <value>459, 336</value>
+    <value>459, 351</value>
   </data>
   <data name="&gt;&gt;$this.Name" xml:space="preserve">
     <value>GeneralPreferencesCtrl</value>



More information about the mapguide-commits mailing list