diff --git a/ApplicationCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp b/ApplicationCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp index 318e096985..9668be3b30 100644 --- a/ApplicationCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp +++ b/ApplicationCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp @@ -24,6 +24,8 @@ #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" +#include "cafSelectionManager.h" + #include CAF_CMD_SOURCE_INIT(RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeature"); @@ -33,7 +35,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteAllLinkedViewsFeature, "RicDeleteAllLinkedViewsFeat //-------------------------------------------------------------------------------------------------- bool RicDeleteAllLinkedViewsFeature::isCommandEnabled() { - return true; + return caf::SelectionManager::instance()->selectedItemAncestorOfType() != nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.cpp b/ApplicationCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.cpp index 4d13a95255..751dee2afb 100644 --- a/ApplicationCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.cpp +++ b/ApplicationCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.cpp @@ -22,7 +22,7 @@ #include "RimViewController.h" #include "RimGridView.h" #include "RimViewLinker.h" - +#include "RimViewLinkerCollection.h" #include "cafSelectionManager.h" #include @@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature" //-------------------------------------------------------------------------------------------------- bool RicShowAllLinkedViewsFeature::isCommandEnabled() { - return true; + return caf::SelectionManager::instance()->selectedItemAncestorOfType() != nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 687bb36a78..1f59939c57 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -83,6 +83,7 @@ #include "RimSummaryPlotCollection.h" #include "RimViewController.h" #include "RimViewLinker.h" +#include "RimViewLinkerCollection.h" #include "RimWellAllocationPlot.h" #include "RimWellLogCurve.h" #include "RimWellLogFile.h" @@ -410,7 +411,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicShowAllLinkedViewsFeature"; } - else if (dynamic_cast(uiItem)) + else if (dynamic_cast(uiItem) || dynamic_cast(uiItem)) { menuBuilder << "RicShowAllLinkedViewsFeature"; menuBuilder << "Separator";