#4176 Limit scope of Delete/Show all linked views command with selection manager

This commit is contained in:
Gaute Lindkvist 2019-03-27 10:26:08 +01:00
parent 2b2323a1b6
commit ab3820fe4f
3 changed files with 7 additions and 4 deletions

View File

@ -24,6 +24,8 @@
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
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<RimViewLinkerCollection>() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
#include "RimViewController.h"
#include "RimGridView.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature"
//--------------------------------------------------------------------------------------------------
bool RicShowAllLinkedViewsFeature::isCommandEnabled()
{
return true;
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimViewLinkerCollection>() != nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@ -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<RimViewLinker*>(uiItem))
else if (dynamic_cast<RimViewLinker*>(uiItem) || dynamic_cast<RimViewLinkerCollection*>(uiItem))
{
menuBuilder << "RicShowAllLinkedViewsFeature";
menuBuilder << "Separator";