Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index ba34e1e62721aff393d7b80e60dae89b21a62afc..2369f1f52e58533dd3f44eff1453c7b70e8056a2 100644 (file)
@@ -438,7 +438,8 @@ void HYDROGUI_DataModel::update( LightApp_DataObject* theObject,
 
 CAM_DataObject* HYDROGUI_DataModel::createRootModuleObject( SUIT_DataObject* theParent )
 {
-  CAM_DataObject* aRootObj = createModuleObject( theParent );
+  CAM_ModuleObject* aRootObj = createModuleObject( theParent );
+  aRootObj->setDataModel( this );
   setRoot( aRootObj );
   return aRootObj;
 }
@@ -849,3 +850,24 @@ bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theC
   }
   return isOk;
 }
+
+bool HYDROGUI_DataModel::rename( Handle(HYDROData_Entity) theEntity, const QString& theName )
+{
+  if ( theName.isEmpty() )
+    return false;
+
+  try 
+  {
+    getDocument()->StartOperation();
+    theEntity->SetName( theName );
+    getDocument()->CommitOperation( HYDROGUI_Tool::ToExtString( tr("RENAME_TO").arg( theName ) ) );
+    module()->application()->activeStudy()->Modified();
+  }
+  catch ( Standard_Failure )
+  {
+    getDocument()->AbortOperation();
+    return false;
+  }
+  return true;
+}
+