#4617 Disallow creating ensemble curve sets if you have no ensemble

This commit is contained in:
Gaute Lindkvist
2019-08-22 13:05:39 +02:00
parent 5b0d77f19a
commit 84c1442af7

View File

@@ -100,7 +100,17 @@ void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSum
//--------------------------------------------------------------------------------------------------
bool RicNewSummaryEnsembleCurveSetFeature::isCommandEnabled()
{
return (selectedSummaryPlot());
bool summaryPlotSelected = selectedSummaryPlot();
if (summaryPlotSelected)
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
if (!project->summaryGroups().empty())
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
@@ -114,6 +124,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
RimSummaryPlot* plot = selectedSummaryPlot();
if (plot)
{
CVF_ASSERT(!project->summaryGroups().empty());
auto ensemble = project->summaryGroups().back();
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(ensemble);