+ // Check obstacle name
+ anObstacleName = aPanel->getObjectName().simplified();
+ if ( anObstacleName.isEmpty() ) {
+ theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
+ return false;
+ }
+
+ if( anObstacle.IsNull() || anObstacle->GetName() != anObstacleName ) {
+ // check that there are no other objects with the same name in the document
+ Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObstacleName );
+ if( !anObject.IsNull() ) {
+ theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObstacleName );
+ return false;
+ }
+ }
+