diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp index 1c0fcdbffa..d09246449e 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.cpp @@ -26,6 +26,7 @@ #include "RimWellLogExtractionCurve.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "RimView.h" #include "RiuMainWindow.h" #include "RiaApplication.h" @@ -44,7 +45,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr //-------------------------------------------------------------------------------------------------- bool RicNewWellLogCurveExtractionFeature::isCommandEnabled() { - return selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL; + return (selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL) && caseAvailable(); } //-------------------------------------------------------------------------------------------------- @@ -82,7 +83,7 @@ void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() +RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const { std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); @@ -92,13 +93,22 @@ RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTra //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() +RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const { std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); return selection.size() > 0 ? selection[0] : NULL; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewWellLogCurveExtractionFeature::caseAvailable() const +{ + RimView* view = RiaApplication::instance()->activeReservoirView(); + return view ? view->ownerCase() != NULL : false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h index 3f9bba8903..84fe43c76a 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h @@ -44,6 +44,7 @@ protected: virtual void setupActionLook( QAction* actionToSetup ); private: - RimWellLogPlotTrack* selectedWellLogPlotTrack(); - RimWellPath* selectedWellPath(); + RimWellLogPlotTrack* selectedWellLogPlotTrack() const; + RimWellPath* selectedWellPath() const; + bool caseAvailable() const; };