///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2026 Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RicNewEnsembleJobFeature.h" #include "RiaApplication.h" #include "RiaPreferencesOpm.h" #include "Summary/RiaSummaryDefines.h" #include "EnsembleFileSet/RimEnsembleFileSet.h" #include "Jobs/RimEnsembleJob.h" #include "Jobs/RimJobCollection.h" #include "RimReservoirGridEnsemble.h" #include "RimTools.h" #include "Riu3DMainWindowTools.h" #include "RiuFileDialogTools.h" #include "cafSelectionManager.h" #include #include #include CAF_CMD_SOURCE_INIT( RicNewEnsembleJobFeature, "RicNewEnsembleJobFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RicNewEnsembleJobFeature::isCommandEnabled() const { std::vector selectedEnsembles = caf::SelectionManager::instance()->objectsByType(); return RiaPreferencesOpm::current()->validateFlowSettings() && selectedEnsembles.size() == 1 && selectedEnsembles[0]->ensembleFileSet()->groupingMode() == RiaDefines::EnsembleGroupingMode::FMU_FOLDER_STRUCTURE; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewEnsembleJobFeature::onActionTriggered( bool isChecked ) { std::vector selectedEnsembles = caf::SelectionManager::instance()->objectsByType(); if ( selectedEnsembles.empty() ) return; auto job = new RimEnsembleJob(); job->setName( selectedEnsembles[0]->name() ); job->setInputEnsemble( selectedEnsembles[0] ); auto jobColl = RimTools::jobCollection(); jobColl->addNewJob( job ); Riu3DMainWindowTools::selectAsCurrentItem( job ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewEnsembleJobFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setIcon( QIcon( ":/opm.png" ) ); actionToSetup->setText( "New Ensemble Job... " ); }