Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs
===================================================================
diff -u -r010563d8e4e0def22c9d9cf93819b6945c5f6c2f -r7991173ea78ba4c0fb75bacdb56a2136fe27099e
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 010563d8e4e0def22c9d9cf93819b6945c5f6c2f)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 7991173ea78ba4c0fb75bacdb56a2136fe27099e)
@@ -314,18 +314,10 @@
object parentData,
TreeViewControl treeViewControl)
{
- StrictContextMenuItem calculateAllItem = CreateCalculateAllItem(nodeData.FailureMechanism, nodeData.AssessmentSection);
-
- if (calculateAllItem.Enabled && !nodeData.FailureMechanism.DuneLocations.Any())
- {
- calculateAllItem.Enabled = false;
- calculateAllItem.ToolTipText = Resources.DuneErosionPlugin_DuneLocationCalculationsGroupContextMenuStrip_No_calculatable_locations_present;
- }
-
return Gui.Get(nodeData, treeViewControl)
.AddExportItem()
.AddSeparator()
- .AddCustomItem(calculateAllItem)
+ .AddCustomItem(CreateCalculateAllItem(nodeData.FailureMechanism, nodeData.AssessmentSection))
.AddSeparator()
.AddCollapseAllItem()
.AddExpandAllItem()
@@ -443,6 +435,11 @@
string validationText = HydraulicBoundaryDatabaseConnectionValidator.Validate(assessmentSection.HydraulicBoundaryDatabase);
+ if (string.IsNullOrEmpty(validationText) && !failureMechanism.DuneLocations.Any())
+ {
+ validationText = Resources.DuneErosionPlugin_CreateCalculateAllItem_No_calculatable_locations_present;
+ }
+
if (!string.IsNullOrEmpty(validationText))
{
calculateAllItem.Enabled = false;
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r010563d8e4e0def22c9d9cf93819b6945c5f6c2f -r7991173ea78ba4c0fb75bacdb56a2136fe27099e
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 010563d8e4e0def22c9d9cf93819b6945c5f6c2f)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7991173ea78ba4c0fb75bacdb56a2136fe27099e)
@@ -82,21 +82,20 @@
}
///
- /// Looks up a localized string similar to Alle hydraulische randvoorwaarden berekenen..
+ /// Looks up a localized string similar to Geen van de locaties is geschikt voor een hydraulische belastingen berekening..
///
- internal static string DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_All_ToolTip {
+ internal static string DuneErosionPlugin_CreateCalculateAllItem_No_calculatable_locations_present {
get {
- return ResourceManager.GetString("DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_All_ToolTip", resourceCulture);
+ return ResourceManager.GetString("DuneErosionPlugin_CreateCalculateAllItem_No_calculatable_locations_present", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Geen van de locaties is geschikt voor een hydraulische belastingen berekening..
+ /// Looks up a localized string similar to Alle hydraulische randvoorwaarden berekenen..
///
- internal static string DuneErosionPlugin_DuneLocationCalculationsGroupContextMenuStrip_No_calculatable_locations_present {
+ internal static string DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_All_ToolTip {
get {
- return ResourceManager.GetString("DuneErosionPlugin_DuneLocationCalculationsGroupContextMenuStrip_No_calculatable_l" +
- "ocations_present", resourceCulture);
+ return ResourceManager.GetString("DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_All_ToolTip", resourceCulture);
}
}
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx
===================================================================
diff -u -r010563d8e4e0def22c9d9cf93819b6945c5f6c2f -r7991173ea78ba4c0fb75bacdb56a2136fe27099e
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 010563d8e4e0def22c9d9cf93819b6945c5f6c2f)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 7991173ea78ba4c0fb75bacdb56a2136fe27099e)
@@ -126,7 +126,7 @@
bnd
-
+
Geen van de locaties is geschikt voor een hydraulische belastingen berekening.
\ No newline at end of file
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -re63b47a8282dfc596cc2dbe89bd8ffb501b0b326 -r7991173ea78ba4c0fb75bacdb56a2136fe27099e
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismContextTreeNodeInfoTest.cs) (revision e63b47a8282dfc596cc2dbe89bd8ffb501b0b326)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismContextTreeNodeInfoTest.cs) (revision 7991173ea78ba4c0fb75bacdb56a2136fe27099e)
@@ -443,6 +443,49 @@
}
[Test]
+ public void ContextMenuStrip_NoDuneLocationsPresent_ContextMenuItemCalculateAllDisabledAndTooltipSet()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+ var assessmentSection = new AssessmentSectionStub
+ {
+ HydraulicBoundaryDatabase =
+ {
+ FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite")
+ }
+ };
+
+ var failureMechanismContext = new DuneErosionFailureMechanismContext(failureMechanism, assessmentSection);
+
+ var mocks = new MockRepository();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+ gui.Stub(cmp => cmp.Get(failureMechanismContext, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(failureMechanismContext, null, treeViewControl))
+ {
+ // Assert
+ ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex];
+
+ Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text);
+ StringAssert.Contains("Geen van de locaties is geschikt voor een hydraulische belastingen berekening.", contextMenuItem.ToolTipText);
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, contextMenuItem.Image);
+ Assert.IsFalse(contextMenuItem.Enabled);
+ }
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
public void GivenValidCalculations_WhenCalculatingAllFromContextMenu_ThenAllCalculationsScheduled()
{
// Given