]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug IPAL9313 (update of data model of NON-loaded modules in onRefresh() ).
authorasv <asv@opencascade.com>
Fri, 24 Jun 2005 11:50:08 +0000 (11:50 +0000)
committerasv <asv@opencascade.com>
Fri, 24 Jun 2005 11:50:08 +0000 (11:50 +0000)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_DataModel.cxx
src/SalomeApp/SalomeApp_DataModel.h

index 842ac2ba143305e4b889a80a55f86ca218160852..3e403d6a4c97a3628f13da7061c7a22abf712435 100644 (file)
@@ -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<SalomeApp_Study*>(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();
 }
index c995ffb878a795a2081df4f2a5714636a85f457f..b9dd382e56a56e231dc841d60e8f7f75b82f4a7e 100644 (file)
@@ -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 );
 
index a4ce5c8084266526decf08205493ae042ad95acf..f09aecfcc06a2710446ac56cefc8352cc2a80cdf 100644 (file)
@@ -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();