Quintiq file version 2.0
#parent: ListScenario
Response OnClick (
  structured[ScenarioNode] selection
) id:Response_ListScenario_MenuRestoreItem_OnClick
{
  #keys: '[136682.1.452943131]'
  CanBindMultiple: false
  DefinitionID => /ListScenario/Responsedef_ListScenario_WebMenu_OnClick
  GroupServerCalls: true
  Initiator: 'MenuRestoreItem'
  Precondition:
  [*
    return  not ScenarioNode::CanDelete( selection, feedback )
                 or ( selection.Element( 0 ).istype( ScenarioFolder )
                      and selection.Element(0).astype( ScenarioFolder ).IsRecycleBin() );
  *]
  QuillAction
  {
    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 )
      }
    *]
  }
}
