diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp index 56e023a898..ad3397da06 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp @@ -18,6 +18,10 @@ #include "RicShowContributingWellsFeature.h" +#include "RiaApplication.h" +#include "RimEclipseResultCase.h" +#include "RimView.h" + #include "cafCmdFeatureManager.h" #include @@ -29,7 +33,21 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe //-------------------------------------------------------------------------------------------------- bool RicShowContributingWellsFeature::isCommandEnabled() { - return true; + RimView* activeView = RiaApplication::instance()->activeReservoirView(); + if (!activeView) return false; + + RimEclipseResultCase* eclCase = nullptr; + activeView->firstAncestorOrThisOfType(eclCase); + if (eclCase) + { + std::vector flowSols = eclCase->flowDiagSolutions(); + if (flowSols.size() > 0) + { + return true; + } + } + + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp index 0c82744b55..a232419884 100644 --- a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp @@ -20,10 +20,12 @@ #include "RiaApplication.h" +#include "RimEclipseResultCase.h" #include "RimEclipseWell.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimView.h" #include "RimWellAllocationPlot.h" #include "RiuMainPlotWindow.h" @@ -39,7 +41,21 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot //-------------------------------------------------------------------------------------------------- bool RicShowWellAllocationPlotFeature::isCommandEnabled() { - return true; + RimView* activeView = RiaApplication::instance()->activeReservoirView(); + if (!activeView) return false; + + RimEclipseResultCase* eclCase = nullptr; + activeView->firstAncestorOrThisOfType(eclCase); + if (eclCase) + { + std::vector flowSols = eclCase->flowDiagSolutions(); + if (flowSols.size() > 0) + { + return true; + } + } + + return false; } //--------------------------------------------------------------------------------------------------