#1813 Observed data: Remove right click options if any object in selection is an observed data

This commit is contained in:
Rebecca Cox 2017-09-19 14:47:36 +02:00
parent 1eecef9f72
commit fe1dfebea2
4 changed files with 53 additions and 4 deletions

View File

@ -77,7 +77,19 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled()
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return (selection.size() > 0 && !selection[0]->isObservedData());
if (selection.size() == 0)
{
return false;
}
for (RimSummaryCase* summaryCase : selection)
{
if (summaryCase->isObservedData())
{
return false;
}
}
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@ -37,7 +37,19 @@ bool RicCreateSummaryCaseCollectionFeature::isCommandEnabled()
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return (selection.size() > 0 && !selection[0]->isObservedData());
if (selection.size() == 0)
{
return false;
}
for (RimSummaryCase* summaryCase : selection)
{
if (summaryCase->isObservedData())
{
return false;
}
}
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@ -43,7 +43,20 @@ bool RicReloadSummaryCaseFeature::isCommandEnabled()
{
std::vector<RimSummaryCase*> caseSelection = selectedSummaryCases();
return (caseSelection.size() > 0 && !caseSelection[0]->isObservedData());
if (caseSelection.size() == 0)
{
return false;
}
for (RimSummaryCase* summaryCase : caseSelection)
{
if (summaryCase->isObservedData())
{
return false;
}
}
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@ -57,7 +57,19 @@ bool RicPasteSummaryCaseFeature::isCommandEnabled()
std::vector<caf::PdmPointer<RimSummaryCase> > summaryCases = RicPasteSummaryCaseFeature::summaryCases();
return (summaryCases.size() > 0 && !summaryCases[0]->isObservedData());
if (summaryCases.size() == 0)
{
return false;
}
for (RimSummaryCase* summaryCase : summaryCases)
{
if (summaryCase->isObservedData())
{
return false;
}
}
return true;
}
//--------------------------------------------------------------------------------------------------