12#include <Poco/AutoPtr.h>
13#include <Poco/NObserver.h>
14#include <Poco/Notification.h>
15#include <Poco/NotificationCenter.h>
40 m_replaceObserver(*this, &
WorkspaceSelector::handleReplaceEvent), m_init(init), m_workspaceTypes(),
41 m_showHidden(false), m_showGroups(true), m_optional(false), m_sorted(false), m_binLimits(
std::make_pair(0, -1)),
42 m_suffix(), m_algName(), m_algPropName(), m_algorithm() {
47 this->setAcceptDrops(
true);
48 this->completer()->setCompletionMode(QCompleter::PopupCompletion);
49 this->setInsertPolicy(QComboBox::NoInsert);
170 std::vector<Mantid::Kernel::Property *> props =
m_algorithm->getProperties();
171 for (
auto &prop : props) {
175 if (wsProp !=
nullptr) {
186 const std::lock_guard<std::mutex> lock(
m_adsMutex);
191 QString name = QString::fromStdString(pNf->objectName());
202 const std::lock_guard<std::mutex> lock(
m_adsMutex);
203 QString name = QString::fromStdString(pNf->objectName());
204 int index = findText(name);
208 if (currentIndex() == -1) {
214 const std::lock_guard<std::mutex> lock(
m_adsMutex);
222 const std::lock_guard<std::mutex> lock(
m_adsMutex);
223 QString name = QString::fromStdString(pNf->objectName());
224 QString newName = QString::fromStdString(pNf->newObjectName());
227 bool eligible =
checkEligibility(newName, ads.retrieve(pNf->newObjectName()));
228 int index = findText(name);
229 int newIndex = findText(newName);
232 if (
index != -1 && newIndex == -1) {
233 this->setItemText(
index, newName);
237 }
else if (
index == -1 && newIndex == -1) {
252 const std::lock_guard<std::mutex> lock(
m_adsMutex);
253 QString name = QString::fromStdString(pNf->objectName());
257 int index = findText(name);
263 bool inside = (
index != -1);
264 if ((inside && eligible) || (!inside && !eligible))
266 else if (!inside && eligible) {
279 }
catch (std::invalid_argument &) {
289 auto group = std::dynamic_pointer_cast<Mantid::API::WorkspaceGroup>(
object);
290 if (group !=
nullptr)
301 for (
int i = 0; i <
m_suffix.size(); ++i) {
313 if (
auto const workspace = std::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(
object)) {
314 auto const numberOfBins =
static_cast<int>(
workspace->y(0).size());
324 const std::lock_guard<std::mutex> lock(
m_adsMutex);
329 std::vector<std::string> items;
333 items = ads.getObjectNames();
336 QStringList namesToAdd;
337 for (
auto &item : items) {
338 QString name = QString::fromStdString(item);
343 this->addItems(namesToAdd);
354 const std::lock_guard<std::mutex> lock(
m_adsMutex);
355 const QMimeData *mimeData = de->mimeData();
356 QString text = mimeData->text();
357 int equal_pos = text.indexOf(
"=");
358 QString ws_name = text.left(equal_pos - 1);
359 QString ws_name_test = text.mid(equal_pos + 7, equal_pos - 1);
361 if (ws_name == ws_name_test) {
362 int index = findText(ws_name);
364 setCurrentIndex(
index);
365 de->acceptProposedAction();
375 const std::lock_guard<std::mutex> lock(
m_adsMutex);
376 const QMimeData *mimeData = de->mimeData();
377 if (mimeData->hasText()) {
378 QString text = mimeData->text();
379 if (text.contains(
" = mtd[\""))
380 de->acceptProposedAction();
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
void removeItem(WorkspaceGroup &self, const std::string &name)
void addItem(WorkspaceGroup &self, const std::string &name)
The Analysis data service stores instances of the Workspace objects and anything that derives from te...
A property class for workspaces.
Poco::NotificationCenter notificationCenter
Sends notifications to observers.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::AfterReplaceNotification > & WorkspaceAfterReplaceNotification_ptr
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::ClearNotification > & ClearADSNotification_ptr
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::RenameNotification > & WorkspaceRenameNotification_ptr
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::AddNotification > & WorkspaceAddNotification_ptr
const Poco::AutoPtr< Mantid::Kernel::DataService< Mantid::API::Workspace >::PostDeleteNotification > & WorkspacePostDeleteNotification_ptr
@ Input
An input workspace.