Statistics dialog. Use active reservoir view as context object

This commit is contained in:
Bjørn Erik Jensen 2017-11-20 11:59:04 +01:00
parent 14198191b1
commit c6a3eca3c2

View File

@ -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<RimEclipseView*>();
auto geoMechView = caf::firstAncestorOfTypeFromSelectedObject<RimGeoMechView*>();
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();
}
}