diff --git a/ApplicationCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationCode/Application/Tools/RiaSummaryTools.cpp index 5d6af6a70f..b77ce5fcf9 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationCode/Application/Tools/RiaSummaryTools.cpp @@ -22,8 +22,10 @@ #include "RifEclipseSummaryAddress.h" +#include "RimOilField.h" #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" #include "RimSummaryPlot.h" @@ -42,6 +44,17 @@ RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection() return project->mainPlotCollection()->summaryPlotCollection(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection() +{ + RimProject* project = RiaApplication::instance()->project(); + RimSummaryCaseMainCollection* summaryCaseMainCollection = project->activeOilField()->summaryCaseMainCollection(); + CVF_ASSERT(summaryCaseMainCollection); + return summaryCaseMainCollection; +} + //-------------------------------------------------------------------------------------------------- /// Update the summary curves referencing this curve, as the curve is identified by the name //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/Tools/RiaSummaryTools.h b/ApplicationCode/Application/Tools/RiaSummaryTools.h index 92271a4bbc..1a3cdc510a 100644 --- a/ApplicationCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationCode/Application/Tools/RiaSummaryTools.h @@ -22,6 +22,7 @@ class RimSummaryPlotCollection; class RimSummaryPlot; class RimSummaryCrossPlot; class RimSummaryCrossPlotCollection; +class RimSummaryCaseMainCollection; class QString; @@ -35,8 +36,9 @@ namespace caf { class RiaSummaryTools { public: - static RimSummaryPlotCollection* summaryPlotCollection(); - static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, + static RimSummaryPlotCollection* summaryPlotCollection(); + static RimSummaryCaseMainCollection* summaryCaseMainCollection(); + static void notifyCalculatedCurveNameHasChanged(const QString& previousCurveName, const QString& currentCurveName); static RimSummaryPlot* parentSummaryPlot(caf::PdmObject* object); diff --git a/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp index b2d08b010e..759e23b94b 100644 --- a/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -54,6 +54,7 @@ void RicCloseSummaryCaseFeature::setupActionLook(QAction* actionToSetup) void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector& cases) { RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection(); for (RimSummaryCase* summaryCase : cases) { @@ -63,13 +64,11 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector } summaryPlotColl->updateConnectedEditors(); - RimSummaryCaseMainCollection* summaryCaseMainCollection = nullptr; - summaryCase->firstAncestorOrThisOfTypeAsserted(summaryCaseMainCollection); - summaryCaseMainCollection->removeCase(summaryCase); - summaryCaseMainCollection->updateAllRequiredEditors(); } + summaryCaseMainCollection->updateAllRequiredEditors(); + RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow(); mainPlotWindow->updateSummaryPlotToolBar();