]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Rename of bathymetry object corrected (Bug #165).
authoradv <adv@opencascade.com>
Fri, 6 Dec 2013 12:02:04 +0000 (12:02 +0000)
committeradv <adv@opencascade.com>
Fri, 6 Dec 2013 12:02:04 +0000 (12:02 +0000)
src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx

index ea5eb1e1b3bef3eecb7a8e84d03782eb0014d891..458e2e80bb8368d305a8632b3b5579cfa8683d02 100644 (file)
@@ -121,12 +121,15 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags,
     return false;
   }
 
-  // check that there are no other objects with the same name in the document
-  Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
-  if ( ( !myIsEdit ) && ( !anObject.IsNull() ) )
+  if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
   {
-    theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
-    return false;
+    // check that there are no other objects with the same name in the document
+    Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
+    if( !anObject.IsNull() )
+    {
+      theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName );
+      return false;
+    }
   }
 
   Handle(HYDROData_Bathymetry) aBathymetryObj;