12#include "MantidAPI/DllConfig.h"
38 :
IPropertySettings(), m_otherPropName(
std::move(otherPropName)), m_enabledSetting(enabledSetting) {}
60 std::string propValue = prop->
value();
61 if (propValue.empty())
66 ws = Mantid::API::AnalysisDataService::Instance().retrieve(propValue);
71 std::shared_ptr<T> castWS = std::dynamic_pointer_cast<T>(ws);
73 return m_enabledSetting;
75 return !m_enabledSetting;
89 std::vector<std::string>
dependsOn(
const std::string &thisProp)
const override {
90 if (m_otherPropName == thisProp)
91 throw std::runtime_error(
"EnabledWhenWorkspaceIsType: circular dependency detected");
92 return std::vector<std::string>{m_otherPropName};
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Show a property as enabled when the workspace pointed to by another is of a given type.
bool isEnabled(const Kernel::IPropertyManager *algo) const override
Return true/false based on whether the other property satisfies the criterion.
virtual bool checkCriterion(const Kernel::IPropertyManager *algo) const
Does the validator fulfill the criterion based on the other property values?
bool m_enabledSetting
Set Enabled to this.
std::string m_otherPropName
Name of the OTHER property that we will check.
std::vector< std::string > dependsOn(const std::string &thisProp) const override
Other properties that this property depends on.
bool isVisible(const Kernel::IPropertyManager *) const override
Return true always.
EnabledWhenWorkspaceIsType(std::string otherPropName, bool enabledSetting=true)
Constructor.
IPropertySettings * clone() const override
Make a copy of the present type of validator.
Exception for when an item is not found in a collection.
Interface to PropertyManager.
virtual Property * getPointerToProperty(const std::string &name) const =0
Get a pointer to property by name.
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
Base class for properties.
virtual std::string value() const =0
Returns the value of the property as a string.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Helper class which provides the Collimation Length for SANS instruments.