From c6a3eca3c234b92f89ae632f575b9b10b2944aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 20 Nov 2017 11:59:04 +0100 Subject: [PATCH] Statistics dialog. Use active reservoir view as context object --- .../Commands/RicShowGridStatisticsFeature.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/Commands/RicShowGridStatisticsFeature.cpp b/ApplicationCode/Commands/RicShowGridStatisticsFeature.cpp index 7a5258a3b8..e059c4a67c 100644 --- a/ApplicationCode/Commands/RicShowGridStatisticsFeature.cpp +++ b/ApplicationCode/Commands/RicShowGridStatisticsFeature.cpp @@ -39,7 +39,7 @@ CAF_CMD_SOURCE_INIT(RicShowGridStatisticsFeature, "RicShowGridStatisticsFeature" //-------------------------------------------------------------------------------------------------- bool RicShowGridStatisticsFeature::isCommandEnabled() { - return true; + return RiaApplication::instance()->activeReservoirView() != nullptr; } //-------------------------------------------------------------------------------------------------- @@ -47,16 +47,11 @@ bool RicShowGridStatisticsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicShowGridStatisticsFeature::onActionTriggered(bool isChecked) { - auto eclipseView = caf::firstAncestorOfTypeFromSelectedObject(); - auto geoMechView = caf::firstAncestorOfTypeFromSelectedObject(); + RimView * activeView = RiaApplication::instance()->activeReservoirView(); - if (eclipseView && eclipseView->overlayInfoConfig()) + if (activeView) { - eclipseView->overlayInfoConfig()->showStatisticsInfoDialog(); - } - else if (geoMechView && geoMechView->overlayInfoConfig()) - { - geoMechView->overlayInfoConfig()->showStatisticsInfoDialog(); + activeView->overlayInfoConfig()->showStatisticsInfoDialog(); } }