#2398 Fracture : Hide "New Fracture" in context menu when no Fracture Template is defined

This commit is contained in:
Magne Sjaastad 2018-01-23 07:28:32 +01:00
parent 5855e412e7
commit 7dbd6c1027
4 changed files with 26 additions and 0 deletions

View File

@ -49,6 +49,9 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureAtPosFeature, "RicNewSimWellFractureAtP
//--------------------------------------------------------------------------------------------------
void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return;
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
@ -120,6 +123,9 @@ void RicNewSimWellFractureAtPosFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellFractureAtPosFeature::isCommandEnabled()
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return false;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
if (!pdmUiItem) return false;

View File

@ -50,6 +50,9 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature"
//--------------------------------------------------------------------------------------------------
void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
if (!pdmUiItem) return;
@ -109,6 +112,9 @@ void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellFractureFeature::isCommandEnabled()
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return false;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
if (!pdmUiItem) return false;

View File

@ -22,6 +22,8 @@
#include "RicNewWellPathFractureFeature.h"
#include "RimProject.h"
#include "RiuSelectionManager.h"
#include <QAction>
@ -35,6 +37,9 @@ CAF_CMD_SOURCE_INIT(RicNewWellPathFractureAtPosFeature, "RicNewWellPathFractureA
//--------------------------------------------------------------------------------------------------
void RicNewWellPathFractureAtPosFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return;
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
@ -61,5 +66,8 @@ void RicNewWellPathFractureAtPosFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathFractureAtPosFeature::isCommandEnabled()
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return false;
return true;
}

View File

@ -96,6 +96,9 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me
//--------------------------------------------------------------------------------------------------
void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return;
RimWellPathFractureCollection* fractureColl = RicNewWellPathFractureFeature::selectedWellPathFractureCollection();
if (!fractureColl) return;
@ -120,6 +123,9 @@ void RicNewWellPathFractureFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathFractureFeature::isCommandEnabled()
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->allFractureTemplates().empty()) return false;
if (selectedWellPathFractureCollection())
{
return true;