From: asv Date: Fri, 24 Jun 2005 11:50:08 +0000 (+0000) Subject: Fix for bug IPAL9313 (update of data model of NON-loaded modules in onRefresh() ). X-Git-Tag: T3_0_0_a4~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c9acfdea41e02727842802cbbc819a0197375666;p=modules%2Fgui.git Fix for bug IPAL9313 (update of data model of NON-loaded modules in onRefresh() ). --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 842ac2ba1..3e403d6a4 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1615,6 +1615,7 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* t void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) { + // update existing data models (already loaded SComponents) if ( updateModels ) { for ( ModuleListIterator it = modules(); it.current(); ++it ) @@ -1624,6 +1625,25 @@ void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) ((SalomeApp_DataModel*)camDM)->update(); } } + // update "non-existing" (not loaded yet) data models + SalomeApp_Study* study = dynamic_cast(activeStudy()); + if ( study ) + { + _PTR(Study) stdDS = study->studyDS(); + if( stdDS ) + { + for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() ) + { + _PTR(SComponent) aComponent ( it->Value() ); + + if ( aComponent->ComponentDataType() == "Interface Applicative" ) + continue; // skip the magic "Interface Applicative" component + + SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true ); + } + } + } + if ( objectBrowser() ) objectBrowser()->updateTree(); } diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx index c995ffb87..b9dd382e5 100644 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ b/src/SalomeApp/SalomeApp_DataModel.cxx @@ -29,7 +29,8 @@ //======================================================================= SUIT_DataObject* SalomeApp_DataModel::BuildTree( const _PTR(SObject)& obj, SUIT_DataObject* parent, - SalomeApp_Study* study ) + SalomeApp_Study* study, + bool skip ) { SalomeApp_DataObject* aDataObj = 0; if ( !obj || !study ) @@ -39,6 +40,17 @@ SUIT_DataObject* SalomeApp_DataModel::BuildTree( const _PTR(SObject)& obj, if ( obj->GetName().size() || obj->ReferencedObject( refObj ) ) // skip nameless non references SObjects { _PTR(SComponent) aSComp( obj ); + + // patch for bug IPAL9313 + if ( aSComp && parent && skip ) + { + QString aSName( aSComp->GetName().c_str() ); + DataObjectList allComponents = parent->children( /*recursive=*/false ); + for ( DataObjectListIterator it( allComponents ); it.current(); ++it ) + if ( it.current()->name() == aSName ) + return it.current(); + } + aDataObj = aSComp ? new SalomeApp_ModuleObject( aSComp, parent ) : new SalomeApp_DataObject ( obj, parent ); diff --git a/src/SalomeApp/SalomeApp_DataModel.h b/src/SalomeApp/SalomeApp_DataModel.h index a4ce5c808..f09aecfcc 100644 --- a/src/SalomeApp/SalomeApp_DataModel.h +++ b/src/SalomeApp/SalomeApp_DataModel.h @@ -32,7 +32,8 @@ class SALOMEAPP_EXPORT SalomeApp_DataModel : public CAM_DataModel public: static SUIT_DataObject* BuildTree(const _PTR(SObject)& obj, SUIT_DataObject* parent, - SalomeApp_Study* study ); + SalomeApp_Study* study, + bool skip = false ); SalomeApp_DataModel ( CAM_Module* theModule ); virtual ~SalomeApp_DataModel();