Salome HOME
add method NameChanged to update title name
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_Study.cxx
index ca04c276df6b7174ba58e96d75c5fc28367eb79f..a9fae3dae14faf9dbeb30d0cc4950f6f98837b05 100644 (file)
@@ -150,6 +150,7 @@ void SALOMEDSImpl_Study::Init()
   _builder = new SALOMEDSImpl_StudyBuilder(this);
   _cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
   _notifier=0;
+  _genObjRegister=0;
   //Put on the root label a StudyHandle attribute to store the address of this object
   //It will be used to retrieve the study object by DF_Label that belongs to the study
   SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
@@ -2493,7 +2494,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath,
 
   sfp << std::endl;
   sfp << "if salome.sg.hasDesktop():" << std::endl;
-  sfp << "\tsalome.sg.updateObjBrowser(True)" << std::endl;
+  sfp << "\tsalome.sg.updateObjBrowser()" << std::endl;
 
   if(isDumpVisuals) { //Output the call to Session's method restoreVisualState
     sfp << "\tiparameters.getSession().restoreVisualState(1)" << std::endl;
@@ -3200,6 +3201,49 @@ void SALOMEDSImpl_Study::setNotifier(SALOMEDSImpl_AbstractCallback* notifier)
   _notifier=notifier;
 }
 
+static SALOMEDSImpl_AbstractCallback* & getGenObjRegister( DF_Document* doc )
+{
+  static std::vector< SALOMEDSImpl_AbstractCallback* > _genObjRegVec;
+  if ( doc->GetDocumentID() >= (int)_genObjRegVec.size() )
+    _genObjRegVec.resize( doc->GetDocumentID() + 1, 0 );
+  return _genObjRegVec[ doc->GetDocumentID() ];
+}
+
+//================================================================================
+/*!
+ * \brief Stores theRegister
+ */
+//================================================================================
+
+void SALOMEDSImpl_Study::setGenObjRegister(SALOMEDSImpl_AbstractCallback* theRegister)
+{
+  getGenObjRegister( _doc ) = theRegister;
+}
+
+//================================================================================
+/*!
+ * \brief Indirectly invokes GenericObj_i::Register()
+ */
+//================================================================================
+
+void SALOMEDSImpl_Study::RegisterGenObj  (const std::string& theIOR, DF_Label label)
+{
+  if ( SALOMEDSImpl_AbstractCallback* goRegister = getGenObjRegister( label.GetDocument() ))
+    goRegister->RegisterGenObj( theIOR );
+}
+
+//================================================================================
+/*!
+ * \brief Indirectly invokes GenericObj_i::UnRegister()
+ */
+//================================================================================
+
+void SALOMEDSImpl_Study::UnRegisterGenObj(const std::string& theIOR, DF_Label label)
+{
+  if ( SALOMEDSImpl_AbstractCallback* goRegister = getGenObjRegister( label.GetDocument() ))
+    goRegister->UnRegisterGenObj( theIOR );
+}
+
 //#######################################################################################################
 //#                                     STATIC PRIVATE FUNCTIONS
 //#######################################################################################################