Salome HOME
Add method updateObjectBrowser() for the SalomeApp_Application
authorvsr <vsr@opencascade.com>
Fri, 17 Jun 2005 14:59:45 +0000 (14:59 +0000)
committervsr <vsr@opencascade.com>
Fri, 17 Jun 2005 14:59:45 +0000 (14:59 +0000)
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_SWIG/SALOMEGUI_Swig.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h

index f76a0049a40daad1a91a87fa7e6cc5b8d864643f..3fd1245294982d201d38bc33ed4201948ce220b7 100644 (file)
@@ -334,8 +334,8 @@ void SalomePyQt::updateObjBrowser( const int studyId, bool updateSelection )
           QPtrListIterator<SUIT_Application> it( apps );
          for( ; it.current(); ++it ) {
             SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( it.current() );
-            if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId && anApp->objectBrowser() )
-             anApp->objectBrowser()->updateTree();
+            if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId )
+             anApp->updateObjectBrowser();
           }
         }
       }
index 279d39515c605264e8692702b2eee0cc533f5df1..848e4167dfb8b58b7c34bcf636beda19c949a96f 100644 (file)
@@ -137,9 +137,7 @@ void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ )
     TEvent() {}
     virtual void Execute() {
       if ( SalomeApp_Application* anApp = getApplication() ) {
-       OB_Browser* browser = anApp->objectBrowser();
-       if ( browser )
-         browser->updateTree();
+       anApp->updateObjectBrowser();
       }
     }
   };
index 6aae237c8e6eaef20f328df97e061b7207419cf0..4a5c188543143b90af71c5346145aed361d83406 100644 (file)
@@ -572,16 +572,9 @@ void SalomeApp_Application::onSelectionChanged()
    } 
 }              
  
-
 void SalomeApp_Application::onRefresh()
 {
-  for ( ModuleListIterator it = modules(); it.current(); ++it )
-  {    
-    CAM_DataModel* camDM = it.current()->dataModel();
-    if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) )
-      ((SalomeApp_DataModel*)camDM)->update();
-  }
-  objectBrowser()->updateTree();
+  updateObjectBrowser( true );
 }
 
 void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
@@ -1398,3 +1391,17 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* t
   thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
 }
 
+void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
+{
+  if ( updateModels ) 
+  {
+    for ( ModuleListIterator it = modules(); it.current(); ++it )
+    {    
+      CAM_DataModel* camDM = it.current()->dataModel();
+      if ( camDM && camDM->inherits( "SalomeApp_DataModel" ) )
+        ((SalomeApp_DataModel*)camDM)->update();
+    }
+  }
+  if ( objectBrowser() )
+    objectBrowser()->updateTree();
+}
index c118787915d1dc3c2fca4fb16e279f6b404b9add..266ef4f0d3ee200fcc0ae27a16831a1889277a10 100644 (file)
@@ -71,6 +71,8 @@ public:
   OB_Browser*                         objectBrowser();
   PythonConsole*                      pythonConsole();   
 
+  virtual void                        updateObjectBrowser( const bool = true );
+
   SalomeApp_Preferences*              preferences() const;
 
   virtual QString                     getFileFilter() const;