diff --git a/ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp b/ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp index 4ea1b538f9..902085ad10 100644 --- a/ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp +++ b/ApplicationCode/Commands/RicEclipseCaseNewGroupExec.cpp @@ -74,7 +74,7 @@ void RicEclipseCaseNewGroupExec::redo() analysisModels->caseGroups().push_back(createdObject); analysisModels->updateConnectedEditors(); RiuMainWindow::instance()->setCurrentObjectInTreeView(createdObject); - + RiuMainWindow::instance()->setExpanded(createdObject, true); } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 206d4c1eaf..6c78ef9a1a 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -451,8 +451,6 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang if (&m_wellDataSourceCase == changedField) { - RimUiTreeModelPdm* treeModel = RiuMainWindow::instance()->uiPdmModel_OBSOLETE(); - // Find or load well data for given case RimEclipseCase* sourceResultCase = caseGroup()->caseCollection()->findByDescription(m_wellDataSourceCase); if (sourceResultCase) diff --git a/ApplicationCode/ProjectDataModel/RimScriptCollection.cpp b/ApplicationCode/ProjectDataModel/RimScriptCollection.cpp index 8e3184dc34..ec9057fb10 100644 --- a/ApplicationCode/ProjectDataModel/RimScriptCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimScriptCollection.cpp @@ -178,6 +178,7 @@ void RimScriptCollection::fieldChangedByUi(const caf::PdmFieldHandle *changedFie QFileInfo fi(directory); this->setUiName(fi.baseName()); this->readContentFromDisc(); + RimUiTreeModelPdm* treeModel = RiuMainWindow::instance()->uiPdmModel_OBSOLETE(); if (treeModel) treeModel->updateUiSubTree(this); } diff --git a/ApplicationCode/SocketInterface/RiaProjectInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaProjectInfoCommands.cpp index 77737c8ad0..bedf184011 100644 --- a/ApplicationCode/SocketInterface/RiaProjectInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaProjectInfoCommands.cpp @@ -44,6 +44,7 @@ #include "RimWellPathCollection.h" #include "RimOilField.h" #include "RimEclipseCaseCollection.h" +#include "cafSelectionManager.h" @@ -122,11 +123,9 @@ public: virtual bool interpretCommand(RiaSocketServer* server, const QList& args, QDataStream& socketStream) { - RiuMainWindow* ruiMainWindow = RiuMainWindow::instance(); - if (ruiMainWindow) { std::vector cases; - ruiMainWindow->selectedCases(cases); + caf::SelectionManager::instance()->objectsByType(&cases); std::vector caseIds; std::vector caseNames; diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index e76550da6a..e4a7fffe04 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -2008,10 +2008,12 @@ void RiuMainWindow::updateScaleValue() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::selectedCases(std::vector& cases) { + caf::SelectionManager::instance()->objectsByType(&cases); +#if 0 // OBSOLETE if (m_OBSOLETE_treeView && m_OBSOLETE_treeView->selectionModel()) { QModelIndexList selectedModelIndexes = m_OBSOLETE_treeView->selectionModel()->selectedIndexes(); - + caf::PdmObjectGroup group; m_OBSOLETE_treeModelPdm->populateObjectGroupFromModelIndexList(selectedModelIndexes, &group); @@ -2023,6 +2025,7 @@ void RiuMainWindow::selectedCases(std::vector& cases) cases.push_back(typedObjects[i]); } } +#endif } //-------------------------------------------------------------------------------------------------- @@ -2198,13 +2201,10 @@ void RiuMainWindow::appendActionsContextMenuForPdmObject(caf::PdmObjectHandle* p //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMainWindow::setExpanded(const caf::PdmObject* pdmObject, bool expanded) +void RiuMainWindow::setExpanded(const caf::PdmUiItem* uiItem, bool expanded) { - QModelIndex mi = m_OBSOLETE_treeModelPdm->getModelIndexFromPdmObject(pdmObject); - if (m_OBSOLETE_treeView && mi.isValid()) - { - m_OBSOLETE_treeView->setExpanded(mi, expanded); - } + + m_projectTreeView->setExpanded(uiItem, expanded); } //-------------------------------------------------------------------------------------------------- @@ -2216,6 +2216,9 @@ void RiuMainWindow::forceProjectTreeRepaint() // Needed for some reason when changing names and icons in the model m_OBSOLETE_treeView->scroll(0,1); m_OBSOLETE_treeView->scroll(0,-1); + + m_projectTreeView->scroll(0,1); + m_projectTreeView->scroll(0,-1); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index 2de1c4592a..99d9818c93 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -55,6 +55,7 @@ namespace caf class PdmUiPropertyView; class UiPropertyCreatorPdm; class UiTreeModelPdm; + class PdmUiItem; } namespace ssihub @@ -104,7 +105,7 @@ public: void appendActionsContextMenuForPdmObject(caf::PdmObjectHandle* pdmObject, QMenu* menu); void refreshDrawStyleActions(); - void setExpanded(const caf::PdmObject* pdmObject, bool expanded); + void setExpanded(const caf::PdmUiItem* uiItem, bool expanded); protected: virtual void closeEvent(QCloseEvent* event);