#4796 Summary Plot Template : Add context menu to selected summary cases

This commit is contained in:
Magne Sjaastad
2019-09-29 12:31:21 +02:00
parent a6609c6e06
commit fbfba745c3
5 changed files with 249 additions and 0 deletions

View File

@@ -882,6 +882,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicAsciiExportSummaryPlotFeature";
}
}
else if ( dynamic_cast<RimSummaryCase*>( uiItem ) )
{
appendPlotTemplateMenus( menuBuilder );
}
else if ( dynamic_cast<RimWellLogPlot*>( uiItem ) )
{
menuBuilder << "RicAsciiExportWellLogPlotFeature";
@@ -1031,6 +1035,19 @@ void RimContextCommandBuilder::createExecuteScriptForCasesFeatureMenu( caf::CmdF
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimContextCommandBuilder::appendPlotTemplateMenus( caf::CmdFeatureMenuBuilder& menuBuilder )
{
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
if ( proj && proj->rootPlotTemlateItem() )
{
appendPlotTemplateItems( menuBuilder, proj->rootPlotTemlateItem() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1068,6 +1085,26 @@ void RimContextCommandBuilder::appendScriptItems( caf::CmdFeatureMenuBuilder& me
menuBuilder.subMenuEnd();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimContextCommandBuilder::appendPlotTemplateItems( caf::CmdFeatureMenuBuilder& menuBuilder,
RimPlotTemplateFolderItem* plotTemplateRoot )
{
for ( const auto& fileItem : plotTemplateRoot->fileNames() )
{
QString menuText = fileItem->uiName();
menuBuilder.addCmdFeatureWithUserData( "RicCreatePlotFromTemplateFeature",
menuText,
QVariant( fileItem->absoluteFilePath() ) );
}
for ( const auto& folder : plotTemplateRoot->subFolders() )
{
appendPlotTemplateItems( menuBuilder, folder );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------