diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index ffb80a83aa..79da037071 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -43,6 +43,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h +${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h @@ -92,6 +93,7 @@ ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp +${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp diff --git a/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.cpp b/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.cpp new file mode 100644 index 0000000000..7794ae28bc --- /dev/null +++ b/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.cpp @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "RicCreateGridCaseGroupFeature.h" + +#include "RimEclipseCaseCollection.h" +#include "RiaApplication.h" +#include "RiuMultiCaseImportDialog.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT(RicCreateGridCaseGroupFeature, "RicCreateGridCaseGroupFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateGridCaseGroupFeature::isCommandEnabled() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType(&selection); + + return selection.size() > 0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateGridCaseGroupFeature::onActionTriggered(bool isChecked) +{ + RiaApplication* app = RiaApplication::instance(); + RiuMultiCaseImportDialog dialog; + int action = dialog.exec(); + if (action == QDialog::Accepted) + { + QStringList gridFileNames = dialog.eclipseCaseFileNames(); + app->addEclipseCases(gridFileNames); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateGridCaseGroupFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setIcon(QIcon(":/CreateGridCaseGroup16x16.png")); + actionToSetup->setText("Import Eclipse Case"); +} diff --git a/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.h b/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.h new file mode 100644 index 0000000000..ef7d863655 --- /dev/null +++ b/ApplicationCode/Commands/RicCreateGridCaseGroupFeature.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + +//================================================================================================== +/// +//================================================================================================== +class RicCreateGridCaseGroupFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook( QAction* actionToSetup ); +}; + + diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index a9ed7b4a01..ac4d5e5899 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -562,6 +562,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu) { commandIds << "RicImportEclipseCaseFeature"; commandIds << "RicImportInputEclipseCaseFeature"; + commandIds << "RicCreateGridCaseGroupFeature"; } else if (dynamic_cast(uiItem)) { diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index d0a304a2f1..5312c79a6a 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -1756,14 +1756,10 @@ void RiuMainWindow::hideAllDockWindows() void RiuMainWindow::slotOpenMultipleCases() { #if 1 - RiaApplication* app = RiaApplication::instance(); - RiuMultiCaseImportDialog dialog; - int action = dialog.exec(); - if (action == QDialog::Accepted) - { - QStringList gridFileNames = dialog.eclipseCaseFileNames(); - app->addEclipseCases(gridFileNames); - } + QAction* action = caf::CmdFeatureManager::instance()->action("RicCreateGridCaseGroupFeature"); + CVF_ASSERT(action); + + action->trigger(); #else // Code to fast generate a test project RiaApplication* app = RiaApplication::instance();