Summary context menu cleanup and fixes (#9165)

* Make summary plot ctx menu items show up for the plot you right-click on, not the one selected in the project tree.
This commit is contained in:
jonjenssen
2022-08-08 13:34:27 +02:00
committed by GitHub
parent eedebd71a5
commit c3f538c1dd
15 changed files with 296 additions and 58 deletions

View File

@@ -44,29 +44,10 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
std::vector<caf::PdmObject*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
std::vector<RimPlot*> selection;
getSelection( selection );
if ( selection.size() > 0 )
{
if ( dynamic_cast<RimMultiPlot*>( selection.front() ) ) return false;
size_t plotsSelected = 0;
for ( caf::PdmObject* object : selection )
{
RimMultiPlot* multiPlot = nullptr;
RimWellLogPlot* wellLogPlot = nullptr;
object->firstAncestorOrThisOfType( multiPlot );
object->firstAncestorOrThisOfType( wellLogPlot );
if ( dynamic_cast<RimPlotWindow*>( object ) && ( multiPlot || wellLogPlot ) )
{
plotsSelected++;
}
}
return plotsSelected == selection.size();
}
return false;
return ( selection.size() > 0 );
}
//--------------------------------------------------------------------------------------------------