mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 04:00:57 -06:00
(#578) Disable menu commands in tree view when range/property is overridden
This commit is contained in:
parent
cb1723494c
commit
d9523dbd74
@ -24,6 +24,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -83,6 +84,25 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter(RimEclipsePropert
|
||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(caf::PdmObjectHandle* object)
|
||||
{
|
||||
RimView* rimView = NULL;
|
||||
object->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
RimViewController* vc = rimView->viewController();
|
||||
if (vc && vc->isPropertyFilterOveridden())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,11 @@
|
||||
class RimEclipsePropertyFilter;
|
||||
class RimEclipsePropertyFilterCollection;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectHandle;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -37,6 +42,8 @@ public:
|
||||
static void addPropertyFilter(RimEclipsePropertyFilterCollection* propertyFilterCollection);
|
||||
static void insertPropertyFilter(RimEclipsePropertyFilterCollection* propertyFilterCollection, size_t index);
|
||||
|
||||
static bool isPropertyFilterCommandAvailable(caf::PdmObjectHandle* object);
|
||||
|
||||
private:
|
||||
static void setDefaults(RimEclipsePropertyFilter* propertyFilter);
|
||||
};
|
||||
|
@ -38,7 +38,12 @@ CAF_CMD_SOURCE_INIT(RicEclipsePropertyFilterInsertFeature, "RicEclipsePropertyFi
|
||||
bool RicEclipsePropertyFilterInsertFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> propertyFilters = RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilters();
|
||||
return propertyFilters.size() == 1;
|
||||
if (propertyFilters.size() == 1)
|
||||
{
|
||||
return RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(propertyFilters[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,7 +37,12 @@ CAF_CMD_SOURCE_INIT(RicEclipsePropertyFilterNewFeature, "RicEclipsePropertyFilte
|
||||
bool RicEclipsePropertyFilterNewFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilterCollection*> filterCollections = RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilterCollections();
|
||||
return filterCollections.size() == 1;
|
||||
if (filterCollections.size() == 1)
|
||||
{
|
||||
return RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(filterCollections[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicGeoMechPropertyFilterFeatureImpl.h"
|
||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@ -86,6 +87,15 @@ void RicGeoMechPropertyFilterFeatureImpl::insertPropertyFilter(RimGeoMechPropert
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicGeoMechPropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(caf::PdmObjectHandle* object)
|
||||
{
|
||||
// Reuse code from EclipseProperty filter, as the function is only dependent on RimView
|
||||
return RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,11 @@
|
||||
class RimGeoMechPropertyFilter;
|
||||
class RimGeoMechPropertyFilterCollection;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObjectHandle;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -37,6 +42,8 @@ public:
|
||||
static void addPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
|
||||
static void insertPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection, size_t index);
|
||||
|
||||
static bool isPropertyFilterCommandAvailable(caf::PdmObjectHandle* object);
|
||||
|
||||
private:
|
||||
static RimGeoMechPropertyFilter* createPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
|
||||
static void setDefaults(RimGeoMechPropertyFilter* propertyFilter);
|
||||
|
@ -38,7 +38,12 @@ CAF_CMD_SOURCE_INIT(RicGeoMechPropertyFilterInsertFeature, "RicGeoMechPropertyFi
|
||||
bool RicGeoMechPropertyFilterInsertFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> propertyFilters = RicGeoMechPropertyFilterFeatureImpl::selectedPropertyFilters();
|
||||
return propertyFilters.size() == 1;
|
||||
if (propertyFilters.size() == 1)
|
||||
{
|
||||
return RicGeoMechPropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(propertyFilters[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,7 +37,12 @@ CAF_CMD_SOURCE_INIT(RicGeoMechPropertyFilterNewFeature, "RicGeoMechPropertyFilte
|
||||
bool RicGeoMechPropertyFilterNewFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> filterCollections = RicGeoMechPropertyFilterFeatureImpl::selectedPropertyFilterCollections();
|
||||
return filterCollections.size() == 1;
|
||||
if (filterCollections.size() == 1)
|
||||
{
|
||||
return RicGeoMechPropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(filterCollections[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -38,8 +38,7 @@ CAF_CMD_SOURCE_INIT(RicRangeFilterInsertFeature, "RicRangeFilterInsertFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterInsertFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selection = selectedCellRangeFilters();
|
||||
return selection.size() > 0;
|
||||
return RicRangeFilterFeatureImpl::isRangeFilterCommandAvailable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user