Quintiq file version 2.0
#parent: ListScenario
Response OnClick (
  structured[ScenarioNode] selection
) id:Response_ListScenario_MenuRestoreItemAll_OnClick
{
  #keys: '[11766.1.296296289]'
  Body:
  [*
    // Restore deleted items to root folder
    
    first := guard( selection.Element( 0 ).astype( ScenarioFolder ), null( ScenarioFolder ) );
    if( not isnull( first ) and first.IsRecycleBin() )
    {
      ScenarioFolder::RestoreRecycleBin( first, ScenarioManager )
    }
    else
    {
      ScenarioNode::Restore( selection, ScenarioManager )
    }
  *]
  CanBindMultiple: false
  DefinitionID => /ListScenario/Responsedef_ListScenario_Menu_OnClick
  Initiator: 'MenuRestoreItemAll'
  Precondition:
  [*
    return  not ScenarioNode::CanDelete( selection, feedback )
                 or ( selection.Element( 0 ).istype( ScenarioFolder )
                      and selection.Element(0).astype( ScenarioFolder ).IsRecycleBin() );
  *]
  UserRequiresReadWrite: true
}
