mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#4176 Limit scope of Delete/Show all linked views command with selection manager
This commit is contained in:
parent
2b2323a1b6
commit
ab3820fe4f
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user