[mapguide-commits] r7562 - in trunk/Tools/Maestro/Maestro.Editors: . LayerDefinition/Vector/Scales

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jun 5 06:35:02 PDT 2013


Author: jng
Date: 2013-06-05 06:35:01 -0700 (Wed, 05 Jun 2013)
New Revision: 7562

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/Strings.resx
Log:
#2282: Guard against NREs when trying to edit styles for a layer that has no feature class assigned.

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs	2013-06-05 13:24:42 UTC (rev 7561)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ConditionListButtons.cs	2013-06-05 13:35:01 UTC (rev 7562)
@@ -180,7 +180,17 @@
 
                 ILayerDefinition layer = (ILayerDefinition)m_owner.Editor.GetEditedResource();
                 IVectorLayerDefinition vl = (IVectorLayerDefinition)layer.SubLayer;
+                if (string.IsNullOrEmpty(vl.FeatureName))
+                {
+                    MessageBox.Show(Strings.NoFeatureClassAssigned);
+                    return;
+                }
                 var cls = m_owner.Editor.FeatureService.GetClassDefinition(vl.ResourceId, vl.FeatureName);
+                if (cls == null)
+                {
+                    MessageBox.Show(string.Format(Strings.FeatureClassNotFound, vl.FeatureName));
+                    return;
+                }
                 ThemeCreator dlg = new ThemeCreator(
                     m_owner.Editor, 
                     layer,

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs	2013-06-05 13:24:42 UTC (rev 7561)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/ItemStyle.cs	2013-06-05 13:35:01 UTC (rev 7562)
@@ -171,6 +171,11 @@
         private void EditButton_Click(object sender, EventArgs e)
         {
             UserControl uc = null;
+            if (m_owner.SelectedClass == null)
+            {
+                MessageBox.Show(Strings.NoFeatureClassAssigned);
+                return;
+            }
             ILayerStylePreviewable prev = new LayerStylePreviewable(m_owner.EditorService.EditedResourceID,
                                                                     this.PreviewScale,
                                                                     80,

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2013-06-05 13:24:42 UTC (rev 7561)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs	2013-06-05 13:35:01 UTC (rev 7562)
@@ -646,6 +646,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Feature Class not found: {0}.
+        /// </summary>
+        internal static string FeatureClassNotFound {
+            get {
+                return ResourceManager.GetString("FeatureClassNotFound", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to This feature is not implemented yet.
         /// </summary>
         internal static string FeatureNotImplemented {
@@ -1544,6 +1553,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to No Feature Class assigned.
+        /// </summary>
+        internal static string NoFeatureClassAssigned {
+            get {
+                return ResourceManager.GetString("NoFeatureClassAssigned", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to You have not selected a starting folder, do you want to back up the entire site?.
         /// </summary>
         internal static string NoFolderSelected {

Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2013-06-05 13:24:42 UTC (rev 7561)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx	2013-06-05 13:35:01 UTC (rev 7562)
@@ -1506,4 +1506,10 @@
   <data name="NoRegisteredPreviewerForProvider" xml:space="preserve">
     <value>No registered previewer for connection: {0}</value>
   </data>
+  <data name="FeatureClassNotFound" xml:space="preserve">
+    <value>Feature Class not found: {0}</value>
+  </data>
+  <data name="NoFeatureClassAssigned" xml:space="preserve">
+    <value>No Feature Class assigned</value>
+  </data>
 </root>
\ No newline at end of file



More information about the mapguide-commits mailing list